chef_cap 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .vimlog
1
2
  .DS_Store
2
3
  *.gem
3
- Gemfile.lock
4
+ Gemfile.lock
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm 1.9.2-p136@chef_cap
1
+ rvm 1.9.2-p180-patched@chef_cap --create
data/README.rdoc CHANGED
@@ -52,20 +52,26 @@ Run chef without deploy
52
52
 
53
53
  $ cap <environment> cook
54
54
 
55
+ Deploy a particular Git branch, tag, or revision (overriding the default)
56
+
57
+ $ cap <environment> deploy BRANCH=my_branch
58
+ $ cap <environment> deploy TAG=my_tag
59
+ $ cap <environment> deploy REVISION=abc1234
60
+
55
61
  === chef/node.json
56
62
 
57
63
  The following JSON keys are required in your node.json file:
58
64
 
59
- { "application": { "name": NAME } }
60
- { "application": { "repository": REPOSITORY } }
61
- { "environments": { ENVIRONMENT: { "rails_env": RAILS_ENV } } }
62
- { "roles": { ROLE: { "run_list": [] } } }
63
- { "run_list": [] }
65
+ { "application": { "name": NAME } }
66
+ { "application": { "repository": REPOSITORY } }
67
+ { "environments": { ENVIRONMENT: { "rails_env": RAILS_ENV } } }
68
+ { "roles": { ROLE: { "run_list": [] } } }
69
+ { "run_list": [] }
64
70
 
65
71
  Optional JSON keys:
66
72
 
67
- { "environments": { ENVIRONMENT: { "role_order": { FIRST_ROLE: [OTHER_ROLES] } } } }
68
- { "environments": { ENVIRONMENT: { "environment_settings": ENV_HASH } } }
73
+ { "environments": { ENVIRONMENT: { "role_order": { FIRST_ROLE: [OTHER_ROLES] } } } }
74
+ { "environments": { ENVIRONMENT: { "environment_settings": ENV_HASH } } }
69
75
 
70
76
 
71
77
  == REQUIREMENTS
@@ -1,3 +1,3 @@
1
1
  module ChefCap
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/recipes/chef_cap.rb CHANGED
@@ -183,6 +183,7 @@ namespace :chef do
183
183
  json_to_modify["environment"] ||= json_to_modify["environments"]["defaults"] || {} rescue {}
184
184
  env_settings.each { |k, v| ChefCapHelper.recursive_merge(json_to_modify["environment"] || {}, k, v) }
185
185
 
186
+ json_to_modify["environment"]["roles"] = roles_for_host
186
187
  json_to_modify["environment"]["revision"] = ChefCapHelper.set_revision if ChefCapHelper.has_revision?
187
188
  json_to_modify["environment"]["branch"] = ChefCapHelper.set_branch if ChefCapHelper.has_branch?
188
189
  json_to_modify["environment"]["servers"] = ChefCapHelper.intialize_primary_values(json_to_modify["environment"]["servers"])
@@ -193,7 +194,7 @@ namespace :chef do
193
194
  set "node_hash_for_#{channel[:host].gsub(/\./, "_")}", json_to_modify
194
195
  put json_to_modify.to_json, "/tmp/chef-cap-#{rails_env}-#{channel[:host]}.json", :mode => "0600"
195
196
  end
196
- end
197
+ end
197
198
 
198
199
  chef.run_chef_solo
199
200
  end
@@ -422,7 +422,7 @@ describe "chef_cap" do
422
422
  "servers"=>[ {"hostname"=>"localhost", "roles"=>["role1", "role2"] }, {"hostname"=>"otherhost.com", "roles"=>["role1"]}]}},
423
423
  "chef" => {"root"=>"path_to_cookbooks", "version"=>"0.1982.1234"},
424
424
  "run_list" => ["foo", "bar"],
425
- "environment" => {"rails_env" => "myenv", "servers"=>[ {"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"] },
425
+ "environment" => {"rails_env" => "myenv", "roles" => ["role1", "role2"], "servers"=>[ {"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"] },
426
426
  {"primary" => [], "hostname"=>"otherhost.com", "roles"=>["role1"]}]},
427
427
  "roles" => {"role1" => {"run_list"=>["foo"]}, "role2"=>{"run_list"=>["foo", "bar"]}}}
428
428
  elsif server_session.things_that_were_set.keys.include? "node_hash_for_otherhost"
@@ -431,7 +431,7 @@ describe "chef_cap" do
431
431
  "servers"=>[{"hostname"=>"localhost", "roles"=>["role1", "role2"]}, {"hostname"=>"otherhost.com", "roles"=>["role1"]}]}},
432
432
  "chef"=>{"root"=>"path_to_cookbooks"},
433
433
  "run_list"=>["foo"],
434
- "environment"=>{"rails_env" => "myenv", "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]},
434
+ "environment"=>{"rails_env" => "myenv", "roles" => ["role1"], "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]},
435
435
  {"primary" => [], "hostname"=>"otherhost.com", "roles"=>["role1"]}]},
436
436
  "roles"=>{"role1"=>{"run_list"=>["foo"]}, "role2"=>{"run_list"=>["foo", "bar"]}}}
437
437
  end
@@ -757,7 +757,8 @@ describe "chef_cap" do
757
757
  if server_session.things_that_were_set.keys.include? "node_hash_for_localhost"
758
758
  server_session.things_that_were_set["node_hash_for_localhost"]["environment"].should == {"some_default"=>"yes",
759
759
  "something_else"=>"okay",
760
- "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]}]}
760
+ "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]}],
761
+ "roles" => []}
761
762
  end
762
763
  end
763
764
  end
@@ -905,12 +906,18 @@ describe "chef_cap" do
905
906
  server_session.stub!(:put => "stubbed")
906
907
  server_session.stub!(:sudo => "stubbed")
907
908
  server_session.should_receive(:set).with("node_hash_for_localhost",
908
- {"environments" => { "some_env"=>{"servers"=>[{"hostname"=>"localhost", "roles"=>["role1", "role2"]}]}},
909
- "something"=>"other", "foo"=>"bar",
910
- "chef"=>{"root"=>"path_to_cookbooks"},
911
- "run_list"=>nil, "shared"=>{"foo"=>"bar"},
912
- "environment"=> {"revision"=>"123", "branch" => "somebranch", "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]}]}, "roles"=>{"role1"=>{"something"=>"other"}}}
913
- )
909
+ {
910
+ "chef"=>{"root"=>"path_to_cookbooks"},
911
+ "environments" => { "some_env"=>{"servers"=>[{"hostname"=>"localhost", "roles"=>["role1", "role2"]}]}},
912
+ "shared"=>{"foo"=>"bar"},
913
+ "foo"=>"bar",
914
+ "something"=>"other",
915
+ "environment"=> {"revision"=>"123", "branch" => "somebranch",
916
+ "roles" => ["role1"],
917
+ "servers"=>[{"primary" => [], "hostname"=>"localhost", "roles"=>["role1", "role2"]}]},
918
+ "roles"=>{"role1"=>{"something"=>"other"}},
919
+ "run_list"=>nil
920
+ })
914
921
  }
915
922
  chef_cap.cap_task["chef:deploy"].call
916
923
  end
metadata CHANGED
@@ -1,50 +1,46 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: chef_cap
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
4
5
  prerelease:
5
- version: 0.2.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Case Commons, LLC
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-16 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: capistrano
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2153395380 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 2.5.5
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-rails
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2153395380
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec-rails
27
+ requirement: &2153394260 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "2.1"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.1'
36
33
  type: :development
37
- version_requirements: *id002
38
- description: chef_cap uses chef"s JSON config format to drive both capistrano and chef-solo"
39
- email:
34
+ prerelease: false
35
+ version_requirements: *2153394260
36
+ description: chef_cap uses chef"s JSON config format to drive both capistrano and
37
+ chef-solo"
38
+ email:
40
39
  - casecommons-dev@googlegroups.com
41
40
  executables: []
42
-
43
41
  extensions: []
44
-
45
42
  extra_rdoc_files: []
46
-
47
- files:
43
+ files:
48
44
  - .gitignore
49
45
  - .rspec
50
46
  - .rvmrc
@@ -80,35 +76,38 @@ files:
80
76
  - spec/chef_cap_spec.rb
81
77
  - spec/chef_dna_parser_spec.rb
82
78
  - spec/spec_helper.rb
83
- has_rdoc: true
84
79
  homepage: https://github.com/Casecommons/chef_cap
85
- licenses:
80
+ licenses:
86
81
  - MIT
87
82
  post_install_message:
88
83
  rdoc_options: []
89
-
90
- require_paths:
84
+ require_paths:
91
85
  - lib
92
- required_ruby_version: !ruby/object:Gem::Requirement
86
+ required_ruby_version: !ruby/object:Gem::Requirement
93
87
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: "0"
98
- required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
93
+ - 0
94
+ hash: 3095980632773080420
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
96
  none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: "0"
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
102
+ - 0
103
+ hash: 3095980632773080420
104
104
  requirements: []
105
-
106
105
  rubyforge_project:
107
- rubygems_version: 1.6.2
106
+ rubygems_version: 1.8.11
108
107
  signing_key:
109
108
  specification_version: 3
110
109
  summary: capistrano + chef-solo == chef_cap"
111
- test_files:
110
+ test_files:
112
111
  - spec/chef_cap_configuration_spec.rb
113
112
  - spec/chef_cap_helper_spec.rb
114
113
  - spec/chef_cap_mock_cap.rb