knife-changelog 1.5.0 → 2.0.0
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/.github/workflows/release.yml +5 -5
- data/Gemfile +2 -0
- data/knife-changelog.gemspec +2 -2
- data/lib/knife/changelog/changelog.rb +3 -3
- data/lib/knife/changelog/git_submodule.rb +18 -0
- data/lib/knife/changelog/policyfile.rb +4 -4
- data/spec/unit/policyfile_spec.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33f9c5c8b0d5cec6a862af4f16c6ba10ad50d0ec63d52c66ae6f78ad57e5edf5
|
4
|
+
data.tar.gz: 9122a7dc32a956d2301799efddbabe6f90f581c3d03b7bf4e9baea94aca7a3ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe30f69038cacfc6da33eb097122daea229c01532a579100c47a21e3f97bd20c449f070164457f82433df42f3bd6bbdfdd76f8425375e9336145d7d64941801
|
7
|
+
data.tar.gz: b568f75c320ba3e6016d1e2cfa72d8d81489e2764c8e8d763c8833aa3681f73bf7085bd3c6d93c14ec3c503f54164c0e62646093e34a8a5961ed2e7f98bace7b
|
@@ -10,9 +10,9 @@ jobs:
|
|
10
10
|
- uses: ruby/setup-ruby@v1
|
11
11
|
with:
|
12
12
|
ruby-version: 2.7
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
- name: Build
|
14
|
+
run: gem build *.gemspec
|
15
|
+
- name: Push on Rubygems
|
16
|
+
run: gem push *.gem
|
17
17
|
env:
|
18
|
-
|
18
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
data/Gemfile
CHANGED
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 = '
|
8
|
+
spec.version = '2.0.0'
|
9
9
|
spec.authors = ['Gregoire Seux']
|
10
10
|
spec.email = ['kamaradclimber@gmail.com']
|
11
11
|
spec.summary = 'Facilitate access to cookbooks changelog'
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_dependency 'berkshelf'
|
28
28
|
spec.add_dependency 'chef'
|
29
|
-
spec.add_dependency 'chef-
|
29
|
+
spec.add_dependency 'chef-cli'
|
30
30
|
spec.add_dependency 'deep_merge'
|
31
31
|
spec.add_dependency 'git'
|
32
32
|
spec.add_dependency 'mixlib-shellout'
|
@@ -18,7 +18,7 @@ class KnifeChangelog
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize(config)
|
21
|
+
def initialize(config = {})
|
22
22
|
@tmp_prefix = 'knife-changelog'
|
23
23
|
@config = config
|
24
24
|
@tmp_dirs = []
|
@@ -177,7 +177,7 @@ class KnifeChangelog
|
|
177
177
|
if !url.end_with?('.git')
|
178
178
|
url = "#{url}.git"
|
179
179
|
end
|
180
|
-
location = Location.new(url, guess_version_for(name), '
|
180
|
+
location = Location.new(url, guess_version_for(name), 'HEAD')
|
181
181
|
handle_git(name, location)
|
182
182
|
end
|
183
183
|
|
@@ -200,7 +200,7 @@ class KnifeChangelog
|
|
200
200
|
subm_revision.error!
|
201
201
|
revision = subm_revision.stdout.strip.split(' ').first
|
202
202
|
revision.gsub!(/^\+/, '')
|
203
|
-
loc = Location.new(url, revision, '
|
203
|
+
loc = Location.new(url, revision, 'HEAD')
|
204
204
|
handle_git(name, loc)
|
205
205
|
end
|
206
206
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'chef/log'
|
3
|
+
require_relative 'changelog'
|
4
|
+
|
5
|
+
class KnifeChangelog
|
6
|
+
class GitSubmodule < Changelog
|
7
|
+
|
8
|
+
def run(submodules)
|
9
|
+
raise ::ArgumentError, "Submodules must be an Array instead of #{submodules.inspect}" unless submodules.is_a?(::Array)
|
10
|
+
submodules.map do |submodule|
|
11
|
+
Chef::Log.debug "Checking changelog for #{submodule} (submodule)"
|
12
|
+
format_changelog(submodule, *handle_submodule(submodule))
|
13
|
+
end.compact.join("\n")
|
14
|
+
ensure
|
15
|
+
clean
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'chef'
|
4
4
|
require 'chef/knife'
|
5
|
-
require 'chef-
|
6
|
-
require 'chef-
|
5
|
+
require 'chef-cli/command/update'
|
6
|
+
require 'chef-cli/command/install'
|
7
7
|
require 'deep_merge'
|
8
8
|
require 'git'
|
9
9
|
require 'json'
|
@@ -32,9 +32,9 @@ class PolicyChangelog
|
|
32
32
|
def update_policyfile_lock
|
33
33
|
backup_dir = Dir.mktmpdir
|
34
34
|
FileUtils.cp(File.join(@policyfile_dir, 'Policyfile.lock.json'), backup_dir)
|
35
|
-
installer =
|
35
|
+
installer = ChefCLI::Command::Install.new
|
36
36
|
raise "Cannot install Policyfile lock #{@policyfile_path}" unless installer.run([@policyfile_relative_path]).zero?
|
37
|
-
updater =
|
37
|
+
updater = ChefCLI::Command::Update.new
|
38
38
|
raise "Error updating Policyfile lock #{@policyfile_path}" unless updater.run([@policyfile_path, @cookbooks_to_update].flatten).zero?
|
39
39
|
updated_policyfile_lock = read_policyfile_lock(@policyfile_dir)
|
40
40
|
FileUtils.cp(File.join(backup_dir, 'Policyfile.lock.json'), @policyfile_dir)
|
@@ -347,7 +347,7 @@ RSpec.describe PolicyChangelog do
|
|
347
347
|
expect(changelog.generate_changelog).to eq(output)
|
348
348
|
end
|
349
349
|
it 'raises an exception' do
|
350
|
-
allow(
|
350
|
+
allow(ChefCLI::Command::Update).to receive(:new).and_return(fake_update)
|
351
351
|
allow(fake_update).to receive(:run).and_return(1)
|
352
352
|
allow(changelog).to receive(:git_changelog)
|
353
353
|
.and_return('e1b971a Add test commit message')
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Seux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: chef-
|
112
|
+
name: chef-cli
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- lib/knife/changelog/berksfile.rb
|
199
199
|
- lib/knife/changelog/changelog.rb
|
200
200
|
- lib/knife/changelog/git.rb
|
201
|
+
- lib/knife/changelog/git_submodule.rb
|
201
202
|
- lib/knife/changelog/policyfile.rb
|
202
203
|
- resources/Berksfile
|
203
204
|
- resources/Berksfile.lock
|