berkshelf 3.1.0 → 3.1.1

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: fe531a8a2654076d566b236313b3eeef9c1d6d8b
4
- data.tar.gz: c5560108ebd912946fdf1f7a55649f85705f71f3
3
+ metadata.gz: d4cf647b41dbb16847bda378125caeca33f742be
4
+ data.tar.gz: 09fde5aa92aa7142ed6654d67c707877e136efd0
5
5
  SHA512:
6
- metadata.gz: bb3799a95ad74f30e1996c3a69c045038e9e0d64d695eff4d0f00c7ac074a1b5bdee0515c2072337a1dfbf21d7c4c884c5adcdc414d4b30c7417cb04276a873a
7
- data.tar.gz: b746da2921496bee4d25b1ef2cebd088ab755e5860370e2df8c8df3ed5a3606833b261a457ebe595ffd7b49252665f284b558cef109f9276050dbb1aaf2519bc
6
+ metadata.gz: 6dedd78fd2dc5890ceb8cb7319e84d91a1203f00fd698c8a77712dba2bf044026649ab814909a7f684f0defaf60054f70f5577322e866d918694f6971e232cdc
7
+ data.tar.gz: 82e54f6a02f0c0e6d5b7f5f63c84e09864b8d9ea2e9d12f08460cb2ccfcd5c769d1807bf6f91f377d9f7ce4bee1c7baf6f314d253fe0e002901131ae0923f231
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 3.1.1
2
+
3
+ * Bug Fixes
4
+ * Fix issue reading metadata which was compiled using an older (bugged) version of Knife
5
+ * Fix issue with incorrectly reporting outdated cookbooks with the outdated command
6
+ * Fix issue uploading some cookbooks which were generated with older metadata
7
+
1
8
  # 3.1.0
2
9
 
3
10
  * Enhancements
data/berkshelf.gemspec CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_dependency 'faraday', '~> 0.9.0'
39
39
  s.add_dependency 'minitar', '~> 0.5.4'
40
40
  s.add_dependency 'retryable', '~> 1.3.3'
41
- s.add_dependency 'ridley', '~> 3.0'
41
+ s.add_dependency 'ridley', '~> 3.1'
42
42
  s.add_dependency 'solve', '~> 1.1'
43
43
  s.add_dependency 'thor', '~> 0.18'
44
44
  s.add_dependency 'octokit', '~> 3.0'
@@ -48,7 +48,7 @@ Feature: berks outdated
48
48
  Then the output should contain:
49
49
  """
50
50
  The following cookbooks have newer versions:
51
- * bacon (1.1.0)
51
+ * bacon (1.0.0 => 1.1.0)
52
52
  """
53
53
 
54
54
  Scenario: the dependency has a version constraint and there are new items that satisfy it
@@ -75,7 +75,7 @@ Feature: berks outdated
75
75
  Then the output should contain:
76
76
  """
77
77
  The following cookbooks have newer versions:
78
- * bacon (1.5.8)
78
+ * bacon (1.0.0 => 1.5.8)
79
79
  """
80
80
 
81
81
  Scenario: When the lockfile is not present
