alpha_omega 0.0.111 → 0.0.113
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mkd +8 -6
- data/VERSION +1 -1
- data/lib/alpha_omega/deploy/scm/git.rb +2 -1
- data/lib/alpha_omega/deploy.rb +27 -27
- data/lib/alpha_omega/utils.rb +10 -19
- data/libexec/activate +82 -15
- data/libexec/build +82 -15
- data/libexec/bump +162 -0
- data/libexec/check +82 -15
- data/libexec/compare +82 -15
- data/libexec/config +82 -15
- data/libexec/debug +82 -15
- data/libexec/deploy +82 -15
- data/libexec/dist +82 -15
- data/libexec/dna +82 -15
- data/libexec/hosts +82 -15
- data/libexec/invoke +82 -15
- data/libexec/lock +162 -0
- data/libexec/plan +162 -0
- data/libexec/proxy +2 -1
- data/libexec/release +82 -15
- data/libexec/restart +82 -15
- data/libexec/rollback +82 -15
- data/libexec/shell +82 -15
- data/libexec/stage +82 -15
- data/libexec/unlock +162 -0
- metadata +7 -3
data/README.mkd
CHANGED
@@ -9,18 +9,20 @@ Getting Started
|
|
9
9
|
===============
|
10
10
|
|
11
11
|
Your local machine must let you ssh and run sudo without a password
|
12
|
-
during the deploy.
|
12
|
+
during the deploy. It must also have access to opsdb directly or via a
|
13
|
+
proxy dpeloy host.
|
13
14
|
|
14
15
|
Move the example Capfile.
|
15
16
|
|
16
17
|
mv Capfile.example Capfile
|
17
18
|
|
18
|
-
Run the
|
19
|
+
Run the hosts script to see what hosts are visible.
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
bin/hosts world
|
22
|
+
|
23
|
+
Run the deploy script with host and group arguments to deploy.
|
24
|
+
|
25
|
+
bin/deploy XXX
|
24
26
|
|
25
27
|
LICENSE
|
26
28
|
-------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.113
|
@@ -75,7 +75,8 @@ module Capistrano
|
|
75
75
|
execute = []
|
76
76
|
|
77
77
|
execute << "[[ -d #{destination}/.git ]] || #{git} clone #{verbose} #{variable(:repository)} #{destination}"
|
78
|
-
execute << "cd #{destination} && #{git} fetch -q && #{git}
|
78
|
+
execute << "cd #{destination} && #{git} fetch -q && #{git} checkout -q --force #{revision}"
|
79
|
+
execute << "cd #{destination} && #{git} reset --hard #{revision} && #{git} submodule update --init --recursive"
|
79
80
|
|
80
81
|
execute
|
81
82
|
end
|
data/lib/alpha_omega/deploy.rb
CHANGED
@@ -60,49 +60,47 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
60
60
|
# =========================================================================
|
61
61
|
|
62
62
|
_cset(:source) { Capistrano::Deploy::SCM.new(scm, self) }
|
63
|
-
_cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { run_locally(cmd) } } }
|
64
|
-
|
65
63
|
_cset(:strategy) { Capistrano::Deploy::Strategy.new(deploy_via, self) }
|
64
|
+
_cset(:real_revision) { source.local.query_revision(revision) { |cmd| with_env("LC_ALL", "C") { run_locally(cmd) } } }
|
66
65
|
|
67
|
-
_cset(:version_dir) { releases.length > 0 ? "releases" : "" }
|
68
|
-
_cset :current_dir, "current"
|
69
|
-
_cset :service_dir, "service"
|
70
|
-
_cset :log_dir, "log"
|
71
|
-
_cset :releases, %w(alpha omega)
|
72
|
-
|
73
|
-
_cset(:releases_path) { File.join(deploy_to, version_dir) }
|
74
|
-
_cset(:current_path) { File.join(deploy_to, current_dir) }
|
75
|
-
_cset(:service_path) { File.join(deploy_to, service_dir) }
|
76
|
-
_cset(:log_path) { File.join(deploy_to, log_dir) }
|
77
|
-
_cset(:service_drop) { File.join(deploy_to, ".#{service_dir}.d") }
|
78
|
-
_cset(:release_path) { File.join(releases_path, release_name) }
|
79
|
-
|
80
|
-
_cset(:current_release) { release_path }
|
81
66
|
_cset(:current_workarea) { capture("readlink #{current_path} || true").strip.split("/")[-1] }
|
82
|
-
|
83
|
-
_cset(:previous_release) {
|
67
|
+
_cset(:release_name) {
|
84
68
|
if releases.length > 0
|
85
69
|
w = current_workarea
|
86
|
-
releases.index(w)
|
70
|
+
stage = releases[((releases.index(w)?releases.index(w):-1)+1)%releases.length]
|
71
|
+
system "#{figlet} -w 200 on #{stage}"
|
72
|
+
stage
|
87
73
|
else
|
88
74
|
""
|
89
75
|
end
|
90
76
|
}
|
91
77
|
|
92
|
-
_cset
|
78
|
+
_cset :releases, [ "alpha", "beta", "omega" ]
|
79
|
+
_cset(:releases_dir) { releases.length > 0 ? "releases" : "" }
|
80
|
+
_cset :previous_dir, "previous"
|
81
|
+
_cset :current_dir, "current"
|
82
|
+
_cset :service_dir, "service"
|
83
|
+
_cset :log_dir, "log"
|
84
|
+
|
85
|
+
|
86
|
+
_cset(:releases_path) { File.join(deploy_to, releases_dir) }
|
87
|
+
_cset(:release_path) { File.join(releases_path, release_name) }
|
88
|
+
_cset(:previous_path) {
|
93
89
|
if releases.length > 0
|
94
90
|
w = current_workarea
|
95
|
-
|
96
|
-
system "#{figlet} -w 200 on #{stage}"
|
97
|
-
stage
|
91
|
+
releases.index(w) && releases[(releases.index(w)-1)%releases.length] || ""
|
98
92
|
else
|
99
93
|
""
|
100
94
|
end
|
101
95
|
}
|
96
|
+
_cset(:current_path) { File.join(deploy_to, current_dir) }
|
97
|
+
_cset(:service_path) { File.join(deploy_to, service_dir) }
|
98
|
+
_cset(:service_drop) { File.join(deploy_to, ".#{service_dir}.d") }
|
99
|
+
_cset(:log_path) { File.join(deploy_to, log_dir) }
|
102
100
|
|
101
|
+
_cset(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
|
103
102
|
_cset(:current_revision) { capture("cat #{current_path}/REVISION", :except => { :no_release => true }).chomp }
|
104
103
|
_cset(:latest_revision) { capture("cat #{current_release}/REVISION", :except => { :no_release => true }).chomp }
|
105
|
-
_cset(:previous_revision) { capture("cat #{previous_release}/REVISION", :except => { :no_release => true }).chomp if previous_release }
|
106
104
|
|
107
105
|
_cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
|
108
106
|
|
@@ -115,7 +113,9 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
115
113
|
# standalone case, or during deployment.
|
116
114
|
#
|
117
115
|
# with persistent releases, the latest release is always the current release
|
118
|
-
_cset(:
|
116
|
+
_cset(:previous_release) { previous_path }
|
117
|
+
_cset(:current_release) { release_path }
|
118
|
+
_cset(:latest_release) { current_release }
|
119
119
|
|
120
120
|
# =========================================================================
|
121
121
|
# deploy:lock defaults
|
@@ -517,7 +517,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
517
517
|
end
|
518
518
|
|
519
519
|
run_script = <<-SCRIPT
|
520
|
-
echo #{epoch} #{ENV['
|
520
|
+
echo #{epoch} #{ENV['AO_USER']} > #{log_path}/.#{application}_deploy_lock;
|
521
521
|
SCRIPT
|
522
522
|
|
523
523
|
at_exit { self.unlock; }
|
@@ -538,7 +538,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
538
538
|
SCRIPT
|
539
539
|
|
540
540
|
run_script += <<-SCRIPT
|
541
|
-
#{ruby_loader} bundle check 2>&1 > /dev/null || { #{ruby_loader} bundle install --quiet --local #{bundler_options} && #{ruby_loader} bundle check; };
|
541
|
+
#{ruby_loader} bundle check 2>&1 > /dev/null || { #{ruby_loader} bundle install --quiet --local #{bundler_options} && #{ruby_loader} bundle check > /dev/null; };
|
542
542
|
SCRIPT
|
543
543
|
|
544
544
|
run run_script.gsub(/[\n\r]+[ \t]+/, " ")
|
data/lib/alpha_omega/utils.rb
CHANGED
@@ -140,28 +140,19 @@ module AlphaOmega
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
def self.what_branch (allowed = %w(production master develop))
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
current = `git branch`.split("\n").find {|b| b.split(" ")[0] == '*' } # use Grit
|
150
|
-
if current
|
151
|
-
star, branch_name = current.split(" ")
|
152
|
-
branch_type, branch_feature = branch_name.split("/")
|
153
|
-
if %w(feature hotfix).member?(branch_type)
|
154
|
-
branch_name
|
155
|
-
elsif allowed.any? {|rx| rx.match(branch_name) }
|
156
|
-
branch_name
|
157
|
-
else
|
158
|
-
puts "current branch must be #{allowed.join(', ')}, feature/xyz, or hotfix/xyz"
|
159
|
-
abort
|
160
|
-
end
|
143
|
+
def self.what_branch (allowed = %w(production staging master develop) + [%r(/)])
|
144
|
+
current = `git branch`.split("\n").find {|b| b.split(" ")[0] == '*' } # use Grit
|
145
|
+
if current
|
146
|
+
star, branch_name = current.split(" ")
|
147
|
+
if allowed.any? {|rx| rx.match(branch_name) }
|
148
|
+
branch_name
|
161
149
|
else
|
162
|
-
puts "
|
150
|
+
puts "current branch must be one of #{allowed.join(', ')}"
|
163
151
|
abort
|
164
152
|
end
|
153
|
+
else
|
154
|
+
puts "could not find a suitable branch"
|
155
|
+
abort
|
165
156
|
end
|
166
157
|
end
|
167
158
|
|
data/libexec/activate
CHANGED
@@ -36,35 +36,78 @@ case "$(basename $0)" in
|
|
36
36
|
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
|
37
37
|
;;
|
38
38
|
|
39
|
+
bump)
|
40
|
+
case "$1" in
|
41
|
+
patch|minor|major)
|
42
|
+
bump=$1; shift
|
43
|
+
set $(cat VERSION | sed 's#\.# #g')
|
44
|
+
case "$bump" in
|
45
|
+
patch)
|
46
|
+
echo "$1.$2.$(($3 + 1))"
|
47
|
+
;;
|
48
|
+
minor)
|
49
|
+
echo "$1.$(($2 + 1)).0"
|
50
|
+
;;
|
51
|
+
major)
|
52
|
+
echo "$(($1 + 1)).0.0"
|
53
|
+
;;
|
54
|
+
esac > VERSION
|
55
|
+
;;
|
56
|
+
*)
|
57
|
+
ver_new=$1; shift
|
58
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
59
|
+
M=$1; shift
|
60
|
+
m=$1; shift
|
61
|
+
p=$1; shift
|
62
|
+
|
63
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
64
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
65
|
+
ver_new_same=$(cat $tmp_version)
|
66
|
+
rm -f $tmp_version
|
67
|
+
|
68
|
+
if [[ $ver_new = $ver_new_same ]]; then
|
69
|
+
echo "$ver_new" > VERSION
|
70
|
+
else
|
71
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
;;
|
75
|
+
esac
|
76
|
+
|
77
|
+
if [[ -f Gemfile ]]; then
|
78
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
79
|
+
git add Gemfile.lock
|
80
|
+
fi
|
81
|
+
|
82
|
+
git add VERSION
|
83
|
+
|
84
|
+
ver_bumped=$(cat VERSION)
|
85
|
+
git commit -m "bump: $ver_bumped"
|
86
|
+
git tag "v$ver_bumped"
|
87
|
+
echo $ver_bumped
|
88
|
+
;;
|
89
|
+
|
39
90
|
*)
|
40
91
|
set $(for a in "$@"; do echo $a.app; done)
|
41
92
|
case "$(basename $0)" in
|
42
|
-
deploy
|
93
|
+
deploy)
|
43
94
|
bundle exec cap "$@" deploy
|
44
95
|
;;
|
45
96
|
|
46
|
-
|
47
|
-
bundle exec cap "$@" deploy
|
97
|
+
release)
|
98
|
+
bundle exec cap "$@" deploy
|
48
99
|
;;
|
49
100
|
|
50
101
|
stage)
|
51
102
|
bundle exec cap "$@" deploy:update_code
|
52
103
|
;;
|
53
104
|
|
54
|
-
activate)
|
55
|
-
bundle exec cap "$@" deploy:symlink deploy:restart
|
56
|
-
;;
|
57
|
-
|
58
|
-
compare)
|
59
|
-
bundle exec cap "$@" deploy:compare
|
60
|
-
;;
|
61
|
-
|
62
105
|
restart)
|
63
106
|
bundle exec cap "$@" deploy:restart
|
64
107
|
;;
|
65
108
|
|
66
|
-
|
67
|
-
bundle exec cap "$@" deploy:
|
109
|
+
config)
|
110
|
+
bundle exec cap "$@" deploy:config
|
68
111
|
;;
|
69
112
|
|
70
113
|
build)
|
@@ -75,8 +118,32 @@ case "$(basename $0)" in
|
|
75
118
|
bundle exec cap "$@" deploy:dist
|
76
119
|
;;
|
77
120
|
|
78
|
-
|
79
|
-
bundle exec cap "$@" deploy:
|
121
|
+
activate)
|
122
|
+
bundle exec cap "$@" deploy:symlink deploy:restart
|
123
|
+
;;
|
124
|
+
|
125
|
+
rollback)
|
126
|
+
bundle exec cap "$@" deploy:rollback
|
127
|
+
;;
|
128
|
+
|
129
|
+
check)
|
130
|
+
bundle exec cap "$@" deploy:check
|
131
|
+
;;
|
132
|
+
|
133
|
+
compare)
|
134
|
+
bundle exec cap "$@" deploy:compare
|
135
|
+
;;
|
136
|
+
|
137
|
+
plan)
|
138
|
+
bundle exec cap "$@" deploy:plan
|
139
|
+
;;
|
140
|
+
|
141
|
+
lock)
|
142
|
+
bundle exec cap "$@" deploy:lock
|
143
|
+
;;
|
144
|
+
|
145
|
+
unlock)
|
146
|
+
bundle exec cap "$@" deploy:unlock
|
80
147
|
;;
|
81
148
|
|
82
149
|
invoke)
|
data/libexec/build
CHANGED
@@ -36,35 +36,78 @@ case "$(basename $0)" in
|
|
36
36
|
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
|
37
37
|
;;
|
38
38
|
|
39
|
+
bump)
|
40
|
+
case "$1" in
|
41
|
+
patch|minor|major)
|
42
|
+
bump=$1; shift
|
43
|
+
set $(cat VERSION | sed 's#\.# #g')
|
44
|
+
case "$bump" in
|
45
|
+
patch)
|
46
|
+
echo "$1.$2.$(($3 + 1))"
|
47
|
+
;;
|
48
|
+
minor)
|
49
|
+
echo "$1.$(($2 + 1)).0"
|
50
|
+
;;
|
51
|
+
major)
|
52
|
+
echo "$(($1 + 1)).0.0"
|
53
|
+
;;
|
54
|
+
esac > VERSION
|
55
|
+
;;
|
56
|
+
*)
|
57
|
+
ver_new=$1; shift
|
58
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
59
|
+
M=$1; shift
|
60
|
+
m=$1; shift
|
61
|
+
p=$1; shift
|
62
|
+
|
63
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
64
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
65
|
+
ver_new_same=$(cat $tmp_version)
|
66
|
+
rm -f $tmp_version
|
67
|
+
|
68
|
+
if [[ $ver_new = $ver_new_same ]]; then
|
69
|
+
echo "$ver_new" > VERSION
|
70
|
+
else
|
71
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
;;
|
75
|
+
esac
|
76
|
+
|
77
|
+
if [[ -f Gemfile ]]; then
|
78
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
79
|
+
git add Gemfile.lock
|
80
|
+
fi
|
81
|
+
|
82
|
+
git add VERSION
|
83
|
+
|
84
|
+
ver_bumped=$(cat VERSION)
|
85
|
+
git commit -m "bump: $ver_bumped"
|
86
|
+
git tag "v$ver_bumped"
|
87
|
+
echo $ver_bumped
|
88
|
+
;;
|
89
|
+
|
39
90
|
*)
|
40
91
|
set $(for a in "$@"; do echo $a.app; done)
|
41
92
|
case "$(basename $0)" in
|
42
|
-
deploy
|
93
|
+
deploy)
|
43
94
|
bundle exec cap "$@" deploy
|
44
95
|
;;
|
45
96
|
|
46
|
-
|
47
|
-
bundle exec cap "$@" deploy
|
97
|
+
release)
|
98
|
+
bundle exec cap "$@" deploy
|
48
99
|
;;
|
49
100
|
|
50
101
|
stage)
|
51
102
|
bundle exec cap "$@" deploy:update_code
|
52
103
|
;;
|
53
104
|
|
54
|
-
activate)
|
55
|
-
bundle exec cap "$@" deploy:symlink deploy:restart
|
56
|
-
;;
|
57
|
-
|
58
|
-
compare)
|
59
|
-
bundle exec cap "$@" deploy:compare
|
60
|
-
;;
|
61
|
-
|
62
105
|
restart)
|
63
106
|
bundle exec cap "$@" deploy:restart
|
64
107
|
;;
|
65
108
|
|
66
|
-
|
67
|
-
bundle exec cap "$@" deploy:
|
109
|
+
config)
|
110
|
+
bundle exec cap "$@" deploy:config
|
68
111
|
;;
|
69
112
|
|
70
113
|
build)
|
@@ -75,8 +118,32 @@ case "$(basename $0)" in
|
|
75
118
|
bundle exec cap "$@" deploy:dist
|
76
119
|
;;
|
77
120
|
|
78
|
-
|
79
|
-
bundle exec cap "$@" deploy:
|
121
|
+
activate)
|
122
|
+
bundle exec cap "$@" deploy:symlink deploy:restart
|
123
|
+
;;
|
124
|
+
|
125
|
+
rollback)
|
126
|
+
bundle exec cap "$@" deploy:rollback
|
127
|
+
;;
|
128
|
+
|
129
|
+
check)
|
130
|
+
bundle exec cap "$@" deploy:check
|
131
|
+
;;
|
132
|
+
|
133
|
+
compare)
|
134
|
+
bundle exec cap "$@" deploy:compare
|
135
|
+
;;
|
136
|
+
|
137
|
+
plan)
|
138
|
+
bundle exec cap "$@" deploy:plan
|
139
|
+
;;
|
140
|
+
|
141
|
+
lock)
|
142
|
+
bundle exec cap "$@" deploy:lock
|
143
|
+
;;
|
144
|
+
|
145
|
+
unlock)
|
146
|
+
bundle exec cap "$@" deploy:unlock
|
80
147
|
;;
|
81
148
|
|
82
149
|
invoke)
|
data/libexec/bump
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
hst_this=$(hostname -s)
|
4
|
+
if ! echo "$hst_this" | egrep -q "^(admin|develop)"; then
|
5
|
+
# unless the .ao_no_proxy file exists
|
6
|
+
if [[ ! -f ".ao_no_proxy" ]]; then
|
7
|
+
# ssh into deploy host and run from there
|
8
|
+
exec bin/proxy $(basename $0) "$@"
|
9
|
+
exit 1
|
10
|
+
fi
|
11
|
+
fi
|
12
|
+
|
13
|
+
case "$(basename $0)" in
|
14
|
+
debug)
|
15
|
+
export LOCAL_ONLY=true
|
16
|
+
|
17
|
+
{
|
18
|
+
cap $(for a in "$@"; do echo $a.echo; done)
|
19
|
+
}
|
20
|
+
;;
|
21
|
+
|
22
|
+
hosts)
|
23
|
+
export LOCAL_ONLY=true
|
24
|
+
|
25
|
+
{
|
26
|
+
cap $(for a in "$@"; do echo $a.echo; done)
|
27
|
+
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
|
28
|
+
;;
|
29
|
+
|
30
|
+
dna)
|
31
|
+
export LOCAL_ONLY=true
|
32
|
+
|
33
|
+
{
|
34
|
+
echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
|
35
|
+
cap $(for a in "$@"; do echo $a.yaml; done)
|
36
|
+
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
|
37
|
+
;;
|
38
|
+
|
39
|
+
bump)
|
40
|
+
case "$1" in
|
41
|
+
patch|minor|major)
|
42
|
+
bump=$1; shift
|
43
|
+
set $(cat VERSION | sed 's#\.# #g')
|
44
|
+
case "$bump" in
|
45
|
+
patch)
|
46
|
+
echo "$1.$2.$(($3 + 1))"
|
47
|
+
;;
|
48
|
+
minor)
|
49
|
+
echo "$1.$(($2 + 1)).0"
|
50
|
+
;;
|
51
|
+
major)
|
52
|
+
echo "$(($1 + 1)).0.0"
|
53
|
+
;;
|
54
|
+
esac > VERSION
|
55
|
+
;;
|
56
|
+
*)
|
57
|
+
ver_new=$1; shift
|
58
|
+
set $(echo "$ver_new" | sed 's#\.# #g') 0
|
59
|
+
M=$1; shift
|
60
|
+
m=$1; shift
|
61
|
+
p=$1; shift
|
62
|
+
|
63
|
+
tmp_version=$(mktemp -t XXXXXXXXX)
|
64
|
+
(echo "$(($M+0)).$(($m+0)).$(($p+0))" > $tmp_version) 2>&-
|
65
|
+
ver_new_same=$(cat $tmp_version)
|
66
|
+
rm -f $tmp_version
|
67
|
+
|
68
|
+
if [[ $ver_new = $ver_new_same ]]; then
|
69
|
+
echo "$ver_new" > VERSION
|
70
|
+
else
|
71
|
+
echo "ERROR: invalid version: $ver_new" 1>&2
|
72
|
+
exit 1
|
73
|
+
fi
|
74
|
+
;;
|
75
|
+
esac
|
76
|
+
|
77
|
+
if [[ -f Gemfile ]]; then
|
78
|
+
bundle check 2>&1 >/dev/null || { bundle --quiet install --local --path vendor/bundle || bundle check > /dev/null; }
|
79
|
+
git add Gemfile.lock
|
80
|
+
fi
|
81
|
+
|
82
|
+
git add VERSION
|
83
|
+
|
84
|
+
ver_bumped=$(cat VERSION)
|
85
|
+
git commit -m "bump: $ver_bumped"
|
86
|
+
git tag "v$ver_bumped"
|
87
|
+
echo $ver_bumped
|
88
|
+
;;
|
89
|
+
|
90
|
+
*)
|
91
|
+
set $(for a in "$@"; do echo $a.app; done)
|
92
|
+
case "$(basename $0)" in
|
93
|
+
deploy)
|
94
|
+
bundle exec cap "$@" deploy
|
95
|
+
;;
|
96
|
+
|
97
|
+
release)
|
98
|
+
bundle exec cap "$@" deploy
|
99
|
+
;;
|
100
|
+
|
101
|
+
stage)
|
102
|
+
bundle exec cap "$@" deploy:update_code
|
103
|
+
;;
|
104
|
+
|
105
|
+
restart)
|
106
|
+
bundle exec cap "$@" deploy:restart
|
107
|
+
;;
|
108
|
+
|
109
|
+
config)
|
110
|
+
bundle exec cap "$@" deploy:config
|
111
|
+
;;
|
112
|
+
|
113
|
+
build)
|
114
|
+
bundle exec cap "$@" deploy:build
|
115
|
+
;;
|
116
|
+
|
117
|
+
dist)
|
118
|
+
bundle exec cap "$@" deploy:dist
|
119
|
+
;;
|
120
|
+
|
121
|
+
activate)
|
122
|
+
bundle exec cap "$@" deploy:symlink deploy:restart
|
123
|
+
;;
|
124
|
+
|
125
|
+
rollback)
|
126
|
+
bundle exec cap "$@" deploy:rollback
|
127
|
+
;;
|
128
|
+
|
129
|
+
check)
|
130
|
+
bundle exec cap "$@" deploy:check
|
131
|
+
;;
|
132
|
+
|
133
|
+
compare)
|
134
|
+
bundle exec cap "$@" deploy:compare
|
135
|
+
;;
|
136
|
+
|
137
|
+
plan)
|
138
|
+
bundle exec cap "$@" deploy:plan
|
139
|
+
;;
|
140
|
+
|
141
|
+
lock)
|
142
|
+
bundle exec cap "$@" deploy:lock
|
143
|
+
;;
|
144
|
+
|
145
|
+
unlock)
|
146
|
+
bundle exec cap "$@" deploy:unlock
|
147
|
+
;;
|
148
|
+
|
149
|
+
invoke)
|
150
|
+
bundle exec cap "$@" invoke
|
151
|
+
;;
|
152
|
+
|
153
|
+
shell)
|
154
|
+
bundle exec cap "$@" shell
|
155
|
+
;;
|
156
|
+
|
157
|
+
*)
|
158
|
+
bundle exec cap "$@"
|
159
|
+
;;
|
160
|
+
esac
|
161
|
+
esac
|
162
|
+
|