knife-changelog 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86dbce0b63b7c41f34366f494d98c4d98c3276c237a952558a88db0b259b5df8
4
- data.tar.gz: 56f786a8cf798e7bd03e8340ed36079b559f0e880504e6d5b0dd09ca40d2f173
3
+ metadata.gz: 611393857429ed8e5091d457a902862327d2f336222629a8d1242a276c9b553f
4
+ data.tar.gz: 2f1d638388d31c667ae0d6c22313e53c56c42cd0ffbb8d38706c4819f83395e6
5
5
  SHA512:
6
- metadata.gz: 20006e01c5ddee8a8a9a6fbe980840bfcc8b94ac65fdae3e0254b82e03fedf915719f20f09cb72ee653cfc2c66b3e87523fffdcb7ea8981a3ebc0fdd71b5698a
7
- data.tar.gz: 5f745773984fcc7cddf037c0c78847604994252cdf1dec9626683acf63f6da6f3f28e303a2daaecf49ca1bcc96d3e4b14b88522db71d94156a352a82cbe34030
6
+ metadata.gz: e9ebf4ae12169de498bd4933bfa0a71579b83db669a4f7e4c8bfd2d4c19689c5b8a732db9355fc3165b215abbb7e433f330f6a9e3b802540babad50f52de0c28
7
+ data.tar.gz: b7d3b7140e41ee4b7b5912580913471bb16be2113aaa69675ef70c33420ff5573ebf2481c8532398d90d586db204c8878160021ff825cc05aace5337eecc16e5
@@ -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.1'
8
+ spec.version = '1.2.2'
9
9
  spec.authors = ['Gregoire Seux']
10
10
  spec.email = ['kamaradclimber@gmail.com']
11
11
  spec.summary = 'Facilitate access to cookbooks changelog'
@@ -58,7 +58,11 @@ class PolicyChangelog
58
58
  raise 'Cookbook locks empty or nil' if locks.nil? or locks.empty?
59
59
  cookbooks = {}
60
60
  locks.each do |name, data|
61
- cookbooks[name] = { "#{type}_version" => data['version'] }
61
+ cookbooks[name] = if data['source_options'].keys.include?('git')
62
+ { "#{type}_version" => data['source_options']['revision'] }
63
+ else
64
+ { "#{type}_version" => data['version'] }
65
+ end
62
66
  end
63
67
  cookbooks
64
68
  end
@@ -0,0 +1,61 @@
1
+ {
2
+ "revision_id": "9335ba14e000b8026fbf7d1e862aa6d26fd1139c08a56776a253be10d24bf4cc",
3
+ "name": "test_policy",
4
+ "run_list": [
5
+ "recipe[users::default]",
6
+ "recipe[sudo::default]"
7
+ ],
8
+ "included_policy_locks": [
9
+
10
+ ],
11
+ "cookbook_locks": {
12
+ "sudo": {
13
+ "version": "5.4.0",
14
+ "identifier": "541cc137ce19b303fe7e2e7aaa387e9b1e39dbd1",
15
+ "dotted_decimal_identifier": "23675514234214835.1124242829257272.139204692138961",
16
+ "cache_key": "sudo-2bbebd0aea219047754a11eacc0763b92eb07113",
17
+ "origin": "https://github.com/chef-cookbooks/sudo.git",
18
+ "source_options": {
19
+ "git": "https://github.com/chef-cookbooks/sudo.git",
20
+ "revision": "2bbebd0aea219047754a11eacc0763b92eb07113"
21
+ }
22
+ },
23
+ "users": {
24
+ "version": "5.3.1",
25
+ "identifier": "41c2bf84fe2476bbbe2dbe79362e6726a3ea47c7",
26
+ "dotted_decimal_identifier": "18510001311982710.52844924323313198.113415656458183",
27
+ "cache_key": "users-5.3.1-supermarket.chef.io",
28
+ "origin": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/5.3.1/download",
29
+ "source_options": {
30
+ "artifactserver": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/5.3.1/download",
31
+ "version": "5.3.1"
32
+ }
33
+ }
34
+ },
35
+ "default_attributes": {
36
+
37
+ },
38
+ "override_attributes": {
39
+
40
+ },
41
+ "solution_dependencies": {
42
+ "Policyfile": [
43
+ [
44
+ "sudo",
45
+ ">= 0.0.0"
46
+ ],
47
+ [
48
+ "users",
49
+ "= 5.3.1"
50
+ ]
51
+ ],
52
+ "dependencies": {
53
+ "sudo (5.4.0)": [
54
+
55
+ ],
56
+ "users (5.3.1)": [
57
+
58
+ ]
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,10 @@
1
+ name 'test_policy'
2
+
3
+ run_list [
4
+ 'recipe[users]',
5
+ 'recipe[sudo]',
6
+ ]
7
+
8
+ default_source :supermarket, "https://supermarket.chef.io"
9
+
10
+ cookbook 'sudo', git: 'https://github.com/chef-cookbooks/sudo.git'
@@ -115,6 +115,15 @@ RSpec.describe PolicyChangelog do
115
115
  expect { changelog.versions(nil, 'current') }.to raise_error(RuntimeError)
116
116
  end
117
117
  end
118
+
119
+ context 'when cookbook is sourced by git' do
120
+ let(:lock_current) do
121
+ JSON.parse(File.read(File.join(pf_dir, 'Policyfile_git.lock.json')))
122
+ end
123
+ it 'returns git commit as version' do
124
+ expect(changelog.versions(lock_current['cookbook_locks'], 'target')['sudo']).to include('target_version' => '2bbebd0aea219047754a11eacc0763b92eb07113')
125
+ end
126
+ end
118
127
  end
119
128
 
120
129
  describe '#get_source_url' do
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.1
4
+ version: 1.2.2
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-03-20 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -218,6 +218,8 @@ files:
218
218
  - spec/data/Berksfile.lock
219
219
  - spec/data/Policyfile.lock.json
220
220
  - spec/data/Policyfile.rb
221
+ - spec/data/Policyfile_git.lock.json
222
+ - spec/data/Policyfile_git.rb
221
223
  - spec/data/updated/Policyfile.lock.json
222
224
  - spec/spec_helper.rb
223
225
  - spec/unit/changelog_spec.rb
@@ -251,6 +253,8 @@ test_files:
251
253
  - spec/data/Berksfile.lock
252
254
  - spec/data/Policyfile.lock.json
253
255
  - spec/data/Policyfile.rb
256
+ - spec/data/Policyfile_git.lock.json
257
+ - spec/data/Policyfile_git.rb
254
258
  - spec/data/updated/Policyfile.lock.json
255
259
  - spec/spec_helper.rb
256
260
  - spec/unit/changelog_spec.rb