@@ -147,20 +147,15 @@ Feature: --format json
147
147
  {
148
148
  "cookbooks": [
149
149
  {
150
- "version": "0.2.9",
151
- "sources": {
152
- "http://0.0.0.0:26210": {
153
- "name": "seth",
154
- "version": "0.2.9"
155
- }
150
+ "local": "0.1.0",
151
+ "remote": {
152
+ "http://0.0.0.0:26210": "0.2.9"
156
153
  },
157
154
  "name": "seth"
158
155
  }
159
156
  ],
160
157
  "errors": [],
161
- "messages": [
162
- "The following cookbooks have newer versions:"
163
- ],
158
+ "messages": [],
164
159
  "warnings": []
165
160
  }
166
161
  """
@@ -435,12 +435,19 @@ module Berkshelf
435
435
  # that satisfies the constraints of your dependencies.
436
436
  #
437
437
  # @return [Hash]
438
- # a hash of cached cookbooks and their latest version. An empty hash is
439
- # returned if there are no newer cookbooks for any of your dependencies
438
+ # a hash of cached cookbooks and their latest version grouped by their
439
+ # remote API source. The hash will be empty if there are no newer
440
+ # cookbooks for any of your dependencies (that still satisfy the given)
441
+ # constraints in the +Berksfile+.
440
442
  #
441
443
  # @example
442
444
  # berksfile.outdated #=> {
443
- # #<CachedCookbook name="artifact"> => "0.11.2"
445
+ # "nginx" => {
446
+ # "local" => #<Version 1.8.0>,
447
+ # "remote" => {
448
+ # #<Source uri: "https://api.berkshelf.com"> #=> #<Version 2.6.2>
449
+ # }
450
+ # }
444
451
  # }
445
452
  def outdated(*names)
446
453
  validate_lockfile_present!
@@ -448,25 +455,22 @@ module Berkshelf
448
455
  validate_dependencies_installed!
449
456
  validate_cookbook_names!(names)
450
457
 
451
- # Calculate the list of cookbooks to unlock
452
- if names.empty?
453
- list = dependencies
454
- else
455
- list = dependencies.select { |dependency| names.include?(dependency.name) }
456
- end
457
-
458
458
  lockfile.graph.locks.inject({}) do |hash, (name, dependency)|
459
459
  sources.each do |source|
460
460
  cookbooks = source.versions(name)
461
461
 
462
462
  latest = cookbooks.select do |cookbook|
463
463
  dependency.version_constraint.satisfies?(cookbook.version) &&
464
- cookbook.version.to_s != dependency.locked_version.to_s
464
+ Semverse::Version.coerce(cookbook.version) > dependency.locked_version
465
465
  end.sort_by { |cookbook| cookbook.version }.last
466
466
 
467
467
  unless latest.nil?
468
- hash[name] ||= {}
469
- hash[name][source.uri.to_s] = latest
468
+ hash[name] ||= {
469
+ 'local' => dependency.locked_version,
470
+ 'remote' => {
471
+ source => Semverse::Version.coerce(latest.version)
472
+ }
473
+ }
470
474
  end
471
475
  end
472
476
 
data/lib/berkshelf/cli.rb CHANGED
@@ -248,13 +248,6 @@ module Berkshelf
248
248
  def outdated(*names)
249
249
  berksfile = Berksfile.from_options(options)
250
250
  outdated = berksfile.outdated(*names)
251
-
252
- if outdated.empty?
253
- Berkshelf.formatter.msg "All cookbooks up to date!"
254
- else
255
- Berkshelf.formatter.msg "The following cookbooks have newer versions:"
256
- end
257
-
258
251
  Berkshelf.formatter.outdated(outdated)
259
252
  end
260
253
 
@@ -59,13 +59,21 @@ module Berkshelf
59
59
  # the list of outdated cookbooks in the format
60
60
  # { 'cookbook' => { 'api.berkshelf.com' => #<Cookbook> } }
61
61
  def outdated(hash)
62
- hash.keys.each do |name|
63
- hash[name].each do |source, newest|
64
- string = " * #{newest.name} (#{newest.version})"
65
- unless source == Berksfile::DEFAULT_API_URL
66
- string << " [#{source}]"
62
+ if hash.empty?
63
+ Berkshelf.ui.info('All cookbooks up to date!')
64
+ else
65
+ Berkshelf.ui.info('The following cookbooks have newer versions:')
66
+
67
+ hash.each do |name, info|
68
+ info['remote'].each do |remote_source, remote_version|
69
+ out = " * #{name} (#{info['local']} => #{remote_version})"
70
+
71
+ unless remote_source.default?
72
+ out << " [#{remote_source.uri}]"
73
+ end
74
+
75
+ Berkshelf.ui.info(out)
67
76
  end
68
- Berkshelf.ui.info string
69
77
  end
70
78
  end
71
79
  end
@@ -91,12 +91,14 @@ module Berkshelf
91
91
  # the list of outdated cookbooks in the format
92
92
  # { 'cookbook' => { 'api.berkshelf.com' => #<Cookbook> } }
93
93
  def outdated(hash)
94
- hash.keys.each do |name|
95
- hash[name].each do |source, cookbook|
94
+ hash.each do |name, info|
95
+ info['remote'].each do |remote_source, remote_version|
96
+ source = remote_source.uri.to_s
97
+
96
98
  cookbooks[name] ||= {}
97
- cookbooks[name][:version] = cookbook.version
98
- cookbooks[name][:sources] ||= {}
99
- cookbooks[name][:sources][source] = cookbook
99
+ cookbooks[name][:local] = info['local'].to_s
100
+ cookbooks[name][:remote] ||= {}
101
+ cookbooks[name][:remote][source] = remote_version.to_s
100
102
  end
101
103
  end
102
104
  end
@@ -83,6 +83,14 @@ module Berkshelf
83
83
  "#{uri}"
84
84
  end
85
85
 
86
+ def inspect
87
+ "#<#{self.class.name} uri: #{@uri.to_s.inspect}>"
88
+ end
89
+
90
+ def hash
91
+ @uri.host.hash
92
+ end
93
+
86
94
  def ==(other)
87
95
  return false unless other.is_a?(self.class)
88
96
  uri == other.uri
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-19 00:00:00.000000000 Z
15
+ date: 2014-04-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: addressable
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - "~>"
134
134
  - !ruby/object:Gem::Version
135
- version: '3.0'
135
+ version: '3.1'
136
136
  type: :runtime
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: '3.0'
142
+ version: '3.1'
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: solve
145
145
  requirement: !ruby/object:Gem::Requirement