Class: Berkshelf::Formatters::HumanReadable

Inherits:
Object
  • Object
show all
Includes:
AbstractFormatter
Defined in:
lib/berkshelf/formatters/human_readable.rb

Instance Method Summary collapse

Methods included from AbstractFormatter

#cleanup_hook

Instance Method Details

#deprecation(message) ⇒ Object

Output a deprecation warning

Parameters:



74
75
76
# File 'lib/berkshelf/formatters/human_readable.rb', line 74

def deprecation(message)
  Berkshelf.ui.info "DEPRECATED: #{message}"
end

#error(message) ⇒ Object

Output an error message using Berkshelf.ui

Parameters:



67
68
69
# File 'lib/berkshelf/formatters/human_readable.rb', line 67

def error(message)
  Berkshelf.ui.error message
end

#install(cookbook, version, location) ⇒ Object

Output a Cookbook installation message using Berkshelf.ui

Parameters:



13
14
15
# File 'lib/berkshelf/formatters/human_readable.rb', line 13

def install(cookbook, version, location)
  Berkshelf.ui.info "Installing #{cookbook} (#{version}) from #{location}"
end

#msg(message) ⇒ Object

Output a generic message using Berkshelf.ui

Parameters:



60
61
62
# File 'lib/berkshelf/formatters/human_readable.rb', line 60

def msg(message)
  Berkshelf.ui.info message
end

#package(cookbook, destination) ⇒ Object

Output a Cookbook package message using Berkshelf.ui

Parameters:



46
47
48
# File 'lib/berkshelf/formatters/human_readable.rb', line 46

def package(cookbook, destination)
  Berkshelf.ui.info "Cookbook(s) packaged to #{destination}!"
end

#show(cookbook) ⇒ Object

Output Cookbook info message using Berkshelf.ui

Parameters:



53
54
55
# File 'lib/berkshelf/formatters/human_readable.rb', line 53

def show(cookbook)
  Berkshelf.ui.info(cookbook.pretty_print)
end

#upload(cookbook, version, chef_api_url) ⇒ Object

Output a Cookbook upload message using Berkshelf.ui

Parameters:



38
39
40
# File 'lib/berkshelf/formatters/human_readable.rb', line 38

def upload(cookbook, version, chef_api_url)
  Berkshelf.ui.info "Uploading #{cookbook} (#{version}) to: '#{chef_api_url}'"
end

#use(cookbook, version, location = nil) ⇒ Object

Output a Cookbook use message using Berkshelf.ui

Parameters:



22
23
24
25
26
27
28
29
30
31
# File 'lib/berkshelf/formatters/human_readable.rb', line 22

def use(cookbook, version, location = nil)
  message = "Using #{cookbook} (#{version})"

  if location.is_a?(PathLocation)
    message << ' from metadata' if location.metadata?
    message << " at '#{location.relative_path}'" unless location.relative_path == '.'
  end

  Berkshelf.ui.info message
end