-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (47 loc) · 1.1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#set -x
function install_bundler {
gem sources | grep "http://rubygems.org/" > /dev/null || gem sources -a http://rubygems.org/ && \
gem sources | grep "http://gems.rubyforge.org/" > /dev/null || gem sources -a http://gems.rubyforge.org/ && \
gem install bundler --no-ri --no-rdoc
}
function check_bundler {
which bundle | grep 1.8.7-p352 > /dev/null || install_bundler
}
function check_brew {
which brew || ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
}
function check_node {
which node || brew install node
}
function check_mongodb {
which mongod || brew install mongodb
}
function check_express {
which express || npm install -g express
}
function check_gems {
bundle update
bundle install
}
function check_env {
check_bundler
check_brew
check_node
check_mongodb
check_express
check_gems
}
function show_help {
echo "Usage: build.sh [COMMAND]"
echo ""
echo "COMMAND:"
echo -e " check_env: check and install bundler\breww\node\express\mogodb and other gems"
}
function main {
case $1 in
check_env) check_env;;
*) show_help ; exit 1;;
esac
}
main $@