knife-changelog 0.4.3 → 0.4.4.pre.alpha.pre.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 977ff15279958b3f05a7ade051b8be03d50527bd
4
- data.tar.gz: 08d9897b4706652a017c710ff0d9ae91c9d58e88
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGUxNjMxODQxN2Y3Yzc1NmEyZDUwYjM0ZmE3MjcyNjgxN2U3OWVkMA==
5
+ data.tar.gz: !binary |-
6
+ YTQxMmQ4Mjc0ZmVlODU2ODc5M2M5MjZlNzM0ODUwM2UwNTMyYzc4Yw==
5
7
  SHA512:
6
- metadata.gz: c869479e6fc85b469a4cd301f33f73998365806bbc579e8b8d42777eb07b5ef6597387fdec1e4595ff922e1cc02a69cac34a278a8b8f4f0bd65584797160f665
7
- data.tar.gz: 3c37a498b2b9ea67b9e732d9ff6f3cb4d4ab6e3ad0adb48f94580ddf8425573a581931d7025d0d7e06440975d519900fd6624402579c781364425c66eb122ca0
8
+ metadata.gz: !binary |-
9
+ NWMxNWEzZGUwZDA5NmQyMmZmMjk0YWUyYjk5OGI1OTc2MjM4YjQ2ZjU3YjZh
10
+ NWFiMDZiZDk3YWYzNDJhZTI2NjNkZGQ0MGJlODMwYWE2N2E4MGI4MTI3NTk2
11
+ NzFkMmQ2ODQ3MWU4MWU3N2VjMTczYTE0NjQzYjllODY1MTc1YjM=
12
+ data.tar.gz: !binary |-
13
+ ODJiMjYxNTJhMDRjNTI3OTAyZDMwMDhkMTg4MTU1MWRmMTczZGQyNWZiNjAy
14
+ Mjk1N2EwZTIyZWE1OTA3MTc4ZmU3ZTE3MmRmNDFmZGQwYTQyMDY0OThhMTFj
15
+ MmU5YmZlZjkwMWE5Y2VjMzlmMWU3ZjBlMTE0ODE3NGU5Y2QzMjA=
@@ -13,7 +13,7 @@ class Chef
13
13
  def initialize(options)
14
14
  super
15
15
  berksfile = Berkshelf::Berksfile.from_options({})
16
- @changelog = KnifeChangelog::Changelog.new(berksfile.lockfile.locks, config)
16
+ @changelog = KnifeChangelog::Changelog.new(berksfile.lockfile.locks, config, berksfile.sources)
17
17
  end
18
18
 
19
19
  option :linkify,
@@ -2,14 +2,19 @@ require 'chef/log'
2
2
  require 'chef/knife'
3
3
  require 'rest-client'
4
4
  require 'json'
5
+ require 'berkshelf'
5
6
 
6
7
  class KnifeChangelog
7
8
  class Changelog
8
- def initialize(locked_versions, config = {})
9
+ def initialize(locked_versions, config = {}, sources=[])
9
10
  @tmp_prefix = 'knife-changelog'
10
11
  @locked_versions = locked_versions
11
12
  @config = config
12
13
  @tmp_dirs = []
14
+ @sources = sources
15
+ if sources.empty? # preserve api compat
16
+ @sources = [ Berkshelf::Source.new("https://supermarket.chef.io") ]
17
+ end
13
18
  end
14
19
 
15
20
  def run(cookbooks)
@@ -91,14 +96,33 @@ class KnifeChangelog
91
96
  end
92
97
  end
93
98
 
99
+ def get_from_supermarket_sources(name)
100
+ urls = @sources.map { |s|
101
+ begin
102
+ RestClient.get "#{s.uri}/api/v1/cookbooks/#{name}"
103
+ rescue
104
+ nil
105
+ end
106
+ }.compact.map do |json|
107
+ ck = JSON.parse(json)
108
+ ck['source_url'] || ck ['external_url']
109
+ end.uniq
110
+ case urls.size
111
+ when 0
112
+ Chef::Log.warn "No external url for #{name}"
113
+ raise "Canot find any changelog source for #{name}"
114
+ when 1
115
+ urls.first
116
+ else
117
+ Chef::Log.warn "#{name} has different urls on various sources ??"
118
+ raise "Cannot decide which source to choose for #{name}"
119
+ end
120
+ end
121
+
94
122
  def handle_source(name, dep)
95
- ck = JSON.parse(RestClient.get "https://supermarket.getchef.com/api/v1/cookbooks/#{name}")
96
- url = ck['source_url'] || ck ['external_url']
123
+ url = get_from_supermarket_sources(name)
97
124
  Chef::Log.debug("Using #{url} as source url")
98
125
  case url.strip
99
- when nil,""
100
- Chef::Log.warn "No external url for #{name}, can't find any changelog source"
101
- ""
102
126
  when /github.com\/(.*)(.git)?/
103
127
  url = "https://github.com/#{$1.chomp('/')}.git"
104
128
  options = {
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Changelog
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4.pre.alpha.pre.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-24 00:00:00.000000000 Z
11
+ date: 2015-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: berkshelf
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rest-client
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mixlib-shellout
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ! '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: chef
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '11.16'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '11.16'
111
111
  description: ''
@@ -115,8 +115,8 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".gitignore"
119
- - ".travis.yml"
118
+ - .gitignore
119
+ - .travis.yml
120
120
  - Gemfile
121
121
  - LICENSE.txt
122
122
  - README.md
@@ -137,14 +137,14 @@ require_paths:
137
137
  - lib
138
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - ">="
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - ">="
145
+ - - ! '>'
146
146
  - !ruby/object:Gem::Version
147
- version: '0'
147
+ version: 1.3.1
148
148
  requirements: []
149
149
  rubyforge_project:
150
150
  rubygems_version: 2.4.5