lib/berkshelf/formatters/human.rb in berkshelf-3.1.0 vs lib/berkshelf/formatters/human.rb in berkshelf-3.1.1
- old
+ new
@@ -57,16 +57,24 @@
#
# @param [Hash] hash
# the list of outdated cookbooks in the format
# { 'cookbook' => { 'api.berkshelf.com' => #<Cookbook> } }
def outdated(hash)
- hash.keys.each do |name|
- hash[name].each do |source, newest|
- string = " * #{newest.name} (#{newest.version})"
- unless source == Berksfile::DEFAULT_API_URL
- string << " [#{source}]"
+ if hash.empty?
+ Berkshelf.ui.info('All cookbooks up to date!')
+ else
+ Berkshelf.ui.info('The following cookbooks have newer versions:')
+
+ hash.each do |name, info|
+ info['remote'].each do |remote_source, remote_version|
+ out = " * #{name} (#{info['local']} => #{remote_version})"
+
+ unless remote_source.default?
+ out << " [#{remote_source.uri}]"
+ end
+
+ Berkshelf.ui.info(out)
end
- Berkshelf.ui.info string
end
end
end
# Output a Cookbook package message using {Berkshelf.ui}