-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
executable file
·77 lines (62 loc) · 1.83 KB
/
go
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
[ -n "$GO_DEBUG" ] && set -x
set -e
project_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
verbose="no"
skip_checks="no"
skip_pre_flight="no"
offline="no"
missing_dependency="no"
[ -n "$GO_DEBUG" ] && verbose="yes"
[ -n "$GO_SKIP_CHECKS" ] && skip_checks="yes"
[ -n "$GO_SKIP_PRE_FLIGHT" ] && skip_pre_flight="yes"
[ -n "$GO_OFFLINE" ] && offline="yes"
if [[ "$skip_checks" = "no" ]]; then
echo "Checking for system dependencies."
ruby_version="$(cat "$project_dir"/.ruby-version)"
if ! type ruby >/dev/null 2>&1 || ! ruby -v | grep -q "$ruby_version"; then
echo "This codebase requires Ruby $ruby_version."
missing_dependency="yes"
fi
if [[ "$missing_dependency" = "yes" ]]; then
echo "Please install missing dependencies to continue."
exit 1
fi
echo "All system dependencies present. Continuing."
fi
if [[ "$offline" = "no" ]]; then
echo "Installing bundler."
if [[ "$verbose" = "yes" ]]; then
gem install --no-document bundler
else
gem install --no-document bundler --silent
fi
echo "Installing ruby dependencies."
if [[ "$verbose" = "yes" ]]; then
bundle install
else
bundle install --quiet
fi
fi
if [[ "$skip_pre_flight" = "no" ]]; then
if [[ "$offline" = "no" ]]; then
echo "Installing bundler."
if [[ "$verbose" = "yes" ]]; then
gem install --no-document bundler
else
gem install --no-document bundler > /dev/null
fi
echo "Installing ruby dependencies."
if [[ "$verbose" = "yes" ]]; then
bundle install
else
bundle install > /dev/null
fi
fi
fi
echo "Starting rake."
if [[ "$verbose" = "yes" ]]; then
time bundle exec rake --verbose "$@"
else
time bundle exec rake "$@"
fi