alpha_omega 1.3.48 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.48
1
+ 1.4.0
@@ -4,20 +4,14 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
4
4
  namespace :deploy do
5
5
  task :challenge do
6
6
  if dna["app_env"] == "production"
7
- unless ENV['FLAGS_tag'] && !(ENV['FLAGS_tag'].empty? || ENV['FLAGS_tag'] == "HEAD")
8
- puts "Did not specify a tag for production via -t vX.Y.Z"
7
+ who = Capistrano::CLI.ui.ask(" -- Who has reviewed this deploy to #{dna["app_env"]}? ")
8
+ if who.empty?
9
9
  abort
10
+ else
11
+ set :reviewed, who
12
+ sleep 3
10
13
  end
11
-
12
- unless ENV['FLAGS_reviewer'] && active_path_name == current_path_name
13
- a, b = rand(10), rand(10)
14
- if Capistrano::CLI.ui.ask(" -- WARNING: Accessing production, please think: #{a} + #{b} = ").downcase.strip.to_i != (a + b)
15
- abort
16
- else
17
- sleep(3)
18
- end
19
- end
20
- end
14
+ end if reviewed.nil?
21
15
  end
22
16
  end
23
17
 
@@ -12,6 +12,15 @@ 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
15
24
  end
16
25
  end
17
26
  end
@@ -1,21 +1,22 @@
1
- require 'tempfile'
2
-
3
1
  Capistrano::Configuration.instance(:must_exist).load do |config|
4
2
  namespace :deploy do
5
3
  namespace :notify do
6
4
  task :default do
7
5
  if $deploy["notify"]
8
- unless skip_notifications
6
+ unless dna["app_env"] == "development" || dna["env_pod"] == "dev"
9
7
  airbrake if $deploy["notify"].member? "airbrake"
10
8
  newrelic if $deploy["notify"].member? "newrelic"
9
+ email if $deploy["notify"].member? "email"
11
10
  campfire if $deploy["notify"].member? "campfire"
12
11
  flowdock if $deploy["notify"].member? "flowdock"
13
12
  end
14
-
15
- email if $deploy["notify"].member? "email"
16
13
  end
17
14
  end
18
15
 
16
+ task :email do
17
+ run_locally "echo '#{notify_message}' | mail -s '#{notify_message}' #{$deploy["notify"]["email"]["recipients"].join(" ")}"
18
+ end
19
+
19
20
  task :campfire do
20
21
  require 'capistrano/campfire'
21
22
 
@@ -37,16 +38,16 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
37
38
  require 'airbrake'
38
39
  require 'airbrake_tasks'
39
40
 
40
- Airbrake.configure do |abconfig|
41
- abconfig.api_key = $deploy["notify"]["airbrake"]["api_key"]
41
+ Airbrake.configure do |config|
42
+ config.api_key = $deploy["notify"]["airbrake"]["api_key"]
42
43
  end
43
44
 
44
45
  begin
45
46
  AirbrakeTasks.deploy({
46
47
  :rails_env => dna['app_env'],
47
- :scm_revision => "#{real_revision} #{revision}",
48
+ :scm_revision => current_revision,
48
49
  :scm_repository => repository,
49
- :local_username => ENV['_AO_DEPLOYER']
50
+ :local_username => ENV['_AO_USER']
50
51
  })
51
52
  rescue EOFError
52
53
  $stderr.puts "An error occurred during the Airtoad deploy notification."
@@ -74,33 +75,8 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
74
75
  require 'new_relic/recipes'
75
76
  end
76
77
 
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
-
94
78
  def notify_message
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
100
- end
101
-
102
- def notify_message_abbr
103
- "#{ENV['_AO_DEPLOYER']} deployed #{application} to #{ENV['_AO_ARGS']} (#{dna['app_env']}): #{ENV['FLAGS_tag']}"
79
+ "#{ENV['_AO_USER']} deployed #{application} (#{current_revision}@#{repository}) to #{dna['app_env']}"
104
80
  end
105
81
  end
106
82
  end
@@ -5,19 +5,13 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
5
5
  order = []
6
6
 
7
7
  on :before do
8
- unless skip_performance
9
- order << [:start, current_task]
10
- start_times[current_task] = Time.now
11
- end
8
+ order << [:start, current_task]
9
+ start_times[current_task] = Time.now
12
10
  end
13
11
 
14
12
  on :after do
15
- unless skip_performance
16
- unless skip_performance_task == current_task
17
- order << [:end, current_task]
18
- end_times[current_task] = Time.now
19
- end
20
- end
13
+ order << [:end, current_task]
14
+ end_times[current_task] = Time.now
21
15
  end
22
16
 
23
17
  config.on :exit do
@@ -34,7 +28,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
34
28
  l " Performance Report"
35
29
  l "=========================================================="
36
30
 
37
- indent = 1
31
+ indent = 0
38
32
  (order + [nil]).each_cons(2) do |payload1, payload2|
39
33
  action, task = payload1
40
34
  if action == :start
@@ -42,22 +36,9 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
42
36
  indent += 1
43
37
  else
44
38
  indent -= 1
45
- if end_times[task] && start_times[task]
46
- l "#{".." * indent}#{task.fully_qualified_name} #{(end_times[task] - start_times[task]).to_i}s"
47
- end
39
+ l "#{".." * indent}#{task.fully_qualified_name} #{(end_times[task] - start_times[task]).to_i}s"
48
40
  end
49
41
  end
50
42
  l "=========================================================="
51
43
  end
52
-
53
- namespace :deploy do
54
- namespace :enable do
55
- task :performance do
56
- set :skip_performance, false
57
- set :skip_performance_task, current_task
58
- end
59
- end
60
- end
61
-
62
- before "deploy:began", "deploy:enable:performance"
63
44
  end
@@ -34,13 +34,10 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
34
34
  # =========================================================================
35
35
 
36
36
  _cset :skip_scm, false
37
- _cset :skip_notifications, false
38
- _cset :skip_performance, true
39
- _cset :skip_performance_task, ""
40
37
  _cset :scm, :git
41
38
  _cset :deploy_via, :checkout
42
39
  _cset(:branch) { AlphaOmega.what_branch }
43
- _cset(:revision) { ENV['FLAGS_tag'] || source.head }
40
+ _cset(:revision) { source.head }
44
41
 
45
42
  _cset :default_shell, "/bin/bash"
46
43
  _cset(:deploy_to) { "/data/#{application}" }
@@ -56,12 +53,8 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
56
53
  _cset(:run_method) { fetch(:use_sudo, true) ? :sudo : :run }
57
54
 
58
55
  _cset :last_pod, nil
59
- _cset :success, false
60
56
 
61
- _cset (:figlet) {
62
- fig = [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first
63
- fig ? "#{fig} -w 200" : "echo"
64
- }
57
+ _cset (:figlet) { [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first || echo }
65
58
 
66
59
  # =========================================================================
67
60
  # services, logs
@@ -134,7 +127,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
134
127
  unless releases.empty?
135
128
  w = current_workarea
136
129
  workarea = releases[((releases.index(w)?releases.index(w):-1)+1)%releases.length]
137
- system "#{figlet} on #{workarea}"
130
+ system "#{figlet} -w 200 on #{workarea}"
138
131
  workarea
139
132
  else
140
133
  ""
@@ -164,9 +157,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
164
157
 
165
158
  _cset(:rollback_revision) { capture("cat #{rollback_release}/REVISION 2>&- || true").strip }
166
159
  _cset(:previous_revision) { capture("cat #{previous_release}/REVISION 2>&- || true").strip }
167
- _cset(:cmp_previous_revision) { capture("cat #{previous_path}/REVISION 2>&- || true").strip }
168
160
  _cset(:current_revision) { capture("cat #{current_release}/REVISION 2>&- || true").strip }
169
- _cset(:cmp_current_revision) { capture("cat #{current_path}/REVISION 2>&- || true").strip }
170
161
  _cset(:next_revision) { capture("cat #{next_release}/REVISION 2>&- || true").strip }
171
162
  _cset(:active_revision) { capture("cat #{active_release}/REVISION 2>&- || true").strip }
172
163
  _cset(:compare_revision) { capture("cat #{compare_release}/REVISION 2>&- || true").strip }
@@ -314,10 +305,12 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
314
305
  task (if you want to perform the `restart' task separately).
315
306
  DESC
316
307
  task :update_code do
317
- scm
308
+ strategy.deploy! unless skip_scm
318
309
  bundle
319
- build
320
- dist
310
+ unless deploy_path_name == migrate_path_name
311
+ build
312
+ dist
313
+ end
321
314
  end
322
315
 
323
316
  task :symlink_next do
@@ -363,7 +356,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
363
356
  run "mv -T #{previous_path}.new #{previous_path}"
364
357
  end
365
358
 
366
- system "#{figlet} #{current_release_name} activated"
359
+ system "#{figlet} -w 200 #{current_release_name} activated"
367
360
  end
368
361
  end
369
362
 
@@ -411,9 +404,6 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
411
404
  task :dist do
412
405
  end
413
406
 
414
- task :scm do
415
- strategy.deploy! unless skip_scm
416
- end
417
407
 
418
408
  desc <<-DESC
419
409
  Checkpoint for various language bundlers
@@ -440,12 +430,12 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
440
430
  DESC
441
431
  task :revision do
442
432
  if previous_release
443
- system "#{figlet} on #{previous_release_name}"
433
+ system "#{figlet} -w 200 on #{previous_release_name}"
444
434
  run "rm -f #{previous_path} #{next_path}"
445
435
  run "ln -nfs #{previous_release} #{current_path}.new"
446
436
  run "mv -T #{current_path}.new #{current_path}"
447
437
  else
448
- system "#{figlet} failed to rollback"
438
+ system "#{figlet} -w 200 failed to rollback"
449
439
  abort "could not rollback the code because there is no prior release"
450
440
  end
451
441
  end
@@ -589,10 +579,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
589
579
  end
590
580
 
591
581
  if want_unlock
592
- at_exit {
593
- self.unlock;
594
- self.successful;
595
- }
582
+ at_exit { self.unlock; }
596
583
  end
597
584
 
598
585
  run "echo #{epoch} #{ENV['_AO_DEPLOYER']} > #{lock_path}"
@@ -628,17 +615,9 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
628
615
  end
629
616
  end
630
617
 
631
- task :successful do
632
- if success
633
- system "#{figlet} success"
634
- else
635
- system "#{figlet} failed"
636
- end
637
- end
638
-
639
618
  task :finished do
640
- set :success, true
641
619
  end
620
+
642
621
  end # :deploy
643
622
  end # Capistrano::Configuration
644
623
 
@@ -77,7 +77,6 @@ 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"
81
80
 
82
81
  execute
83
82
  end
data/libexec/_ao CHANGED
@@ -1,5 +1,8 @@
1
1
  #!/bin/bash
2
2
 
3
+ # first time, this will be empty, to trigger enforce_rvm
4
+ : ${_AO_RVM:=}
5
+
3
6
  export _AO_OPT="$@"
4
7
 
5
8
  function deploy_basename {
@@ -7,6 +10,31 @@ function deploy_basename {
7
10
  echo "${cmd#aoh-}"
8
11
  }
9
12
 
13
+ # ensure script runs under rvm
14
+ function enforce_rvm {
15
+ if [[ -n "$_AO_RVM" ]]; then
16
+ return
17
+ fi
18
+
19
+ export _AO_RVM=1
20
+
21
+ local pth_ruby_loader="${_AO_RUBY_LOADER:-}"
22
+ : ${pth_ruby_loader:=$(ryaml $_AO_HOME/config/deploy.yml ruby_loader)}
23
+ local ruby_deploy="$(ryaml $_AO_HOME/config/deploy.yml app_ruby)"
24
+
25
+ if [[ -z $pth_ruby_loader || -z $ruby_deploy ]]; then
26
+ return
27
+ fi
28
+
29
+ if [[ ! -x $pth_ruby_loader ]]; then
30
+ return
31
+ fi
32
+
33
+ exec $pth_ruby_loader $ruby_deploy "$0" "$@"
34
+ }
35
+
36
+ enforce_rvm "$@"
37
+
10
38
  # define command line options:
11
39
  # var name, default, description, short option
12
40
  DEFINE_string "gateway" "" "deploy gateway host" "G"
@@ -17,8 +45,6 @@ DEFINE_string "tag" "HEAD" "tag to deploy in production" "t"
17
45
  DEFINE_string "user" "" "app user override" "u"
18
46
  DEFINE_string "group" "" "app group override" "g"
19
47
  DEFINE_string "ssh_login" "" "ssh login override" "l"
20
- DEFINE_boolean "migrations" "$FLAGS_FALSE" "run development migrations" "M"
21
- DEFINE_string "reviewer" "" "who has reviewed the production version" "R"
22
48
 
23
49
  # entry point
24
50
  function main {
@@ -29,37 +55,37 @@ function main {
29
55
  exit 1
30
56
  fi
31
57
 
32
- local nm_pod="$1" # will shift later since this could be an integration environment
58
+ local nm_component="$1" # will shift later since this could be an integration environment
33
59
  if [[ "$#" = 1 ]]; then
34
60
  local deploy_base="$(ryaml $_AO_HOME/config/deploy.yml deploy_base)"
35
61
  if [[ -n "$deploy_base" ]]; then
36
- local pod_shortcut="$(ryaml $HOME/.getting-started/config/pods.yml pods ${deploy_base}${nm_pod} pod)"
62
+ local pod_shortcut="$(ryaml $HOME/.getting-started/config/pods.yml pods ${deploy_base}${nm_component} pod)"
37
63
  if [[ -n "$pod_shortcut" ]]; then
38
- nm_pod="${deploy_base}${nm_pod}"
39
- set -- "$nm_pod"
64
+ nm_component="${deploy_base}${nm_component}"
65
+ set -- "$nm_component"
40
66
  fi
41
67
  unset pod_shortcut
42
68
  fi
43
69
  fi
44
70
 
45
71
  if [[ -r "$HOME/.getting-started/config/pods.yml" ]]; then
46
- local pod_shortcut="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod pod)"
72
+ local pod_shortcut="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component pod)"
47
73
  if [[ -n "$pod_shortcut" ]]; then
48
- nm_pod="$pod_shortcut"
74
+ nm_component="$pod_shortcut"
49
75
  else
50
76
  shift # treat as a pod name
51
77
  fi
52
78
 
53
- local pod_alias="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod alias)"
79
+ local pod_alias="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component alias)"
54
80
  if [[ -n "$pod_alias" ]]; then
55
- nm_pod="$pod_alias"
81
+ nm_component="$pod_alias"
56
82
  fi
57
83
 
58
- local is_local="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod local)"
59
- local hst_gateway="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod gateway)"
84
+ local is_local="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component local)"
85
+ local hst_gateway="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component gateway)"
60
86
  if [[ -z "$is_local" ]]; then
61
87
  if [[ -z "$hst_gateway" ]]; then
62
- logger_fatal "$nm_pod is not a pod name"
88
+ logger_fatal "$nm_component is not a pod name"
63
89
  exit 1
64
90
  fi
65
91
  FLAGS_proxy="$FLAGS_TRUE"
@@ -67,10 +93,10 @@ function main {
67
93
  if [[ -z "$FLAGS_chef" ]]; then
68
94
  FLAGS_chef="$HOME/.getting-started"
69
95
  fi
70
- export _AO_ENV="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod ao_env)"
96
+ export _AO_ENV="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component ao_env)"
71
97
  export RAILS_ENV="$_AO_ENV"
72
98
  if [[ -z "$_AO_ENV" ]]; then
73
- _AO_ENV="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod env)"
99
+ _AO_ENV="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component env)"
74
100
  fi
75
101
  export _AO_SSH="$HOME/.getting-started/ssh/config"
76
102
  fi
@@ -78,8 +104,6 @@ function main {
78
104
  if [[ -z "$FLAGS_gateway" ]]; then
79
105
  FLAGS_gateway="$hst_gateway"
80
106
  fi
81
- else
82
- shift # not proxied, so expect full names here
83
107
  fi
84
108
 
85
109
  if [[ -n "$FLAGS_user" ]]; then
@@ -105,77 +129,59 @@ function main {
105
129
  export GATEWAY="$FLAGS_gateway"
106
130
  fi
107
131
 
108
- if [[ "$FLAGS_proxy" = "$FLAGS_FALSE" || "$FLAGS_direct" = "$FLAGS_TRUE" || -z "$FLAGS_gateway" ]]; then
109
- export _AO_DEPLOY=1
110
-
111
- local _AO_THIS_HOST="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod this_host)"
112
- if [[ -n "$_AO_THIS_HOST" ]]; then
113
- export _AO_THIS_HOST
114
- fi
115
-
116
- local _AO_THIS_POD="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_pod this_pod)"
117
- if [[ -n "$_AO_THIS_POD" ]]; then
118
- export _AO_THIS_POD
119
- fi
120
-
121
- bundle check 2>&1 >/dev/null || { bundle install --quiet --local --path vendor/bundle || bundle check > /dev/null; }
122
-
123
- if [[ "$nm_pod" = "pod1" ]]; then
124
- nm_pod="sys"
125
- fi
126
-
127
- if [[ "$nm_pod" = "sys" && "$#" > 0 ]]; then
128
- if [[ "${1%.*}" = "production" ]]; then
129
- set -- "admin" "$@"
132
+ case "$nm_component" in
133
+ *)
134
+
135
+ if [[ "$FLAGS_proxy" = "$FLAGS_FALSE" || "$FLAGS_direct" = "$FLAGS_TRUE" || -z "$FLAGS_gateway" ]]; then
136
+ export _AO_DEPLOY=1
137
+
138
+ local _AO_THIS_HOST="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component this_host)"
139
+ if [[ -n "$_AO_THIS_HOST" ]]; then
140
+ export _AO_THIS_HOST
141
+ fi
142
+
143
+ local _AO_THIS_POD="$(ryaml $HOME/.getting-started/config/pods.yml pods $nm_component this_pod)"
144
+ if [[ -n "$_AO_THIS_POD" ]]; then
145
+ export _AO_THIS_POD
146
+ fi
147
+
148
+ bundle check 2>&1 >/dev/null || { bundle install --quiet --local --path vendor/bundle || bundle check > /dev/null; }
149
+ aomain "$nm_component" "$@"
150
+ else
151
+ if [[ "$#" > 0 ]]; then
152
+ case "$1" in
153
+ all|world)
154
+ logger_fatal "cannot use all or world, these are dangerous"
155
+ exit 1
156
+ ;;
157
+ production)
158
+ if [[ -z "$FLAGS_tag" || "$FLAGS_tag" = "HEAD" ]]; then
159
+ case "$(deploy_basename $0)" in
160
+ hosts|debug)
161
+ true
162
+ ;;
163
+ *)
164
+ logger_fatal "must specify a version using --tag"
165
+ exit 1
166
+ ;;
167
+ esac
168
+ fi
169
+ ;;
170
+ esac
171
+ fi
172
+
173
+ local gateway="$FLAGS_gateway"
174
+ if [[ -n "$FLAGS_ssh_login" ]]; then
175
+ gateway="${FLAGS_ssh_login}@${gateway}"
176
+ fi
177
+
178
+ local remote_chef=""
179
+ if [[ -n "$FLAGS_chef" ]]; then
180
+ remote_chef="-c $FLAGS_chef "
181
+ fi
182
+
183
+ $shome/sbin/proxy "$gateway" "$FLAGS_tag" $(deploy_basename $0) ${remote_chef}"$nm_component" "$@"
130
184
  fi
131
- fi
132
-
133
- if [[ "$FLAGS_migrations" = "$FLAGS_TRUE" ]]; then
134
- export FLAGS_migrations
135
- fi
136
-
137
- if [[ -n "$FLAGS_tag" ]]; then
138
- export FLAGS_tag
139
- fi
140
-
141
- if [[ -n "$FLAGS_reviewer" ]]; then
142
- export FLAGS_reviewer
143
- fi
144
-
145
- aomain "$nm_pod" "$@"
146
- else
147
- if [[ "$#" > 0 ]]; then
148
- case "$1" in
149
- all|world)
150
- logger_fatal "cannot use all or world, these are dangerous"
151
- exit 1
152
- ;;
153
- production)
154
- if [[ -z "$FLAGS_tag" || "$FLAGS_tag" = "HEAD" ]]; then
155
- case "$(deploy_basename $0)" in
156
- hosts|debug|dna)
157
- true
158
- ;;
159
- *)
160
- logger_fatal "must specify a version using --tag|-t"
161
- exit 1
162
- ;;
163
- esac
164
- fi
165
- ;;
166
- esac
167
- fi
168
-
169
- local gateway="$FLAGS_gateway"
170
- if [[ -n "$FLAGS_ssh_login" ]]; then
171
- gateway="${FLAGS_ssh_login}@${gateway}"
172
- fi
173
-
174
- local remote_chef=""
175
- if [[ -n "$FLAGS_chef" ]]; then
176
- remote_chef="-c $FLAGS_chef "
177
- fi
178
-
179
- $shome/sbin/proxy "$gateway" "$FLAGS_tag" $(deploy_basename $0) ${remote_chef}"$nm_pod" "$@"
180
- fi
185
+ ;;
186
+ esac
181
187
  }
data/libexec/_sub CHANGED
@@ -14,7 +14,6 @@ function sub {
14
14
 
15
15
  if [[ "$bsource_cmd" = "$bsource" ]]; then
16
16
  FLAGS_SUB="$FLAGS_TRUE"
17
- export _SUB_ARGS="$@"
18
17
  parse_command_line "$@" || exit $?
19
18
  eval set -- "${FLAGS_ARGV}"
20
19
  fi
data/libexec/aoh-activate CHANGED
@@ -16,7 +16,7 @@ require 'ao'
16
16
 
17
17
  function aomain {
18
18
  set -- $(for a in "$@"; do echo $a.app; done)
19
- cap "$@" deploy:began deploy:lock deploy:symlink deploy:restart deploy:finished
19
+ bundle exec cap "$@" deploy:began deploy:lock deploy:symlink deploy:restart deploy:finished
20
20
  }
21
21
 
22
22
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-check CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock deploy:check deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock deploy:check deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-compare CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock_compare deploy:compare deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock_compare deploy:compare deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-debug CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
  function aomain {
18
18
  export LOCAL_ONLY=true
19
19
  set -- $(for a in "$@"; do echo $a.echo; done)
20
- cap "$@"
20
+ bundle exec cap "$@" deploy:began deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-deploy CHANGED
@@ -16,7 +16,7 @@ require 'ao'
16
16
 
17
17
  function aomain {
18
18
  set -- $(for a in "$@"; do echo $a.app; done)
19
- cap "$@" deploy:began deploy:lock deploy deploy:finished
19
+ bundle exec cap "$@" deploy:began deploy:lock deploy deploy:finished
20
20
  }
21
21
 
22
22
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-dist CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock deploy:dist deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock deploy:dist deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-dna CHANGED
@@ -20,7 +20,7 @@ function aomain {
20
20
  {
21
21
  set -- $(for a in "$@"; do echo $a.yaml; done)
22
22
  echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
23
- cap "$@"
23
+ bundle exec cap "$@" deploy:began deploy:finished
24
24
  } 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
25
25
  }
26
26
 
data/libexec/aoh-hosts CHANGED
@@ -18,7 +18,7 @@ require 'ao'
18
18
  function aomain {
19
19
  export LOCAL_ONLY=true
20
20
  set -- $(for a in "$@"; do echo $a.echo; done)
21
- cap "$@" 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u 2>&1
21
+ bundle exec cap "$@" deploy:began deploy:finished 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u 2>&1
22
22
  }
23
23
 
24
24
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-init CHANGED
@@ -13,43 +13,16 @@ shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
13
13
  # load a jason bourne library
14
14
  source "$shome/libexec/_treadstone"
15
15
 
16
- DEFINE_boolean "helpers" "$FLAGS_FALSE" "Generate the bin and libexec helpers" "H"
17
-
18
16
  function main {
19
- local dollar='$'
20
-
21
- if [[ "$FLAGS_helpers" = "$FLAGS_TRUE" ]]; then
22
- mkdir -p "libexec"
23
- cat > "libexec/aohelper" <<EOF
24
- function ryaml {
25
- 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] }' "${dollar}@" 2>&-
26
- }
27
-
28
- shome="${dollar}(cd -P -- "${dollar}(dirname -- "${dollar}BASH_SOURCE")/.." && pwd -P)"
29
-
30
- app_ruby="${dollar}(ryaml ${dollar}shome/config/deploy.yml app_ruby)"
31
- ruby_loader="${dollar}(ryaml ${dollar}shome/config/deploy.yml ruby_loader)"
32
- PATH="${dollar}PATH:/usr/local/rvm/bin:${dollar}HOME/.rvm/bin"
33
-
34
- if ! ${dollar}ruby_loader ${dollar}app_ruby bundle check 2>&- > /dev/null; then
35
- ${dollar}ruby_loader ${dollar}app_ruby bundle install --local --quiet
36
- fi
37
- ${dollar}ruby_loader ${dollar}app_ruby bundle exec ao "${dollar}{BASH_SOURCE##*/}" "${dollar}@"
38
- EOF
39
- chmod 755 "libexec/aohelper"
40
-
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" bin/$nm_cmd
43
- done
44
- else
45
- if [[ "$#" < 1 ]]; then
46
- logger_fatal "missing application name"
47
- exit 1
48
- fi
17
+ if [[ "$#" < 1 ]]; then
18
+ logger_fatal "missing application name"
19
+ exit 1
20
+ fi
49
21
 
50
- local nm_app="$1"; shift
22
+ local nm_app="$1"; shift
23
+ local dollar='$'
51
24
 
52
- cat > "Capfile" <<EOF
25
+ cat > "Capfile" <<EOF
53
26
  #!/usr/bin/env ruby
54
27
 
55
28
  require 'alpha_omega/deploy'
@@ -58,7 +31,7 @@ require 'alpha_omega/deploy'
58
31
  namespace :${nm_app} do
59
32
  namespace :bundle do
60
33
  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 --local --path vendor/bundle >/dev/null"
34
+ 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 #{bundler_options} >/dev/null"
62
35
  end
63
36
  end
64
37
  end
@@ -78,8 +51,8 @@ Deploy self, __FILE__ do |admin, node|
78
51
  end
79
52
  EOF
80
53
 
81
- mkdir -p "config"
82
- cat > "config/deploy.yml" <<EOF
54
+ mkdir -p "config"
55
+ cat > "config/deploy.yml" <<EOF
83
56
  ---
84
57
  repository: git@github.com:someone/something_something
85
58
  application: ${nm_app}
@@ -90,7 +63,6 @@ app_ruby: ree
90
63
  branches: [ production staging master ]
91
64
  branch_regex: /
92
65
  EOF
93
- fi
94
66
  }
95
67
 
96
68
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-lock CHANGED
@@ -21,11 +21,11 @@ function aomain {
21
21
  compare|migrate)
22
22
  nm_lock="${1}"; shift
23
23
  set -- $(for a in "$@"; do echo $a.app; done)
24
- cap "$@" deploy:began deploy:dont_unlock "deploy:lock_${nm_lock}" deploy:finished
24
+ bundle exec cap "$@" deploy:began deploy:dont_unlock "deploy:lock_${nm_lock}" deploy:finished
25
25
  ;;
26
26
  *)
27
27
  set -- $(for a in "$@"; do echo $a.app; done)
28
- cap "$@" deploy:began deploy:dont_unlock deploy:lock deploy:finished
28
+ bundle exec cap "$@" deploy:began deploy:dont_unlock deploy:lock deploy:finished
29
29
  ;;
30
30
  esac
31
31
  }
data/libexec/aoh-migrate CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock_migrate deploy:migrate deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock_migrate deploy:migrate deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-proxy CHANGED
@@ -40,12 +40,12 @@ function main {
40
40
  local ver_repo="$1"; shift
41
41
 
42
42
  cd $_AO_HOME
43
- local git_url="$(ryaml $_AO_HOME/config/deploy.yml repository)"
43
+ local git_url="$(ruby -ryaml -e 'puts YAML.load(File.read(ARGV[0]))[ARGV[1]]' $_AO_HOME/config/deploy.yml repository)"
44
44
  local git_spec="$(git_branch_head "$ver_repo")"
45
45
 
46
46
  local pth_rvmrun="${_AO_RUBY_LOADER:-}"
47
- : ${pth_rvmrun:=$(ryaml $_AO_HOME/config/deploy.yml ruby_loader)}
48
- local nm_ruby="$(ryaml $_AO_HOME/config/deploy.yml app_ruby)"
47
+ : ${pth_rvmrun:=$(ruby -ryaml -e 'puts YAML.load(File.read(ARGV[0]))[ARGV[1]]' $_AO_HOME/config/deploy.yml ruby_loader)}
48
+ local nm_ruby="$(ruby -ryaml -e 'puts YAML.load(File.read(ARGV[0]))[ARGV[1]]' $_AO_HOME/config/deploy.yml app_ruby)"
49
49
 
50
50
  local tmp_remote="$(ssh $hst_gateway mktemp -t XXXXXXXXX)"
51
51
  scp -q $shome/sbin/remote-helper $hst_gateway:$tmp_remote
data/libexec/aoh-release CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock deploy deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock deploy deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-restart CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock deploy:restart deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock deploy:restart deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-rollback CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began deploy:lock deploy:rollback deploy:finished
20
+ bundle exec cap "$@" deploy:began deploy:lock deploy:rollback deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-shell CHANGED
@@ -17,7 +17,7 @@ require 'ao'
17
17
 
18
18
  function aomain {
19
19
  set -- $(for a in "$@"; do echo $a.app; done)
20
- cap "$@" deploy:began shell deploy:finished
20
+ bundle exec cap "$@" deploy:began shell deploy:finished
21
21
  }
22
22
 
23
23
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-stage CHANGED
@@ -16,7 +16,7 @@ require 'ao'
16
16
 
17
17
  function aomain {
18
18
  set -- $(for a in "$@"; do echo $a.app; done)
19
- cap "$@" deploy:began deploy:lock deploy:update_code deploy:symlink_next deploy:finished
19
+ bundle exec cap "$@" deploy:began deploy:lock deploy:update_code deploy:symlink_next deploy:finished
20
20
  }
21
21
 
22
22
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-task CHANGED
@@ -18,7 +18,7 @@ require 'ao'
18
18
  function aomain {
19
19
  local nm_task=$1; shift
20
20
  set -- $(for a in "$@"; do echo $a.app; done)
21
- cap "$@" deploy:began deploy:lock_migrate deploy:migrate "$nm_task" deploy:finished
21
+ bundle exec cap "$@" deploy:began deploy:lock_migrate deploy:migrate "$nm_task" deploy:finished
22
22
  }
23
23
 
24
24
  require sub "$BASH_SOURCE" "$@"
data/libexec/aoh-unlock CHANGED
@@ -21,11 +21,11 @@ function aomain {
21
21
  compare|migrate)
22
22
  nm_lock="${1}"; shift
23
23
  set -- $(for a in "$@"; do echo $a.app; done)
24
- cap "$@" deploy:began "deploy:unlock_${nm_lock}" deploy:finished
24
+ bundle exec cap "$@" deploy:began "deploy:unlock_${nm_lock}" deploy:finished
25
25
  ;;
26
26
  *)
27
27
  set -- $(for a in "$@"; do echo $a.app; done)
28
- cap "$@" deploy:began deploy:unlock deploy:finished
28
+ bundle exec cap "$@" deploy:began deploy:unlock deploy:finished
29
29
  ;;
30
30
  esac
31
31
  }
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: 123
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 48
10
- version: 1.3.48
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem
@@ -47,21 +47,23 @@ dependencies:
47
47
  type: :runtime
48
48
  version_requirements: *id002
49
49
  - !ruby/object:Gem::Dependency
50
- name: HeSYINUvSBZfxqA-capistrano
50
+ name: capistrano
51
51
  prerelease: false
52
52
  requirement: &id003 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
- - - ">="
55
+ - - "="
56
56
  - !ruby/object:Gem::Version
57
- hash: 3
57
+ hash: 49
58
58
  segments:
59
- - 0
60
- version: "0"
59
+ - 2
60
+ - 5
61
+ - 21
62
+ version: 2.5.21
61
63
  type: :runtime
62
64
  version_requirements: *id003
63
65
  - !ruby/object:Gem::Dependency
64
- name: HeSYINUvSBZfxqA-capistrano_colors
66
+ name: capistrano_colors
65
67
  prerelease: false
66
68
  requirement: &id004 !ruby/object:Gem::Requirement
67
69
  none: false
@@ -75,7 +77,7 @@ dependencies:
75
77
  type: :runtime
76
78
  version_requirements: *id004
77
79
  - !ruby/object:Gem::Dependency
78
- name: HeSYINUvSBZfxqA-capistrano_log
80
+ name: capistrano-log_with_awesome
79
81
  prerelease: false
80
82
  requirement: &id005 !ruby/object:Gem::Requirement
81
83
  none: false
@@ -134,7 +136,6 @@ files:
134
136
  - libexec/aoh-stage
135
137
  - libexec/aoh-task
136
138
  - libexec/aoh-unlock
137
- - libexec/aohelper
138
139
  - libexec/build
139
140
  - libexec/build-gem
140
141
  - libexec/bump
data/libexec/aohelper DELETED
@@ -1,14 +0,0 @@
1
- function ryaml {
2
- 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
- }
4
-
5
- shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
6
-
7
- app_ruby="$(ryaml $shome/config/deploy.yml app_ruby)"
8
- ruby_loader="$(ryaml $shome/config/deploy.yml ruby_loader)"
9
- PATH="$PATH:/usr/local/rvm/bin:$HOME/.rvm/bin"
10
-
11
- if ! $ruby_loader $app_ruby bundle check 2>&- > /dev/null; then
12
- $ruby_loader $app_ruby bundle install --local --quiet
13
- fi
14
- $ruby_loader $app_ruby bundle exec ao "${BASH_SOURCE##*/}" "$@"