Class: Berkshelf::HumanFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Berkshelf::HumanFormatter
- Defined in:
- lib/berkshelf/formatters/human.rb
Instance Method Summary collapse
-
#deprecation(message) ⇒ Object
Output a deprecation warning.
-
#error(message) ⇒ Object
Output an error message using ui.
- #fetch(dependency) ⇒ Object
-
#info(cookbook) ⇒ Object
Output the important information about a cookbook using ui.
-
#install(source, cookbook) ⇒ Object
Output a Cookbook installation message using ui.
-
#list(dependencies) ⇒ Object
Output a list of cookbooks using ui.
-
#msg(message) ⇒ Object
Output a generic message using ui.
-
#outdated(hash) ⇒ Object
Output a list of outdated cookbooks and the most recent version using ui.
-
#package(destination) ⇒ Object
Output a Cookbook package message using ui.
-
#search(results) ⇒ Object
Ouput Cookbook search results using ui.
-
#show(cookbook) ⇒ Object
Output Cookbook path using ui.
-
#skipping(cookbook, conn) ⇒ Object
Output a Cookbook skip message using ui.
-
#uploaded(cookbook, conn) ⇒ Object
Output a Cookbook upload message using ui.
-
#use(dependency) ⇒ Object
Output a Cookbook use message using ui.
-
#vendor(cookbook, destination) ⇒ Object
Output Cookbook vendor info message using ui.
-
#version ⇒ Object
Output the version of Berkshelf.
-
#warn(message) ⇒ Object
Output a warning message using ui.
Methods inherited from BaseFormatter
#cleanup_hook, formatter_method
Instance Method Details
#deprecation(message) ⇒ Object
Output a deprecation warning
149 150 151 |
# File 'lib/berkshelf/formatters/human.rb', line 149 def deprecation() Berkshelf.ui.info "DEPRECATED: #{}" end |
#error(message) ⇒ Object
Output an error message using Berkshelf.ui
135 136 137 |
# File 'lib/berkshelf/formatters/human.rb', line 135 def error() Berkshelf.ui.error end |
#fetch(dependency) ⇒ Object
9 10 11 |
# File 'lib/berkshelf/formatters/human.rb', line 9 def fetch(dependency) Berkshelf.ui.info "Fetching '#{dependency.name}' from #{dependency.location}" end |
#info(cookbook) ⇒ Object
Output the important information about a cookbook using Berkshelf.ui.
83 84 85 |
# File 'lib/berkshelf/formatters/human.rb', line 83 def info(cookbook) Berkshelf.ui.info(cookbook.pretty_print) end |
#install(source, cookbook) ⇒ Object
Output a Cookbook installation message using Berkshelf.ui
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/berkshelf/formatters/human.rb', line 19 def install(source, cookbook) = "Installing #{cookbook.name} (#{cookbook.version})" unless source.default? << " from #{source}" << " ([#{cookbook.location_type}] #{cookbook.location_path})" end Berkshelf.ui.info() end |
#list(dependencies) ⇒ Object
Output a list of cookbooks using Berkshelf.ui
90 91 92 93 94 95 96 97 |
# File 'lib/berkshelf/formatters/human.rb', line 90 def list(dependencies) Berkshelf.ui.info "Cookbooks installed by your Berksfile:" dependencies.each do |dependency| out = " * #{dependency}" out << " from #{dependency.location}" if dependency.location Berkshelf.ui.info(out) end end |
#msg(message) ⇒ Object
Output a generic message using Berkshelf.ui
128 129 130 |
# File 'lib/berkshelf/formatters/human.rb', line 128 def msg() Berkshelf.ui.info end |
#outdated(hash) ⇒ Object
Output a list of outdated cookbooks and the most recent version using Berkshelf.ui
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/berkshelf/formatters/human.rb', line 61 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}]" end Berkshelf.ui.info string end end end |
#package(destination) ⇒ Object
Output a Cookbook package message using Berkshelf.ui
76 77 78 |
# File 'lib/berkshelf/formatters/human.rb', line 76 def package(destination) Berkshelf.ui.info "Cookbook(s) packaged to #{destination}" end |
#search(results) ⇒ Object
Ouput Cookbook search results using Berkshelf.ui
102 103 104 105 106 |
# File 'lib/berkshelf/formatters/human.rb', line 102 def search(results) results.sort_by(&:name).each do |remote_cookbook| Berkshelf.ui.info "#{remote_cookbook.name} (#{remote_cookbook.version})" end end |
#show(cookbook) ⇒ Object
Output Cookbook path using Berkshelf.ui
111 112 113 114 |
# File 'lib/berkshelf/formatters/human.rb', line 111 def show(cookbook) path = File.(cookbook.path) Berkshelf.ui.info(path) end |
#skipping(cookbook, conn) ⇒ Object
Output a Cookbook skip message using Berkshelf.ui
51 52 53 |
# File 'lib/berkshelf/formatters/human.rb', line 51 def skipping(cookbook, conn) Berkshelf.ui.info "Skipping #{cookbook.cookbook_name} (#{cookbook.version}) (frozen)" end |
#uploaded(cookbook, conn) ⇒ Object
Output a Cookbook upload message using Berkshelf.ui
43 44 45 |
# File 'lib/berkshelf/formatters/human.rb', line 43 def uploaded(cookbook, conn) Berkshelf.ui.info "Uploaded #{cookbook.cookbook_name} (#{cookbook.version}) to: '#{conn.server_url}'" end |
#use(dependency) ⇒ Object
Output a Cookbook use message using Berkshelf.ui
33 34 35 36 37 |
# File 'lib/berkshelf/formatters/human.rb', line 33 def use(dependency) = "Using #{dependency.name} (#{dependency.locked_version})" << " from #{dependency.location}" if dependency.location Berkshelf.ui.info() end |
#vendor(cookbook, destination) ⇒ Object
Output Cookbook vendor info message using Berkshelf.ui
120 121 122 123 |
# File 'lib/berkshelf/formatters/human.rb', line 120 def vendor(cookbook, destination) cookbook_destination = File.join(destination, cookbook.cookbook_name) Berkshelf.ui.info "Vendoring #{cookbook.cookbook_name} (#{cookbook.version}) to #{cookbook_destination}" end |
#version ⇒ Object
Output the version of Berkshelf
4 5 6 |
# File 'lib/berkshelf/formatters/human.rb', line 4 def version Berkshelf.ui.info Berkshelf::VERSION end |
#warn(message) ⇒ Object
Output a warning message using Berkshelf.ui
142 143 144 |
# File 'lib/berkshelf/formatters/human.rb', line 142 def warn() Berkshelf.ui.warn end |