knife-changelog 0.5.18 → 0.5.20
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 +6 -3
- data/lib/knife/changelog/changelog.rb +12 -3
- data/lib/knife/changelog/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f5cdeee5d1cffb63b524ec79a1bdcfcfb154a74
|
4
|
+
data.tar.gz: e68caccf393dab3d26ce0324b84cc7394fb38744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b79c827c13afa739ebfd008527155a93abf70aef63767802a8ce2ed391432e8127b4f8e2dbb096401757d671eba38d707c13f49fa7b5565781a33156668ff86
|
7
|
+
data.tar.gz: aae9c4b834f21b0d7879c225664aae9203348457456d34fa5f000a7e2aa54225c151d9670b7961297b01d22898e51f323413f63c2511bf5a009c25e36070e08a
|
data/lib/chef/knife/changelog.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require "knife/changelog/version"
|
2
|
-
require "knife/changelog/changelog"
|
3
|
-
require "berkshelf"
|
4
1
|
require 'chef/knife'
|
5
2
|
require 'mixlib/shellout'
|
6
3
|
|
@@ -10,6 +7,12 @@ class Chef
|
|
10
7
|
|
11
8
|
banner 'knife changelog COOKBOOK [COOKBOOK ...]'
|
12
9
|
|
10
|
+
deps do
|
11
|
+
require "knife/changelog/version"
|
12
|
+
require "knife/changelog/changelog"
|
13
|
+
require "berkshelf"
|
14
|
+
end
|
15
|
+
|
13
16
|
def initialize(options)
|
14
17
|
super
|
15
18
|
berksfile = Berkshelf::Berksfile.from_options({})
|
@@ -3,11 +3,11 @@ require 'chef/log'
|
|
3
3
|
require 'chef/knife'
|
4
4
|
require 'rest-client'
|
5
5
|
require 'json'
|
6
|
-
require 'berkshelf'
|
7
6
|
|
8
7
|
class KnifeChangelog
|
9
8
|
class Changelog
|
10
9
|
def initialize(locked_versions, config = {}, sources=[])
|
10
|
+
require 'berkshelf'
|
11
11
|
@tmp_prefix = 'knife-changelog'
|
12
12
|
@locked_versions = locked_versions
|
13
13
|
@config = config
|
@@ -119,13 +119,21 @@ class KnifeChangelog
|
|
119
119
|
end
|
120
120
|
.compact
|
121
121
|
.map { |json| JSON.parse(json) }
|
122
|
+
.sort_by { |ck| cookbook_highest_version(ck) }
|
122
123
|
.map { |ck| ck['source_url'] || ck ['external_url'] }
|
123
|
-
.
|
124
|
+
.last
|
124
125
|
.tap do |source|
|
125
126
|
raise "Cannot find any changelog source for #{name}" unless source
|
126
127
|
end
|
127
128
|
end
|
128
129
|
|
130
|
+
def cookbook_highest_version(json)
|
131
|
+
json['versions']
|
132
|
+
.map { |version_url| Chef::Version.new(version_url.gsub(/.*\//, '')) }
|
133
|
+
.sort
|
134
|
+
.last
|
135
|
+
end
|
136
|
+
|
129
137
|
def handle_source(name, dep)
|
130
138
|
url = get_from_supermarket_sources(name)
|
131
139
|
raise "No source found in supermarket for cookbook '#{name}'" unless url
|
@@ -155,7 +163,7 @@ class KnifeChangelog
|
|
155
163
|
unless revision_exists?(dir, rev)
|
156
164
|
prefixed_rev = 'v' + rev
|
157
165
|
return prefixed_rev if revision_exists?(dir, prefixed_rev)
|
158
|
-
fail "#{rev} is not
|
166
|
+
fail "#{rev} is not an existing revision (#{name}), not a tag/commit/branch name."
|
159
167
|
end
|
160
168
|
rev
|
161
169
|
end
|
@@ -235,6 +243,7 @@ class KnifeChangelog
|
|
235
243
|
end
|
236
244
|
|
237
245
|
def shallow_clone(tmp_prefix, uri)
|
246
|
+
Chef::Log.debug "Cloning #{uri} in #{tmp_prefix}"
|
238
247
|
dir = Dir.mktmpdir(tmp_prefix)
|
239
248
|
@tmp_dirs << dir
|
240
249
|
clone = Mixlib::ShellOut.new("git clone --bare #{uri} bare-clone", :cwd => dir)
|
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: 0.5.
|
4
|
+
version: 0.5.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregoire Seux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.6.13
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Facilitate access to cookbooks changelog
|