chef_cap 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ChefCap
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/recipes/chef_cap.rb CHANGED
@@ -20,10 +20,14 @@ if ChefDnaParser.parsed["environments"]
20
20
  ChefCapHelper.parse_hash(environment_defaults)
21
21
  end
22
22
 
23
+ set :environments, {}
24
+
23
25
  ChefDnaParser.parsed["environments"].each_key do |environment|
24
26
  next if environment == "default"
25
27
  environment_hash = ChefDnaParser.parsed["environments"][environment]
26
28
 
29
+ set :environments, environments.merge(environment => environment_hash)
30
+
27
31
  desc "Set server roles for the #{environment} environment"
28
32
  task environment.to_sym do
29
33
  set :environment_settings, environment_hash
@@ -79,6 +79,31 @@ describe "chef_cap" do
79
79
  chef_cap.cap_role[:db][:primary].should == "localhost"
80
80
  end
81
81
 
82
+ it "stores the environment settings in a capistrano variable" do
83
+ @test_dna = <<-JS
84
+ {
85
+ "chef": {
86
+ "root": "path_to_cookbooks"
87
+ },
88
+ "application": {
89
+ "name": "frobble",
90
+ "repository": "git@somehost:user/repo.git"
91
+ },
92
+ "environments": {
93
+ "defaults": {
94
+ "user": "myuser"
95
+ },
96
+ "some_env": {
97
+ "user": "newenvuser"
98
+ }
99
+ }
100
+ }
101
+ JS
102
+ chef_cap.cap_variable[:environments].should_not be_nil
103
+ chef_cap.cap_variable[:environments]["some_env"].should_not be_nil
104
+ chef_cap.cap_variable[:environments]["some_env"]["user"].should == "newenvuser"
105
+ end
106
+
82
107
  describe "default_environment" do
83
108
  it "sets the RAILS_ENV to rails_env" do
84
109
  @test_dna = <<-ERB
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Case Commons, LLC
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-03 00:00:00 -05:00
17
+ date: 2011-03-07 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency