forked from Mange/roadie-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·62 lines (49 loc) · 1.15 KB
/
setup.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
59
60
61
62
#!/bin/bash
# This cannot be executed from within a Ruby-based environment (like Rake)
# since Bundler will affect the subshell environments.
set -e
function header() {
echo -e "\n$(tput setaf 5)$(tput smul)$1:$(tput sgr0)"
}
function green() {
echo $(tput setaf 2)$@$(tput sgr0)
}
function update() {
bundle update | grep -ve "^Using "
}
function install() {
bundle install --quiet && green " OK"
}
root=$(dirname $0)
# Set by Travis CI; interferes with the nested repos
unset BUNDLE_GEMFILE
if [[ $1 == "install" ]]; then
header "Installing gem dependencies"
install
for app_path in $root/spec/railsapps/rails_*; do
(
cd $app_path
header "Installing gems for $(basename $app_path)"
install
)
done
echo ""
elif [[ $1 == "update" ]]; then
header "Updating gem dependencies"
update
for app_path in $root/spec/railsapps/rails_*; do
(
cd $app_path
header "Updating $(basename $app_path)"
update
)
done
echo ""
else
echo "Usage: $0 [install|update]"
echo ""
echo " Install: Install all bundled updates."
echo " Update: Run bundle update on all bundles."
echo ""
exit 127
fi