knife-changelog 1.2.0 → 1.2.1

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
  SHA256:
3
- metadata.gz: 95499efdf53e4b358f0915a77503a9e9b7fd22fcd548f8c8cde457647407ad52
4
- data.tar.gz: 74b012abf17ffd90825355ad5d1441be039a6ec035af288603ad225f1856d4bf
3
+ metadata.gz: 86dbce0b63b7c41f34366f494d98c4d98c3276c237a952558a88db0b259b5df8
4
+ data.tar.gz: 56f786a8cf798e7bd03e8340ed36079b559f0e880504e6d5b0dd09ca40d2f173
5
5
  SHA512:
6
- metadata.gz: 614b3a5eee0ed8f588aa2839ff2308527d754c523e0dbbb4d7d6b73a34c9d1656c5e12d54de7a1fb657c4adec7b2676c6cee5205e16c4eacf7d9cab38574eec0
7
- data.tar.gz: 2bcb867befe00f2d0b4fa7e24e01acd6249406096a1d0630cd242f6802cf40a06e23c3e572a63f6a10357ce122230b2b70e03f3497501cdf8627f9ca825cfbff
6
+ metadata.gz: 20006e01c5ddee8a8a9a6fbe980840bfcc8b94ac65fdae3e0254b82e03fedf915719f20f09cb72ee653cfc2c66b3e87523fffdcb7ea8981a3ebc0fdd71b5698a
7
+ data.tar.gz: 5f745773984fcc7cddf037c0c78847604994252cdf1dec9626683acf63f6da6f3f28e303a2daaecf49ca1bcc96d3e4b14b88522db71d94156a352a82cbe34030
@@ -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.0'
8
+ spec.version = '1.2.1'
9
9
  spec.authors = ['Gregoire Seux']
10
10
  spec.email = ['kamaradclimber@gmail.com']
11
11
  spec.summary = 'Facilitate access to cookbooks changelog'
@@ -180,8 +180,7 @@ class PolicyChangelog
180
180
  output.join("\n")
181
181
  end
182
182
 
183
- # Filters out cookbooks which are not updated, are not used after update or
184
- # are newly added as dependencies during update
183
+ # Filters out cookbooks which are not updated, are not used after update
185
184
  #
186
185
  # @param [Hash] cookbook versions and source url data
187
186
  # @return [true, false]
@@ -215,9 +214,9 @@ class PolicyChangelog
215
214
  # @return [String] formatted version changelog
216
215
  def generate_changelog_from_versions(cookbook_versions)
217
216
  lock_current = read_policyfile_lock(@policyfile_dir)
218
- sources = cookbook_versions.keys.map do |name|
219
- [name, get_source_url(lock_current['cookbook_locks'][name]['source_options'])]
220
- end.to_h
217
+ sources = cookbook_versions.map do |name, data|
218
+ [name, get_source_url(lock_current['cookbook_locks'][name]['source_options'])] if data['current_version']
219
+ end.compact.to_h
221
220
  cookbook_versions.deep_merge(sources).map { |name, data| format_output(name, data) }.join("\n")
222
221
  end
223
222
  end
@@ -279,16 +279,24 @@ RSpec.describe PolicyChangelog do
279
279
  expect(changelog).not_to receive(:update_policyfile_lock)
280
280
 
281
281
  origin_and_target = {
282
- 'users' => { 'current_version' => '4.0.0', 'target_version' => '5.0.0' }
282
+ 'users' => { 'current_version' => '4.0.0', 'target_version' => '5.0.0' },
283
+ 'new_cookbook' => { 'target_version' => '8.0.0' }
283
284
  }
284
285
 
285
286
  allow(changelog).to receive(:git_changelog)
286
287
  .with(instance_of(String), '4.0.0', '5.0.0')
287
288
  .and_return('e1b971a Add test commit message')
288
289
 
289
- output = "\nChangelog for users: 4.0.0->5.0.0\n" \
290
- "==================================\n" \
291
- "e1b971a Add test commit message"
290
+ output = <<~COMMIT.chomp
291
+
292
+ Changelog for users: 4.0.0->5.0.0
293
+ ==================================
294
+ e1b971a Add test commit message
295
+
296
+ Changelog for new_cookbook: ->8.0.0
297
+ ====================================
298
+ Cookbook was not in the Policyfile.lock.json
299
+ COMMIT
292
300
 
293
301
  expect(changelog.generate_changelog_from_versions(origin_and_target)).to eq(output)
294
302
  end
@@ -305,7 +313,7 @@ RSpec.describe PolicyChangelog do
305
313
 
306
314
  output = "\nChangelog for users: 4.0.0->5.3.1\n" \
307
315
  "==================================\n" \
308
- "e1b971a Add test commit message"
316
+ 'e1b971a Add test commit message'
309
317
 
310
318
  expect(changelog.generate_changelog).to eq(output)
311
319
  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.0
4
+ version: 1.2.1
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-16 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler