toque 1.1.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 448b10e7713de07a35d214f3ed5693cebb4f94ac
4
- data.tar.gz: e15016d9d28df39fc514d3c39409d3f1a2ef36e5
3
+ metadata.gz: abe45ec2e232621d391e863a00de26f9687c2efe
4
+ data.tar.gz: 20dcc17fcf3005f8f7ed944213ba5a2cb34abe9f
5
5
  SHA512:
6
- metadata.gz: d7218962dbf656cc07ecf4b85187ba59711800234cb9c9f5d2a55b3990e2447ce4c008b9bbf5372c7de1c7f37fd980842de3e25370fa8535d369c708dda0a4f8
7
- data.tar.gz: 12abda9ee2c118d09b04ba1e76e000e0a12f999aa4a80a6caaac287e688ff1e17237e4c0bc9dc22cde5591563b716b402a8e74089292a42d298a309a6d656802
6
+ metadata.gz: fec190cf7bea20de7c050792ff0f2897344e3d39b2818605ec28d16ee866cf88f321f586816e20c4f6758ba00437c235631fa5dba7dc6a07f6ced9d3362980e8
7
+ data.tar.gz: 0ba3906f360398bccc02ddd76902a9881204e50cd4ab5c5dabf42a23480c244ecb14aafcff0c69518d0bb892a8ffe095cf6ebd1b7a5fc9c9863a369adabec6a0
data/lib/toque/chef.rb CHANGED
@@ -117,10 +117,19 @@ module Toque
117
117
  task :configuration do
118
118
  pwd!
119
119
 
120
- attrs = variables.dup
120
+ attrs = convert variables.dup
121
121
  attrs[:run_list] = recipes
122
122
  put MultiJson.dump(attrs), pwd("node.json"), :via => :scp
123
123
  end
124
+
125
+ def convert(hash)
126
+ hash.inject({}) do |h, e|
127
+ key, value = *e
128
+ h[key] = convert value if value.is_a?(Hash)
129
+ h[key] = value.call if value.is_a?(Proc)
130
+ h
131
+ end
132
+ end
124
133
  end
125
134
 
126
135
  desc 'Run list of recipes from `:run_list` option.'
data/lib/toque/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Toque
2
2
  module VERSION
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
  STAGE = nil
7
7
 
@@ -76,7 +76,7 @@ describe Toque::Chef, 'loaded into capistrano' do
76
76
  end
77
77
  end
78
78
 
79
- describe '#upload_cookbooks' do
79
+ describe 'toque:chef:setup:cookbooks' do
80
80
  before do
81
81
  File.stub(:exists?).and_return false
82
82
  File.stub(:exists?).with('config/cookbooks').and_return true
@@ -101,6 +101,31 @@ describe Toque::Chef, 'loaded into capistrano' do
101
101
  end
102
102
  end
103
103
 
104
+ describe 'toque:chef:setup:script' do
105
+ it 'should upload chef solo script' do
106
+ @configuration.toque.chef.setup.script
107
+
108
+ expect(@configuration).to have_uploaded.to('/tmp/toque/node.rb')
109
+ end
110
+ end
111
+
112
+ describe 'toque:chef:setup:configuration' do
113
+ before do
114
+ @configuration.set :run_list, %w(recipe[awesomeium])
115
+ @configuration.set :postgres, :version => '9.2', password: -> { { postgresql: 'secret_in_proc' } }
116
+ @configuration.toque.chef.setup.configuration
117
+ @node = MultiJson.load @configuration.uploads.keys.first.read
118
+ end
119
+
120
+ it 'should upload node configuration' do
121
+ expect(@configuration).to have_uploaded.to('/tmp/toque/node.json')
122
+ end
123
+
124
+ it 'should have called option procs' do
125
+ expect(@node['postgres']['password']).to be == { 'postgresql' => 'secret_in_proc' }
126
+ end
127
+ end
128
+
104
129
  describe 'toque:chef:install' do
105
130
 
106
131
  it 'should install chef using omnibus installer' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen