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 +4 -4
- data/lib/chef/knife/changelog.rb +11 -1
- data/lib/knife/changelog/version.rb +1 -1
- data/lib/policyfile.rb +9 -4
- data/spec/unit/policyfile_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 252d5d072881aadc96d75fa2e59756ed4c4cc8c8a7b7cf02113ae6bd48f19aca
|
4
|
+
data.tar.gz: 0d53698a58d1a881e0062b5dba606d9be724913718e031f9b1d79e18ef1d018f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e3fe30b5b8cd44dca34f2312fad8f9aba9b1dc12569690391771a8d80b755630c089a15079914ed6c74a9b991f42037ec637b813cb5160fdd3741dda02d14fa
|
7
|
+
data.tar.gz: 076e3d39b26f3f1301cd398c1c9a3dc464f89426dbbf14adfe262455cba3b943f8983bc8e7727b863e4758db19e86e875ed03333bb7b9ab6488623992a13d9ce
|
data/lib/chef/knife/changelog.rb
CHANGED
@@ -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(
|
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
|
data/lib/policyfile.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
195
|
+
changelog_cookbooks.deep_merge(sources).map { |name, data| format_output(name, data) }.join("\n")
|
190
196
|
end
|
191
197
|
end
|
192
|
-
|
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.
|
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-
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|