chef_cap 0.2.9 → 0.3.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/lib/chef_cap/version.rb +1 -1
- data/recipes/chef_cap.rb +11 -5
- data/spec/chef_cap_spec.rb +8 -5
- metadata +7 -7
data/lib/chef_cap/version.rb
CHANGED
data/recipes/chef_cap.rb
CHANGED
@@ -151,7 +151,7 @@ end
|
|
151
151
|
if ChefDnaParser.parsed["chef"] && ChefDnaParser.parsed["chef"]["version"]
|
152
152
|
set :chef_version, ChefDnaParser.parsed["chef"]["version"]
|
153
153
|
else
|
154
|
-
default_chef_version = "0.
|
154
|
+
default_chef_version = "0.10.4"
|
155
155
|
set :chef_version, default_chef_version
|
156
156
|
end
|
157
157
|
|
@@ -168,11 +168,17 @@ namespace :chef do
|
|
168
168
|
|
169
169
|
desc "Run chef-solo on the server(s)"
|
170
170
|
task :deploy do
|
171
|
-
|
171
|
+
require "tempfile"
|
172
|
+
put "cookbook_path '/tmp/chef-cap-#{rails_env}/#{File.basename(chef_root_path)}/cookbooks'", "/tmp/chef-cap-solo-#{rails_env}.rb", :mode => "0600"
|
172
173
|
sudo "rm -rf /tmp/chef-cap-#{rails_env}"
|
173
|
-
|
174
|
-
|
175
|
-
|
174
|
+
file = Tempfile.new("chef-cap-#{rails_env}")
|
175
|
+
file.close
|
176
|
+
compressed_chef = file.path
|
177
|
+
system("cd #{chef_root_path}/../ && tar cjf #{compressed_chef} #{File.basename(chef_root_path)}")
|
178
|
+
upload compressed_chef, "/tmp/chef-cap-#{rails_env}.tbz", :mode => "0700"
|
179
|
+
sudo "mkdir -p /tmp/chef-cap-#{rails_env}"
|
180
|
+
sudo "tar xjf /tmp/chef-cap-#{rails_env}.tbz -C /tmp/chef-cap-#{rails_env}"
|
181
|
+
file.unlink
|
176
182
|
begin
|
177
183
|
env_settings = environment_settings
|
178
184
|
rescue
|
data/spec/chef_cap_spec.rb
CHANGED
@@ -392,6 +392,7 @@ describe "chef_cap" do
|
|
392
392
|
|
393
393
|
chef_cap.cap_task[:some_env].should_not be_nil
|
394
394
|
chef_cap.cap_task[:some_env].call
|
395
|
+
chef_cap.stub(:system).and_return(true)
|
395
396
|
end
|
396
397
|
|
397
398
|
it "exists" do
|
@@ -439,7 +440,6 @@ describe "chef_cap" do
|
|
439
440
|
end
|
440
441
|
|
441
442
|
it "that uploads the DNA.json and a solo.rb file" do
|
442
|
-
pending "FIXME"
|
443
443
|
localhost_dna = JSON.parse(@test_dna).dup
|
444
444
|
otherhost_dna = JSON.parse(@test_dna).dup
|
445
445
|
localhost_dna["run_list"] = ["foo", "bar"]
|
@@ -448,20 +448,20 @@ describe "chef_cap" do
|
|
448
448
|
otherhost_dna["environment"] = otherhost_dna["environments"]["some_env"]
|
449
449
|
|
450
450
|
chef_cap.parallel_mocks << proc { |server_session|
|
451
|
-
server_session.should_receive(:put).
|
452
|
-
server_session.should_receive(:put).ordered.with(otherhost_dna.to_json, "/tmp/chef-cap-myenv.json", :mode => "0600", :hosts => "otherhost.com").and_return("mocked")
|
451
|
+
server_session.should_receive(:put).with(anything, anything, :mode => "0600").at_least(:once).and_return("mocked")
|
453
452
|
server_session.stub!(:set => "stubbed")
|
454
453
|
server_session.stub!(:sudo => "stubbed")
|
455
454
|
}
|
456
|
-
chef_cap.should_receive(:put).ordered.with("cookbook_path '/tmp/chef-cap-myenv/cookbooks'", "/tmp/chef-cap-solo-myenv.rb", :mode => "0600").and_return("mocked")
|
455
|
+
chef_cap.should_receive(:put).ordered.with("cookbook_path '/tmp/chef-cap-myenv/path_to_cookbooks/cookbooks'", "/tmp/chef-cap-solo-myenv.rb", :mode => "0600").and_return("mocked")
|
457
456
|
chef_cap.stub!(:upload => "stubbed")
|
458
457
|
chef_cap.stub!(:sudo => "stubbed")
|
459
458
|
chef_cap.cap_task["chef:deploy"].call
|
460
459
|
end
|
461
460
|
|
462
461
|
it "uploads the cookbooks" do
|
462
|
+
Tempfile.should_receive(:new).and_return(double(:path => "/tmp/temp_file", :close => nil, :unlink => nil))
|
463
463
|
chef_cap.stub!(:put => "stubbed")
|
464
|
-
chef_cap.should_receive(:upload).with("
|
464
|
+
chef_cap.should_receive(:upload).with("/tmp/temp_file", "/tmp/chef-cap-myenv.tbz", :mode => "0700").and_return("mocked")
|
465
465
|
chef_cap.stub!(:sudo => "stubbed")
|
466
466
|
chef_cap.parallel_mocks << proc { |server_session|
|
467
467
|
server_session.stub!(:put => "stubbed")
|
@@ -723,6 +723,7 @@ describe "chef_cap" do
|
|
723
723
|
"run_list": ["everything"]
|
724
724
|
}
|
725
725
|
JS
|
726
|
+
chef_cap.stub(:system).and_return(true)
|
726
727
|
end
|
727
728
|
|
728
729
|
it "merges recursively all shared and all roles data down into top level keys" do
|
@@ -793,6 +794,7 @@ describe "chef_cap" do
|
|
793
794
|
}
|
794
795
|
}
|
795
796
|
JS
|
797
|
+
chef_cap.stub(:system).and_return(true)
|
796
798
|
end
|
797
799
|
|
798
800
|
it "puts the specified deploy_recipe at the very end of the run list" do
|
@@ -841,6 +843,7 @@ describe "chef_cap" do
|
|
841
843
|
}
|
842
844
|
}
|
843
845
|
JS
|
846
|
+
chef_cap.stub(:system).and_return(true)
|
844
847
|
end
|
845
848
|
|
846
849
|
it "contains a copy of the structure of the environment we are in that merged with the defaults" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_cap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-12-09 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2165476000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.5.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2165476000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &2165475040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.1'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2165475040
|
36
36
|
description: chef_cap uses chef"s JSON config format to drive both capistrano and
|
37
37
|
chef-solo"
|
38
38
|
email:
|
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
segments:
|
93
93
|
- 0
|
94
|
-
hash: -
|
94
|
+
hash: -4204190747426429457
|
95
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
96
|
none: false
|
97
97
|
requirements:
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
segments:
|
102
102
|
- 0
|
103
|
-
hash: -
|
103
|
+
hash: -4204190747426429457
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
106
|
rubygems_version: 1.8.12
|