knife-changelog 1.2.3 → 1.2.4
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 +4 -4
- data/knife-changelog.gemspec +1 -1
- data/lib/knife/changelog/policyfile.rb +4 -3
- data/spec/unit/policyfile_spec.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1c7e863b74d109a6621879de1419046bbc5a2afb08ce618772f349d6aea0da
|
4
|
+
data.tar.gz: 5c6014713f79e60f1f517073166e114936d75f57db163f51e8f3aee6880e4614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bff9ad82bfe2d79b1b0d5094ee5b88e396b61013fb453aed9f57a584b48458428a7ec15dd88e63b6affb2e5b1c6e441112847b269312578d3d6f1505382d5660
|
7
|
+
data.tar.gz: c8e4d5741503d05cea8eaf23f1b8a120292733b8b7d723ac56c9b9f13977d0a501ffce943b6203f86d40e5f5cf16047d7b5a088b412e5a46c235c5a212419bee
|
data/knife-changelog.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'knife-changelog'
|
8
|
-
spec.version = '1.2.
|
8
|
+
spec.version = '1.2.4'
|
9
9
|
spec.authors = ['Gregoire Seux']
|
10
10
|
spec.email = ['kamaradclimber@gmail.com']
|
11
11
|
spec.summary = 'Facilitate access to cookbooks changelog'
|
@@ -29,7 +29,7 @@ class PolicyChangelog
|
|
29
29
|
backup_dir = Dir.mktmpdir
|
30
30
|
FileUtils.cp(File.join(@policyfile_dir, 'Policyfile.lock.json'), backup_dir)
|
31
31
|
updater = ChefDK::Command::Update.new
|
32
|
-
updater.run([@policyfile_path, @cookbooks_to_update].flatten)
|
32
|
+
raise "Error updating Policyfile lock #{@policyfile_path}" unless updater.run([@policyfile_path, @cookbooks_to_update].flatten).zero?
|
33
33
|
updated_policyfile_lock = read_policyfile_lock(@policyfile_dir)
|
34
34
|
FileUtils.cp(File.join(backup_dir, 'Policyfile.lock.json'), @policyfile_dir)
|
35
35
|
updated_policyfile_lock
|
@@ -55,7 +55,7 @@ class PolicyChangelog
|
|
55
55
|
# @return [Hash] cookbooks with their versions
|
56
56
|
def versions(locks, type)
|
57
57
|
raise 'Use "current" or "target" as type' unless %w[current target].include?(type)
|
58
|
-
raise 'Cookbook locks empty or nil' if locks.nil?
|
58
|
+
raise 'Cookbook locks empty or nil' if locks.nil? || locks.empty?
|
59
59
|
cookbooks = {}
|
60
60
|
locks.each do |name, data|
|
61
61
|
cookbooks[name] = if data['source_options'].keys.include?('git')
|
@@ -141,7 +141,8 @@ class PolicyChangelog
|
|
141
141
|
Gem::Version.new(t.name.gsub(/^v/, ''))
|
142
142
|
rescue ArgumentError => e
|
143
143
|
# Skip tag if version is not valid (i.e. a String)
|
144
|
-
|
144
|
+
raise unless e.message && e.message.include?('Malformed version number string')
|
145
|
+
Gem::Version.new('0.0.0')
|
145
146
|
end
|
146
147
|
end
|
147
148
|
end
|
@@ -40,6 +40,8 @@ RSpec.describe PolicyChangelog do
|
|
40
40
|
|
41
41
|
let(:url) { 'https://supermarket.chef.io/api/v1/cookbooks/users' }
|
42
42
|
|
43
|
+
let(:fake_update) { double('fake_update') }
|
44
|
+
|
43
45
|
let(:tags) do
|
44
46
|
[
|
45
47
|
double(name: '1.0.0'),
|
@@ -310,6 +312,14 @@ RSpec.describe PolicyChangelog do
|
|
310
312
|
|
311
313
|
expect(changelog.generate_changelog).to eq(output)
|
312
314
|
end
|
315
|
+
it 'raises an exception' do
|
316
|
+
allow(ChefDK::Command::Update).to receive(:new).and_return(fake_update)
|
317
|
+
allow(fake_update).to receive(:run).and_return(1)
|
318
|
+
allow(changelog).to receive(:git_changelog)
|
319
|
+
.and_return('e1b971a Add test commit message')
|
320
|
+
|
321
|
+
expect { changelog.generate_changelog }.to raise_error(RuntimeError)
|
322
|
+
end
|
313
323
|
end
|
314
324
|
end
|
315
325
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Seux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
246
|
rubyforge_project:
|
247
|
-
rubygems_version: 2.7.
|
247
|
+
rubygems_version: 2.7.7
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: Facilitate access to cookbooks changelog
|