alpha_omega 0.0.57 → 0.0.58

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
45
45
  _cset :ruby_loader, ""
46
46
 
47
47
  _cset :current_pod, "default"
48
+ _cset :last_pod, nil
48
49
 
49
50
  _cset (:figlet) { [%x(which figlet).strip].reject {|f| !(File.executable? f)}.first || echo }
50
51
 
@@ -3,7 +3,7 @@ require 'capistrano'
3
3
  module AlphaOmega
4
4
 
5
5
  def self.default_pods_tasks
6
- Proc.new do |config, pod_name, pod|
6
+ Proc.new do |config, pod_name, pod, mix_pods|
7
7
  # each pod task sets the pod context for host/group tasks
8
8
  config.task pod_name do
9
9
  set :current_pod, pod_name
@@ -21,6 +21,14 @@ module AlphaOmega
21
21
  end
22
22
 
23
23
  AlphaOmega.what_groups hosts do |task_name, nodes|
24
+ unless mix_pods
25
+ if last_pod && last_pod != pod_name
26
+ puts "ERROR: cannot call tasks that mix different dc_env (last pod = #{last_pod}, current pod = #{pod_name})"
27
+ exit 1
28
+ end
29
+ end
30
+
31
+ set :last_pod, pod_name
24
32
  config.task "#{task_name}.#{pod_name}" do
25
33
  nodes.keys.sort.each do |remote_name|
26
34
  role :app, remote_name
@@ -34,8 +42,8 @@ module AlphaOmega
34
42
  end
35
43
  end
36
44
 
37
- def self.setup_pods (config, node_home)
38
- self.what_pods(config, node_home) { |config, pod_name, pod| self.default_pods_tasks.call(config, pod_name, pod) }
45
+ def self.setup_pods (config, node_home, mix_pods = false)
46
+ self.what_pods(config, node_home) { |config, pod_name, pod| self.default_pods_tasks.call(config, pod_name, pod, mix_pods) }
39
47
  end
40
48
 
41
49
  def self.what_branch (allowed = %w(production master develop))
@@ -1,3 +1,3 @@
1
1
  module AlphaOmega
2
- Version = "0.0.57"
2
+ Version = "0.0.58"
3
3
  end
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: 109
4
+ hash: 107
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 57
10
- version: 0.0.57
9
+ - 58
10
+ version: 0.0.58
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Nghiem