alpha_omega 0.0.202 → 0.0.204

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 CHANGED
@@ -1 +1 @@
1
- 0.0.202
1
+ 0.0.204
@@ -2,6 +2,7 @@ $:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','..','lib'))
2
2
 
3
3
  require 'benchmark'
4
4
  require 'yaml'
5
+ require 'json'
5
6
  require 'alpha_omega/deploy/scm'
6
7
  require 'alpha_omega/deploy/strategy'
7
8
  require 'alpha_omega/utils'
@@ -37,7 +38,7 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
37
38
  _cset(:revision) { source.head }
38
39
 
39
40
  _cset :default_shell, "/bin/bash"
40
- _cset(:deploy_to) { "/u/apps/#{application}" }
41
+ _cset(:deploy_to) { "/data/#{application}" }
41
42
 
42
43
  _cset :root_user, "root"
43
44
  _cset :root_group, "root"
@@ -80,8 +80,8 @@ module AlphaOmega
80
80
 
81
81
  node_dna = { }
82
82
  hosts =
83
- AlphaOmega.what_hosts pod do |task_name, remote_name, node|
84
- n = AlphaOmega.node_defaults(node, pod_name, remote_name)
83
+ self.what_hosts pod do |task_name, remote_name, node|
84
+ n = self.node_defaults(node, pod_name, remote_name)
85
85
  node_dna[remote_name] = {}
86
86
  node_dna[remote_name].deep_merge!(n)
87
87
 
@@ -100,11 +100,11 @@ module AlphaOmega
100
100
  end
101
101
 
102
102
  config.task "#{task_name}.#{pod_name}.echo" do # task host.pod1.echo
103
- puts "#{AlphaOmega.magic_prefix} #{remote_name}"
103
+ puts "#{self.magic_prefix} #{remote_name}"
104
104
  end
105
105
 
106
106
  config.task "#{task_name}.#{pod_name}.yaml" do # task host.pod1.yaml
107
- StringIO.new({ remote_name => n }.to_yaml).lines.to_a[1..-1].each {|l| puts "#{AlphaOmega.magic_prefix} #{l}" }
107
+ StringIO.new({ remote_name => n }.to_yaml).lines.to_a[1..-1].each {|l| puts "#{self.magic_prefix} #{l}" }
108
108
  end
109
109
 
110
110
  %w(app echo yaml).each do |tsuffix|
@@ -116,7 +116,7 @@ module AlphaOmega
116
116
  n
117
117
  end
118
118
 
119
- AlphaOmega.what_groups hosts do |task_name, nodes|
119
+ self.what_groups hosts do |task_name, nodes|
120
120
  if task_name == "all"
121
121
  # simulate all podXX all
122
122
  %w(app echo yaml).each do |tsuffix|
@@ -179,7 +179,7 @@ module AlphaOmega
179
179
  this_host = Socket.gethostname.chomp.split(".")[0]
180
180
  dna_base = "#{node_home}/pods/#{$this_pod}/#{this_host}"
181
181
  dna = File.exists?("#{dna_base}.yaml") ? YAML.load(File.read("#{dna_base}.yaml")) : JSON.load(File.read("#{dna_base}.json"))
182
- this_node = AlphaOmega.node_defaults(dna, $this_pod, this_host)
182
+ this_node = self.node_defaults(dna, $this_pod, this_host)
183
183
  $this_host = this_node
184
184
 
185
185
  ((this_node["pods"] || []) + [$this_pod]).inject({}) do |pods, pod_name|
@@ -227,4 +227,25 @@ module AlphaOmega
227
227
 
228
228
  cap_groups
229
229
  end
230
+
231
+ def self.interesting (config, deploy, &node_filter)
232
+ config._cset :repository, deploy["repository"]
233
+ config._cset :application, deploy["application"]
234
+
235
+ config._cset :user, deploy["user"]
236
+ config._cset :group, deploy["group"]
237
+
238
+ config._cset :ruby_loader, "#{deploy["ruby_loader"]} #{deploy["app_ruby"]}"
239
+
240
+ # branches
241
+ config._cset :branch, self.what_branch(deploy["branches"] + [%r(#{deploy["branch_regex"]})])
242
+
243
+ # pods, hosts, groups
244
+ self.setup_pods config, (ENV['CHEF_PATH'] || deploy["chef_path"]), node_filter
245
+ end
246
+ end
247
+
248
+ def Deploy(config, deploy_yaml, &node_filter)
249
+ deploy = YAML.load_file(deploy_yaml)
250
+ AlphaOmega.interesting(config, deploy, node_filter)
230
251
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_omega
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.202
4
+ version: 0.0.204
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,6 +12,22 @@ bindir: bin
12
12
  cert_chain: []
13
13
  date: 2011-08-31 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
15
31
  - !ruby/object:Gem::Dependency
16
32
  name: grit
17
33
  requirement: !ruby/object:Gem::Requirement