knife-changelog 0.5.12 → 0.5.13

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
  SHA1:
3
- metadata.gz: 4db0a14ad875a0ce750e8a164dc653d0c69106f0
4
- data.tar.gz: 89ac6ff0198885032a98348c66be0a02f1d382d0
3
+ metadata.gz: 42b8ebdc6c1d371430a8d3c9d9623fd42a5e24f3
4
+ data.tar.gz: c09025a1ea5804c850431e08fb7a221d3f4dad4c
5
5
  SHA512:
6
- metadata.gz: f095d41491b4f345aad31678dc0f792f40793c2eab9d26e7f9a2e1f5b6a7c0faed44b06b903cc5db68b76ca37e55cdca4a65ff856eb6a40c4780d6e137b9affa
7
- data.tar.gz: 20a9f8de4ce407d1a319becb01332388ce44cbda6de4111c141744d599865bbc4b730aecff3d95aa4e84b7fefb2610644e5ac176ad09a757d73c66709af1c782
6
+ metadata.gz: 4bdf31349f11854ddad60c1deeb1c28c091ebc055b22c530bd2aceddcf63aa56176ca224f39de0633b8c40ae7531235c789cc7822ce6b00ab0e2903c18cec111
7
+ data.tar.gz: 11731016efb77bd4645c34bfc614cd97e6e84b016ddaf1a444ebc20397fc6a2432adc65608326eddb7b077e363a85f29df47b10beedd8e92276dce1044fc018a
@@ -105,7 +105,7 @@ class KnifeChangelog
105
105
  end
106
106
 
107
107
  def get_from_supermarket_sources(name)
108
- urls = @sources.map { |s|
108
+ @sources.map do |s|
109
109
  begin
110
110
  RestClient::Request.execute(
111
111
  url: "#{s.uri}/api/v1/cookbooks/#{name}",
@@ -115,20 +115,15 @@ class KnifeChangelog
115
115
  rescue
116
116
  nil
117
117
  end
118
- }.compact.map do |json|
119
- ck = JSON.parse(json)
120
- ck['source_url'] || ck ['external_url']
121
- end.uniq
122
- case urls.size
123
- when 0
124
- Chef::Log.warn "No external url for #{name}"
125
- raise "Canot find any changelog source for #{name}"
126
- when 1
127
- urls.first
128
- else
129
- Chef::Log.warn "#{name} has different urls on various sources ??"
130
- raise "Cannot decide which source to choose for #{name}"
131
118
  end
119
+ .compact
120
+ .map { |json| JSON.parse(json) }
121
+ .sort_by { |ck| Gem::Version.new(ck['latest_version'].split('/').last) }
122
+ .map { |ck| ck['source_url'] || ck ['external_url'] }
123
+ .last
124
+ .tap do |source|
125
+ raise "Canot find any changelog source for #{name}" unless source
126
+ end
132
127
  end
133
128
 
134
129
  def handle_source(name, dep)
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Changelog
3
- VERSION = "0.5.12"
3
+ VERSION = "0.5.13"
4
4
  end
5
5
  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: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler