knife-changelog 1.0.8 → 1.0.9

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: a8c08f818e37b6f6f8dedf0ac339c7f2630eb2274c7d8a2b4972aeb32cb0f33a
4
- data.tar.gz: 8c2201411c66858acdad4549da4a4d72cb9f2b90c157b1b4fa584b597ae4eb9d
3
+ metadata.gz: 252d5d072881aadc96d75fa2e59756ed4c4cc8c8a7b7cf02113ae6bd48f19aca
4
+ data.tar.gz: 0d53698a58d1a881e0062b5dba606d9be724913718e031f9b1d79e18ef1d018f
5
5
  SHA512:
6
- metadata.gz: 3dfadbf13353ae064112f338fd037208318bf875c91007bc59bb366154677bed539066929c1b70c79b1cf572358285234b3eade84345ca09c2bc0c7b6ad8878f
7
- data.tar.gz: f7c58bc018fedc0c91a1a745637036741f7990760d9632a7723c9a04f0286ede092bfa910a1d379e8cefe14f545434ff286d87626e4944d7455d724311ddb7cb
6
+ metadata.gz: 8e3fe30b5b8cd44dca34f2312fad8f9aba9b1dc12569690391771a8d80b755630c089a15079914ed6c74a9b991f42037ec637b813cb5160fdd3741dda02d14fa
7
+ data.tar.gz: 076e3d39b26f3f1301cd398c1c9a3dc464f89426dbbf14adfe262455cba3b943f8983bc8e7727b863e4758db19e86e875ed03333bb7b9ab6488623992a13d9ce
@@ -48,6 +48,12 @@ class Chef
48
48
  description: 'Link to policyfile, defaults to "Policyfile.rb"',
49
49
  default: 'Policyfile.rb'
50
50
 
51
+ option :with_dependencies,
52
+ long: '--with-dependencies',
53
+ description: 'Show changelog for cookbook in Policyfile with dependencies',
54
+ boolean: true,
55
+ default: false
56
+
51
57
  option :update,
52
58
  long: '--update',
53
59
  description: 'Update Berksfile'
@@ -55,7 +61,11 @@ class Chef
55
61
  def run
56
62
  Log.info config
57
63
  if config[:policyfile] && File.exist?(config[:policyfile])
58
- puts PolicyChangelog.new(@name_args, config[:policyfile]).generate_changelog
64
+ puts PolicyChangelog.new(
65
+ @name_args,
66
+ config[:policyfile],
67
+ config[:with_dependencies]
68
+ ).generate_changelog
59
69
  else
60
70
  berksfile = Berkshelf::Berksfile.from_options({})
61
71
  puts KnifeChangelog::Changelog::Berksfile
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Changelog
3
- VERSION = '1.0.8'.freeze
3
+ VERSION = '1.0.9'.freeze
4
4
  end
5
5
  end
@@ -15,10 +15,11 @@ class PolicyChangelog
15
15
  #
16
16
  # @param cookbooks [Array<String>] cookbooks to update (@name_args)
17
17
  # @param policyfile [String] policyfile path
18
- def initialize(cookbooks, policyfile)
18
+ def initialize(cookbooks, policyfile, with_dependencies)
19
19
  @cookbooks_to_update = cookbooks
20
20
  @policyfile_path = File.expand_path(policyfile)
21
21
  @policyfile_dir = File.dirname(@policyfile_path)
22
+ @with_dependencies = with_dependencies
22
23
  end
23
24
 
24
25
  # Updates the Policyfile.lock to get version differences.
@@ -182,11 +183,15 @@ class PolicyChangelog
182
183
  target = versions(lock_target['cookbook_locks'], 'target')
183
184
 
184
185
  updated_cookbooks = current.deep_merge(target).reject { |_name, data| reject_version_filter(data) }
186
+ changelog_cookbooks = if @with_dependencies || @cookbooks_to_update.nil?
187
+ updated_cookbooks
188
+ else
189
+ updated_cookbooks.select { |name, _data| @cookbooks_to_update.include?(name) }
190
+ end
185
191
  sources = {}
186
- updated_cookbooks.each_key do |name|
192
+ changelog_cookbooks.each_key do |name|
187
193
  sources[name] = get_source_url(lock_target['cookbook_locks'][name]['source_options'])
188
194
  end
189
- updated_cookbooks.deep_merge(sources).map { |name, data| format_output(name, data) }.join("\n")
195
+ changelog_cookbooks.deep_merge(sources).map { |name, data| format_output(name, data) }.join("\n")
190
196
  end
191
197
  end
192
-
@@ -13,7 +13,7 @@ RSpec.describe PolicyChangelog do
13
13
  end
14
14
 
15
15
  let(:changelog) do
16
- PolicyChangelog.new('users', File.join(pf_dir, 'Policyfile.rb'))
16
+ PolicyChangelog.new('users', File.join(pf_dir, 'Policyfile.rb'), false)
17
17
  end
18
18
 
19
19
  let(:lock_current) 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.0.8
4
+ version: 1.0.9
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-01-25 00:00:00.000000000 Z
11
+ date: 2018-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler