alpha_omega 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/ao +1 -1
- data/lib/alpha_omega/config/deploy_localhost.rb +0 -9
- data/lib/alpha_omega/config/deploy_notify.rb +31 -12
- data/lib/alpha_omega/deploy.rb +21 -10
- data/lib/alpha_omega/deploy/scm/git.rb +1 -0
- data/libexec/_ao +5 -1
- data/libexec/_jason +1 -1
- data/libexec/_log4sh +1 -0
- data/libexec/aoh-debug +1 -0
- data/libexec/aoh-init +2 -2
- data/libexec/aoh-proxy +12 -3
- data/{sbin → libexec}/aoh-stub +0 -0
- data/libexec/aohelper +4 -1
- data/libexec/edit +81 -0
- data/libexec/remote-helper +64 -0
- data/{sbin → libexec}/stub +0 -0
- data/libexec/stub-prepare +3 -2
- data/sbin/local-helper +12 -3
- metadata +8 -9
- data/sbin/aoh +0 -15
- data/sbin/bump +0 -15
- data/sbin/remote-helper +0 -81
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.0
|
data/bin/ao
CHANGED
@@ -12,15 +12,6 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
12
12
|
set :dir_perms, "0755"
|
13
13
|
set :bundler_options, "--path vendor/bundle"
|
14
14
|
set :skip_scm, true
|
15
|
-
|
16
|
-
def run cmd
|
17
|
-
logger.debug "executing locally #{cmd}"
|
18
|
-
run_locally cmd
|
19
|
-
if $?.to_i != 0
|
20
|
-
logger.debug "failed with error code #{$?.to_i >> 8}"
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
end
|
24
15
|
end
|
25
16
|
end
|
26
17
|
end
|
@@ -1,21 +1,19 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
Capistrano::Configuration.instance(:must_exist).load do |config|
|
2
4
|
namespace :deploy do
|
3
5
|
namespace :notify do
|
4
6
|
task :default do
|
5
7
|
if $deploy["notify"]
|
6
|
-
email if $deploy["notify"].member? "email"
|
7
|
-
|
8
8
|
unless skip_notifications
|
9
9
|
airbrake if $deploy["notify"].member? "airbrake"
|
10
10
|
newrelic if $deploy["notify"].member? "newrelic"
|
11
11
|
campfire if $deploy["notify"].member? "campfire"
|
12
12
|
flowdock if $deploy["notify"].member? "flowdock"
|
13
13
|
end
|
14
|
-
end
|
15
|
-
end
|
16
14
|
|
17
|
-
|
18
|
-
|
15
|
+
email if $deploy["notify"].member? "email"
|
16
|
+
end
|
19
17
|
end
|
20
18
|
|
21
19
|
task :campfire do
|
@@ -39,16 +37,16 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
39
37
|
require 'airbrake'
|
40
38
|
require 'airbrake_tasks'
|
41
39
|
|
42
|
-
Airbrake.configure do |
|
43
|
-
|
40
|
+
Airbrake.configure do |abconfig|
|
41
|
+
abconfig.api_key = $deploy["notify"]["airbrake"]["api_key"]
|
44
42
|
end
|
45
43
|
|
46
44
|
begin
|
47
45
|
AirbrakeTasks.deploy({
|
48
46
|
:rails_env => dna['app_env'],
|
49
|
-
:scm_revision =>
|
47
|
+
:scm_revision => "#{real_revision} #{revision}",
|
50
48
|
:scm_repository => repository,
|
51
|
-
:local_username => ENV['
|
49
|
+
:local_username => ENV['_AO_DEPLOYER']
|
52
50
|
})
|
53
51
|
rescue EOFError
|
54
52
|
$stderr.puts "An error occurred during the Airtoad deploy notification."
|
@@ -76,12 +74,33 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
76
74
|
require 'new_relic/recipes'
|
77
75
|
end
|
78
76
|
|
77
|
+
task :email do
|
78
|
+
tmp_notify = Tempfile.new('email')
|
79
|
+
tmp_notify.write notify_message
|
80
|
+
tmp_notify.close
|
81
|
+
run_locally "cat '#{tmp_notify.path}' | mail -s '#{notify_message_abbr}' #{$deploy["notify"]["email"]["recipients"].join(" ")}"
|
82
|
+
tmp_notify.unlink
|
83
|
+
end
|
84
|
+
|
85
|
+
def map_sha_tag rev
|
86
|
+
tag = %x(git show-ref | grep '^#{rev} refs/tags/' | cut -d/ -f3).chomp
|
87
|
+
tag.empty? ? rev : tag
|
88
|
+
end
|
89
|
+
|
90
|
+
def public_git_url url
|
91
|
+
url.sub("git@github.com:","https://github.com/").sub(/\.git$/,'')
|
92
|
+
end
|
93
|
+
|
79
94
|
def notify_message
|
80
|
-
"#{
|
95
|
+
summary = "#{public_git_url repository}/compare/#{map_sha_tag cmp_previous_revision}...#{map_sha_tag cmp_current_revision}"
|
96
|
+
|
97
|
+
"#{ENV['_AO_DEPLOYER']} deployed #{application} to #{ENV['_AO_ARGS']} (#{dna['app_env']}): #{ENV['FLAGS_tag']}" +
|
98
|
+
"\n\nSummary:\n\n" + summary +
|
99
|
+
"\n\nLog:\n\n" + full_log
|
81
100
|
end
|
82
101
|
|
83
102
|
def notify_message_abbr
|
84
|
-
"#{ENV['
|
103
|
+
"#{ENV['_AO_DEPLOYER']} deployed #{application} to #{ENV['_AO_ARGS']} (#{dna['app_env']}): #{ENV['FLAGS_tag']}"
|
85
104
|
end
|
86
105
|
end
|
87
106
|
end
|
data/lib/alpha_omega/deploy.rb
CHANGED
@@ -58,7 +58,10 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
58
58
|
_cset :last_pod, nil
|
59
59
|
_cset :success, false
|
60
60
|
|
61
|
-
_cset (:figlet) {
|
61
|
+
_cset (:figlet) {
|
62
|
+
fig = [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first
|
63
|
+
fig ? "#{fig} -w 200" : "echo"
|
64
|
+
}
|
62
65
|
|
63
66
|
# =========================================================================
|
64
67
|
# services, logs
|
@@ -131,7 +134,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
131
134
|
unless releases.empty?
|
132
135
|
w = current_workarea
|
133
136
|
workarea = releases[((releases.index(w)?releases.index(w):-1)+1)%releases.length]
|
134
|
-
system "#{figlet}
|
137
|
+
system "#{figlet} on #{workarea}"
|
135
138
|
workarea
|
136
139
|
else
|
137
140
|
""
|
@@ -161,7 +164,9 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
161
164
|
|
162
165
|
_cset(:rollback_revision) { capture("cat #{rollback_release}/REVISION 2>&- || true").strip }
|
163
166
|
_cset(:previous_revision) { capture("cat #{previous_release}/REVISION 2>&- || true").strip }
|
167
|
+
_cset(:cmp_previous_revision) { capture("cat #{previous_path}/REVISION 2>&- || true").strip }
|
164
168
|
_cset(:current_revision) { capture("cat #{current_release}/REVISION 2>&- || true").strip }
|
169
|
+
_cset(:cmp_current_revision) { capture("cat #{current_path}/REVISION 2>&- || true").strip }
|
165
170
|
_cset(:next_revision) { capture("cat #{next_release}/REVISION 2>&- || true").strip }
|
166
171
|
_cset(:active_revision) { capture("cat #{active_release}/REVISION 2>&- || true").strip }
|
167
172
|
_cset(:compare_revision) { capture("cat #{compare_release}/REVISION 2>&- || true").strip }
|
@@ -358,7 +363,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
358
363
|
run "mv -T #{previous_path}.new #{previous_path}"
|
359
364
|
end
|
360
365
|
|
361
|
-
system "#{figlet}
|
366
|
+
system "#{figlet} #{current_release_name} activated"
|
362
367
|
end
|
363
368
|
end
|
364
369
|
|
@@ -435,12 +440,12 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
435
440
|
DESC
|
436
441
|
task :revision do
|
437
442
|
if previous_release
|
438
|
-
system "#{figlet}
|
443
|
+
system "#{figlet} on #{previous_release_name}"
|
439
444
|
run "rm -f #{previous_path} #{next_path}"
|
440
445
|
run "ln -nfs #{previous_release} #{current_path}.new"
|
441
446
|
run "mv -T #{current_path}.new #{current_path}"
|
442
447
|
else
|
443
|
-
system "#{figlet}
|
448
|
+
system "#{figlet} failed to rollback"
|
444
449
|
abort "could not rollback the code because there is no prior release"
|
445
450
|
end
|
446
451
|
end
|
@@ -584,7 +589,10 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
584
589
|
end
|
585
590
|
|
586
591
|
if want_unlock
|
587
|
-
at_exit {
|
592
|
+
at_exit {
|
593
|
+
self.unlock;
|
594
|
+
self.successful;
|
595
|
+
}
|
588
596
|
end
|
589
597
|
|
590
598
|
run "echo #{epoch} #{ENV['_AO_DEPLOYER']} > #{lock_path}"
|
@@ -620,13 +628,16 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
620
628
|
end
|
621
629
|
end
|
622
630
|
|
623
|
-
task :successful
|
624
|
-
|
625
|
-
|
631
|
+
task :successful do
|
632
|
+
if success
|
633
|
+
system "#{figlet} success"
|
634
|
+
else
|
635
|
+
system "#{figlet} failed"
|
636
|
+
end
|
626
637
|
end
|
627
638
|
|
628
639
|
task :finished do
|
629
|
-
|
640
|
+
set :success, true
|
630
641
|
end
|
631
642
|
end # :deploy
|
632
643
|
end # Capistrano::Configuration
|
@@ -77,6 +77,7 @@ module Capistrano
|
|
77
77
|
execute << "[[ -d #{destination}/.git ]] || #{git} clone #{verbose} #{variable(:repository)} #{destination}"
|
78
78
|
execute << "cd #{destination} && #{git} fetch -q && #{git} checkout -q --force #{revision}"
|
79
79
|
execute << "cd #{destination} && #{git} reset -q --hard #{revision} && #{git} submodule update -q --init --recursive"
|
80
|
+
execute << "cd #{destination} && #{git} status --porcelain"
|
80
81
|
|
81
82
|
execute
|
82
83
|
end
|
data/libexec/_ao
CHANGED
@@ -19,6 +19,7 @@ DEFINE_string "group" "" "app group override" "g"
|
|
19
19
|
DEFINE_string "ssh_login" "" "ssh login override" "l"
|
20
20
|
DEFINE_boolean "migrations" "$FLAGS_FALSE" "run development migrations" "M"
|
21
21
|
DEFINE_string "reviewer" "" "who has reviewed the production version" "R"
|
22
|
+
DEFINE_boolean "debug" "${FLAGS_debug:-$FLAGS_FALSE}" "turn on debugging" "D"
|
22
23
|
|
23
24
|
# entry point
|
24
25
|
function main {
|
@@ -105,6 +106,10 @@ function main {
|
|
105
106
|
export GATEWAY="$FLAGS_gateway"
|
106
107
|
fi
|
107
108
|
|
109
|
+
if [[ -n "$FLAGS_debug" ]]; then
|
110
|
+
export FLAGS_debug
|
111
|
+
fi
|
112
|
+
|
108
113
|
if [[ "$FLAGS_proxy" = "$FLAGS_FALSE" || "$FLAGS_direct" = "$FLAGS_TRUE" || -z "$FLAGS_gateway" ]]; then
|
109
114
|
export _AO_DEPLOY=1
|
110
115
|
|
@@ -141,7 +146,6 @@ function main {
|
|
141
146
|
if [[ -n "$FLAGS_reviewer" ]]; then
|
142
147
|
export FLAGS_reviewer
|
143
148
|
fi
|
144
|
-
|
145
149
|
aomain "$nm_pod" "$@"
|
146
150
|
else
|
147
151
|
if [[ "$#" > 0 ]]; then
|
data/libexec/_jason
CHANGED
@@ -136,7 +136,7 @@ function configure_logging {
|
|
136
136
|
}
|
137
137
|
|
138
138
|
function ryaml {
|
139
|
-
ruby -ryaml -e 'def ps x; unless x.nil?; puts x; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@" 2>&-
|
139
|
+
ruby -ryaml -e 'def ps x; unless x.nil?; puts (x.class == String || x.class == Fixnum) ? x : x.to_yaml; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[acc.class == Array ? key.to_i : key] }' "$@" 2>&-
|
140
140
|
}
|
141
141
|
|
142
142
|
function random_str {
|
data/libexec/_log4sh
CHANGED
data/libexec/aoh-debug
CHANGED
data/libexec/aoh-init
CHANGED
@@ -39,7 +39,7 @@ EOF
|
|
39
39
|
chmod 755 "libexec/aohelper"
|
40
40
|
|
41
41
|
for nm_cmd in activate check compare debug deploy dna hosts lock migrate proxy release restart rollback shell stage unlock; do
|
42
|
-
ln -nfs "../libexec/aohelper"
|
42
|
+
ln -nfs "../libexec/aohelper" bin/$nm_cmd
|
43
43
|
done
|
44
44
|
else
|
45
45
|
if [[ "$#" < 1 ]]; then
|
@@ -58,7 +58,7 @@ require 'alpha_omega/deploy'
|
|
58
58
|
namespace :${nm_app} do
|
59
59
|
namespace :bundle do
|
60
60
|
task :ruby do
|
61
|
-
run "PATH=${dollar}PATH:/usr/local/rvm/bin:${dollar}HOME/.rvm/bin; { cd #{deploy_release} && #{ruby_loader} bundle check 2>&1 >/dev/null; } || #{ruby_loader} bundle
|
61
|
+
run "PATH=${dollar}PATH:/usr/local/rvm/bin:${dollar}HOME/.rvm/bin; { cd #{deploy_release} && #{ruby_loader} bundle check 2>&1 >/dev/null; } || #{ruby_loader} bundle --local --path vendor/bundle >/dev/null"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
data/libexec/aoh-proxy
CHANGED
@@ -48,9 +48,18 @@ function main {
|
|
48
48
|
local nm_ruby="$(ryaml $_AO_HOME/config/deploy.yml app_ruby)"
|
49
49
|
|
50
50
|
local tmp_remote="$(ssh $hst_gateway mktemp -t XXXXXXXXX)"
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
local bash_runner
|
52
|
+
if [[ "${FLAGS_debug:-}" = 0 ]]; then
|
53
|
+
set -x
|
54
|
+
bash_runner="bash $tmp_remote --debug"
|
55
|
+
else
|
56
|
+
bash_runner="bash $tmp_remote"
|
57
|
+
fi
|
58
|
+
scp -q $shome/libexec/remote-helper $hst_gateway:$tmp_remote
|
59
|
+
ssh -t $hst_gateway $bash_runner "${pth_rvmrun:-x}" "${nm_ruby:-x}" "$USER" "$git_url" "$git_spec" "$@"
|
60
|
+
if [[ "${FLAGS_debug:-}" = 1 ]]; then
|
61
|
+
ssh $hst_gateway rm -f $tmp_remote
|
62
|
+
fi
|
54
63
|
}
|
55
64
|
|
56
65
|
require sub "$BASH_SOURCE" "$@"
|
data/{sbin → libexec}/aoh-stub
RENAMED
File without changes
|
data/libexec/aohelper
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
1
3
|
function ryaml {
|
2
4
|
ruby -ryaml -e 'def ps x; unless x.nil?; puts (x.class == String || x.class == Fixnum) ? x : x.to_yaml; end; end; ps ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[acc.class == Array ? key.to_i : key] }' "$@" 2>&-
|
3
5
|
}
|
@@ -9,6 +11,7 @@ ruby_loader="$(ryaml $shome/config/deploy.yml ruby_loader)"
|
|
9
11
|
PATH="$PATH:/usr/local/rvm/bin:$HOME/.rvm/bin"
|
10
12
|
|
11
13
|
if ! $ruby_loader $app_ruby bundle check 2>&- > /dev/null; then
|
12
|
-
|
14
|
+
echo "Bundling gems" 1>&2 # TODO use logger stderr
|
15
|
+
$ruby_loader $app_ruby bundle install --local --quiet --path vendor/bundle
|
13
16
|
fi
|
14
17
|
$ruby_loader $app_ruby bundle exec ao "${BASH_SOURCE##*/}" "$@"
|
data/libexec/edit
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ edit-gem -- set environment to hint to Gemfile to use a local gemspec
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ edit gem <name> [location]
|
8
|
+
#/ edit gem -r <names>
|
9
|
+
#/ edit gem -R
|
10
|
+
|
11
|
+
# figure out the project root under which bin, lib live
|
12
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
13
|
+
|
14
|
+
# load a jason bourne library
|
15
|
+
source "$shome/libexec/_treadstone"
|
16
|
+
|
17
|
+
# define command line options:
|
18
|
+
DEFINE_boolean "update" "$FLAGS_FALSE" "finish editing a local gem and updates project" "u"
|
19
|
+
DEFINE_boolean "reset" "$FLAGS_FALSE" "reset gem to remote" "r"
|
20
|
+
DEFINE_boolean "resetall" "$FLAGS_FALSE" "reset all gems to remote" "R"
|
21
|
+
|
22
|
+
# entry point
|
23
|
+
function main {
|
24
|
+
if [[ "$FLAGS_resetall" = "$FLAGS_TRUE" ]]; then
|
25
|
+
set +f
|
26
|
+
rm -f $shome/.local/*
|
27
|
+
set -f
|
28
|
+
bundle --local --quiet && bundle check > /dev/null
|
29
|
+
git diff --no-ext-diff Gemfile.lock vendor/cache
|
30
|
+
elif [[ "$FLAGS_reset" = "$FLAGS_TRUE" ]]; then
|
31
|
+
local nm_gem
|
32
|
+
for nm_gem in "$@"; do
|
33
|
+
rm -f "$shome/.local/$nm_gem"
|
34
|
+
done
|
35
|
+
|
36
|
+
bundle --local --quiet && bundle check > /dev/null
|
37
|
+
|
38
|
+
git diff --no-ext-diff Gemfile.lock vendor/cache
|
39
|
+
elif [[ "$FLAGS_update" = "$FLAGS_TRUE" ]]; then
|
40
|
+
local nm_gem
|
41
|
+
for nm_gem in "$@"; do
|
42
|
+
echo -n > "$shome/.local/$nm_gem"
|
43
|
+
done
|
44
|
+
|
45
|
+
bundle update "$@"
|
46
|
+
|
47
|
+
for nm_gem in "$@"; do
|
48
|
+
rm -f "$shome/.local/$nm_gem"
|
49
|
+
done
|
50
|
+
bundle --local --quiet && bundle check > /dev/null
|
51
|
+
|
52
|
+
git add Gemfile.lock vendor/cache
|
53
|
+
git add -u vendor/cache
|
54
|
+
git diff --no-ext-diff --cached Gemfile.lock vendor/cache
|
55
|
+
else
|
56
|
+
local nm_gem="$1"; shift
|
57
|
+
|
58
|
+
local pth_gem
|
59
|
+
if [[ "$#" = 0 ]]; then
|
60
|
+
pth_gem="gems/$nm_gem"
|
61
|
+
else
|
62
|
+
pth_gem="$1"; shift
|
63
|
+
fi
|
64
|
+
|
65
|
+
if [[ ! -d "$pth_gem" ]]; then
|
66
|
+
logger_fatal "cannot find local gem directoy at $pth_gem"
|
67
|
+
exit 1
|
68
|
+
fi
|
69
|
+
|
70
|
+
pth_gem="$(cd -P -- "$pth_gem" && pwd -P)"
|
71
|
+
|
72
|
+
echo "enabling local gem development on ${nm_gem} at ${pth_gem}"
|
73
|
+
mkdir -p "$shome/.local"
|
74
|
+
echo "$pth_gem" > "$shome/.local/$nm_gem"
|
75
|
+
|
76
|
+
bundle --local --quiet && bundle check > /dev/null
|
77
|
+
git diff --no-ext-diff Gemfile.lock vendor/cache
|
78
|
+
fi
|
79
|
+
}
|
80
|
+
|
81
|
+
require sub "$BASH_SOURCE" "$@"
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ remote-helper -- remotely builds a workarea
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/
|
8
|
+
#/ remote-heper deployer git_url git_spec deploy_comand deploy_args
|
9
|
+
#/
|
10
|
+
|
11
|
+
set -e
|
12
|
+
if [[ "$#" > 0 ]]; then
|
13
|
+
if [[ "$1" = "--debug" ]]; then
|
14
|
+
shift
|
15
|
+
export FLAGS_debug=0
|
16
|
+
set -x
|
17
|
+
fi
|
18
|
+
fi
|
19
|
+
|
20
|
+
# entry point
|
21
|
+
function main {
|
22
|
+
pth_rvmrun=$1; shift
|
23
|
+
nm_ruby=$1; shift
|
24
|
+
nm_deployer=$1; shift
|
25
|
+
git_url=$1; shift
|
26
|
+
git_spec=$1; shift
|
27
|
+
cmd_deploy=$1; shift
|
28
|
+
|
29
|
+
git_branch="${git_spec%%:*}"
|
30
|
+
git_sha="${git_spec##*:}"
|
31
|
+
|
32
|
+
mkdir -p "$HOME/.deploy/$nm_deployer"
|
33
|
+
cd "$HOME/.deploy/$nm_deployer"
|
34
|
+
|
35
|
+
nm_project=$(basename $git_url .git)
|
36
|
+
if [[ ! -d $nm_project ]]; then
|
37
|
+
git clone -q $git_url
|
38
|
+
fi
|
39
|
+
|
40
|
+
cd $nm_project
|
41
|
+
git fetch -q
|
42
|
+
|
43
|
+
if [[ -z $git_branch || $git_branch = $git_sha ]]; then
|
44
|
+
git reset -q --hard $git_sha
|
45
|
+
git checkout -q $git_sha
|
46
|
+
else
|
47
|
+
git checkout -q --force $git_branch
|
48
|
+
git reset -q --hard $git_sha
|
49
|
+
fi
|
50
|
+
|
51
|
+
git submodule -q update --init --recursive
|
52
|
+
|
53
|
+
export _AO_DEPLOYER="$nm_deployer"
|
54
|
+
local ruby_loader=""
|
55
|
+
if [[ "$pth_rvmrun" != "x" ]]; then
|
56
|
+
PATH="$PATH:/usr/local/rvm/bin:$HOME/.rvm/bin"
|
57
|
+
ruby_loader="$pth_rvmrun $nm_ruby"
|
58
|
+
fi
|
59
|
+
$ruby_loader bundle check 2>&1 >/dev/null || { bundle install --quiet --local --path vendor/bundle || bundle check > /dev/null; }
|
60
|
+
$ruby_loader bundle exec ao $cmd_deploy "$@"
|
61
|
+
}
|
62
|
+
|
63
|
+
# pass arguments to entry point
|
64
|
+
main "$@"
|
data/{sbin → libexec}/stub
RENAMED
File without changes
|
data/libexec/stub-prepare
CHANGED
@@ -22,8 +22,9 @@ function main {
|
|
22
22
|
local dollar='$'
|
23
23
|
local nm_command="$1"; shift
|
24
24
|
|
25
|
-
|
26
|
-
cp "$
|
25
|
+
|
26
|
+
cp "$shome/libexec/stub" "$shome/libexec/$nm_command"
|
27
|
+
ln -nfsv $nm_command "$shome/bin/$nm_command"
|
27
28
|
chmod 755 "$shome/libexec/$nm_command"
|
28
29
|
|
29
30
|
logger_info "$nm_command is stubbed at bin/$nm_command"
|
data/sbin/local-helper
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
3
|
#/ NAME
|
4
|
-
#/
|
4
|
+
#/ local-helper -- resets environment for another bundle exec
|
5
5
|
#/
|
6
6
|
#/ SYNOPSIS
|
7
|
-
#/
|
7
|
+
#/
|
8
|
+
#/ local-helper command args ...
|
8
9
|
|
9
10
|
# figure out the project root under which bin, lib live
|
10
11
|
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
@@ -12,4 +13,12 @@ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
|
12
13
|
# load a jason bourne library
|
13
14
|
source "$shome/libexec/_treadstone"
|
14
15
|
|
15
|
-
|
16
|
+
# entry point
|
17
|
+
function main {
|
18
|
+
unset GEM_HOME BUNDLE_GEMFILE RUBYOPT
|
19
|
+
|
20
|
+
bundle check 2>&1 >/dev/null || { bundle install --quiet --local --path vendor/bundle || bundle check > /dev/null; }
|
21
|
+
exec bundle exec "$@"
|
22
|
+
}
|
23
|
+
|
24
|
+
require sub "$BASH_SOURCE" "$@"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alpha_omega
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Nghiem
|
@@ -132,16 +132,20 @@ files:
|
|
132
132
|
- libexec/aoh-rollback
|
133
133
|
- libexec/aoh-shell
|
134
134
|
- libexec/aoh-stage
|
135
|
+
- libexec/aoh-stub
|
135
136
|
- libexec/aoh-task
|
136
137
|
- libexec/aoh-unlock
|
137
138
|
- libexec/aohelper
|
138
139
|
- libexec/build
|
139
140
|
- libexec/build-gem
|
140
141
|
- libexec/bump
|
142
|
+
- libexec/edit
|
141
143
|
- libexec/edit-gem
|
142
144
|
- libexec/local-helper
|
143
145
|
- libexec/publish
|
144
146
|
- libexec/publish-gem
|
147
|
+
- libexec/remote-helper
|
148
|
+
- libexec/stub
|
145
149
|
- libexec/stub-prepare
|
146
150
|
- lib/alpha_omega/config/deploy.rb
|
147
151
|
- lib/alpha_omega/config/deploy_challenge.rb
|
@@ -166,9 +170,6 @@ files:
|
|
166
170
|
- lib/alpha_omega/version.rb
|
167
171
|
- lib/development.rb
|
168
172
|
- sbin/activate
|
169
|
-
- sbin/aoh
|
170
|
-
- sbin/aoh-stub
|
171
|
-
- sbin/bump
|
172
173
|
- sbin/check
|
173
174
|
- sbin/compare
|
174
175
|
- sbin/debug
|
@@ -182,12 +183,10 @@ files:
|
|
182
183
|
- sbin/proxy
|
183
184
|
- sbin/release
|
184
185
|
- sbin/remote
|
185
|
-
- sbin/remote-helper
|
186
186
|
- sbin/restart
|
187
187
|
- sbin/rollback
|
188
188
|
- sbin/shell
|
189
189
|
- sbin/stage
|
190
|
-
- sbin/stub
|
191
190
|
- sbin/task
|
192
191
|
- sbin/unlock
|
193
192
|
- bin/ao
|
data/sbin/aoh
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
#/ NAME
|
4
|
-
#/ stub -- symlink catchall to implement 37signals/sub interface
|
5
|
-
#/
|
6
|
-
#/ SYNOPSIS
|
7
|
-
#/ ln -nfs stub bin/stubbed-command
|
8
|
-
|
9
|
-
# figure out the project root under which bin, lib live
|
10
|
-
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
-
|
12
|
-
# load a jason bourne library
|
13
|
-
source "$shome/libexec/_treadstone"
|
14
|
-
|
15
|
-
require 'sub' "$BASH_SOURCE" "$@"
|
data/sbin/bump
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
#/ NAME
|
4
|
-
#/ stub -- symlink catchall to implement 37signals/sub interface
|
5
|
-
#/
|
6
|
-
#/ SYNOPSIS
|
7
|
-
#/ ln -nfs stub bin/stubbed-command
|
8
|
-
|
9
|
-
# figure out the project root under which bin, lib live
|
10
|
-
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
-
|
12
|
-
# load a jason bourne library
|
13
|
-
source "$shome/libexec/_treadstone"
|
14
|
-
|
15
|
-
require 'sub' "$BASH_SOURCE" "$@"
|
data/sbin/remote-helper
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
#/ NAME
|
4
|
-
#/ remote-helper -- remotely builds a workarea
|
5
|
-
#/
|
6
|
-
#/ SYNOPSIS
|
7
|
-
#/
|
8
|
-
#/ remote-heper deployer git_url git_spec deploy_comand deploy_args
|
9
|
-
#/
|
10
|
-
|
11
|
-
set -e
|
12
|
-
|
13
|
-
# figure out the project root under which bin, lib live
|
14
|
-
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
15
|
-
|
16
|
-
fl_debug=
|
17
|
-
|
18
|
-
function crumb {
|
19
|
-
if [[ -n "$fl_debug" ]]; then
|
20
|
-
echo "$(date) $@" 1>&2
|
21
|
-
fi
|
22
|
-
}
|
23
|
-
|
24
|
-
# entry point
|
25
|
-
function main {
|
26
|
-
nm_deployer=$1; shift
|
27
|
-
git_url=$1; shift
|
28
|
-
git_spec=$1; shift
|
29
|
-
cmd_deploy=$1; shift
|
30
|
-
|
31
|
-
if [[ "$cmd_deploy" = "debug" ]]; then
|
32
|
-
fl_debug=1
|
33
|
-
fi
|
34
|
-
|
35
|
-
crumb "start remote-helper with args: $nm_deployer, $git_url, $git_spec, $cmd_deploy"
|
36
|
-
crumb "additional args: $@"
|
37
|
-
|
38
|
-
git_branch="${git_spec%%:*}"
|
39
|
-
git_sha="${git_spec##*:}"
|
40
|
-
|
41
|
-
crumb "derive: git_branch = $git_branch"
|
42
|
-
crumb "derive: git_sha = $git_sha"
|
43
|
-
|
44
|
-
mkdir -p "$HOME/.deploy/$nm_deployer"
|
45
|
-
cd "$HOME/.deploy/$nm_deployer"
|
46
|
-
|
47
|
-
nm_project=$(basename $git_url .git)
|
48
|
-
if [[ ! -d $nm_project ]]; then
|
49
|
-
crumb "git clone $git_url"
|
50
|
-
git clone -q $git_url
|
51
|
-
fi
|
52
|
-
crumb "remote deploy on ${LOGNAME}@$(hostname) in $HOME/.deploy/$nm_deployer/$nm_project/"
|
53
|
-
|
54
|
-
cd $nm_project
|
55
|
-
git fetch -q
|
56
|
-
|
57
|
-
if [[ -z $git_branch || $git_branch = $git_sha ]]; then
|
58
|
-
crumb "git reset, checkout of $git_sha"
|
59
|
-
git reset -q --hard $git_sha
|
60
|
-
git checkout -q $git_sha
|
61
|
-
else
|
62
|
-
crumb "git checkout of $git_branch, reset of $git_sha"
|
63
|
-
git checkout -q --force $git_branch
|
64
|
-
git reset -q --hard $git_sha
|
65
|
-
fi
|
66
|
-
|
67
|
-
crumb "git submodule"
|
68
|
-
git submodule -q update --init --recursive
|
69
|
-
|
70
|
-
crumb "executing ao $cmd_deploy $@"
|
71
|
-
export _AO_DEPLOYER="$nm_deployer"
|
72
|
-
bundle check 2>&1 >/dev/null || { bundle install --quiet --local --path vendor/bundle || bundle check > /dev/null; }
|
73
|
-
bundle exec ao $cmd_deploy "$@"
|
74
|
-
crumb "end remote-helper"
|
75
|
-
}
|
76
|
-
|
77
|
-
# setup
|
78
|
-
unset cd # disable rvm's cd function to prevent prompts
|
79
|
-
|
80
|
-
# pass arguments to entry point
|
81
|
-
main "$@"
|