knife-container 0.2.1 → 0.2.2

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: 179841a21b19d595e367e8bb8d0e209260afa8be
4
- data.tar.gz: 192f7ab139054268e518921c79048fc531523e5f
3
+ metadata.gz: 80850e4057f993db9ecb2f81135a9c201cab57bc
4
+ data.tar.gz: 33813a502452bd26fb2f004977e31b618ad6490d
5
5
  SHA512:
6
- metadata.gz: 254c57e611869bcdea9976bb7358e5aadbfe3e664a700ef3adae92fc8b7c6a5f8d4f1ca8d87eba16fdcab63afa31c06fa8892cc3aabbe8de18e64cd18a475b87
7
- data.tar.gz: 6ae48b0ca06bab72e4b6bff896a45961aef335251bf5a3c6484ffbeedb52fe7ca181642b1ca1d61106baec313ac8ced8f846bfb92b5f4ab6000b9e8f20dc032a
6
+ metadata.gz: d90cbb6aaec8406ed47061c633b6930373dbfd42e7ce3caf2851727b1721bd9eb76306c733aefaee6edfde807f285e0b59e085a0aa62fcfb0f6b9b7f45ddbdc0
7
+ data.tar.gz: 3447e0aee997c6ca6de715f227ede41e2886668890303223943ffb6d37c19f653a259d7cb851522720ce3c3c327f6f24774fc306ec1a5deb6228e2a516c617cc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Knife Container Changelog
2
2
 
3
+ ## v0.2.2 (2014-09-08)
4
+ * [GH-34] Update gemspec to support Chef12.
5
+
3
6
  ## v0.2.1 (2014-08-15)
4
7
  * [GH23] Specify hostname during knife container build
5
8
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "chef", "~> 11.0"
21
+ spec.add_dependency "chef", ">= 11.0"
22
22
  spec.add_dependency "mixlib-config", "~> 2.0"
23
23
  spec.add_dependency "json", ">= 1.4.4", "<= 1.8.1"
24
24
 
@@ -37,6 +37,10 @@ class Chef
37
37
  :default => true,
38
38
  :boolean => true
39
39
 
40
+ option :berks_config,
41
+ :long => "--berks-config CONFIG",
42
+ :description => "Use the specified Berkshelf configuration"
43
+
40
44
  option :cleanup,
41
45
  :long => "--[no-]cleanup",
42
46
  :description => "Cleanup Chef and Docker artifacts",
@@ -80,6 +84,13 @@ class Chef
80
84
  if config[:run_berks]
81
85
  ver = shell_out("berks -v")
82
86
  config[:run_berks] = ver.stdout.match(/\d+\.\d+\.\d+/) ? true : false
87
+
88
+ if config[:berks_config]
89
+ unless File.exists?(config[:berks_config])
90
+ ui.fatal("No Berksfile configuration found at #{config[:berks_config]}")
91
+ exit 1
92
+ end
93
+ end
83
94
  end
84
95
  end
85
96
 
@@ -155,11 +166,10 @@ class Chef
155
166
  #
156
167
  def run_berks_upload
157
168
  run_berks_install
158
- if config[:force_build]
159
- run_command("berks upload --force")
160
- else
161
- run_command("berks upload")
162
- end
169
+ berks_upload_cmd = "berks upload"
170
+ berks_upload_cmd << " --force" if config[:force_build]
171
+ berks_upload_cmd << " --config=#{File.expand_path(config[:berks_config])}" if config[:berks_config]
172
+ run_command(berks_upload_cmd)
163
173
  end
164
174
 
165
175
  #
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Container
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -129,6 +129,21 @@ describe Chef::Knife::ContainerDockerBuild do
129
129
  end
130
130
  end
131
131
  end
132
+
133
+ context "--berks-config was passed" do
134
+ let(:argv) { %w[ docker/demo --berks-config my_berkshelf/config.json ] }
135
+
136
+ context "and configuration file does not exist" do
137
+ before do
138
+ File.stub(:exists?).with('my_berkshelf/config.json').and_return(false)
139
+ end
140
+
141
+ it 'should exit immediately' do
142
+ expect(knife.ui).to receive(:fatal)
143
+ expect { knife.run }.to raise_error(SystemExit)
144
+ end
145
+ end
146
+ end
132
147
  end
133
148
 
134
149
  describe '#setup_config_defaults' do
@@ -297,6 +312,33 @@ describe Chef::Knife::ContainerDockerBuild do
297
312
  knife.run_berks_upload
298
313
  end
299
314
  end
315
+
316
+ context "when berks-config is specified" do
317
+ before do
318
+ knife.config[:berks_config] = 'my_berkshelf/config.json'
319
+ File.stub(:exists?).with('my_berkshelf/config.json').and_return(true)
320
+ File.stub(:expand_path).with('my_berkshelf/config.json').and_return('/home/my_berkshelf/config.json')
321
+ end
322
+
323
+ it "should run berks upload with specified config file" do
324
+ expect(knife).to receive(:run_command).with("berks upload --config=/home/my_berkshelf/config.json")
325
+ knife.run_berks_upload
326
+ end
327
+ end
328
+
329
+ context "when berks-config _and_ force-build is specified" do
330
+ before do
331
+ knife.config[:force_build] = true
332
+ knife.config[:berks_config] = 'my_berkshelf/config.json'
333
+ File.stub(:exists?).with('my_berkshelf/config.json').and_return(true)
334
+ File.stub(:expand_path).with('my_berkshelf/config.json').and_return('/home/my_berkshelf/config.json')
335
+ end
336
+
337
+ it "should run berks upload with specified config file _and_ force flag" do
338
+ expect(knife).to receive(:run_command).with("berks upload --force --config=/home/my_berkshelf/config.json")
339
+ knife.run_berks_upload
340
+ end
341
+ end
300
342
  end
301
343
 
302
344
  describe "#docker_build_command" do
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-container
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Duffield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-16 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '11.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '11.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -231,3 +231,4 @@ test_files:
231
231
  - spec/unit/fixtures/nodes/demo.json
232
232
  - spec/unit/fixtures/roles/base.json
233
233
  - spec/unit/fixtures/site-cookbooks/apt/metadata.rb
234
+ has_rdoc: