class Monolith::Formatter

Attributes

debug[RW]
quiet[RW]

Public Class Methods

new() click to toggle source
# File lib/monolith/formatter.rb, line 6
def initialize
  @quiet = false
  @debug = false
  @base_path = Pathname.new(Dir.pwd)
end

Public Instance Methods

clean(cookbook, destination) click to toggle source
# File lib/monolith/formatter.rb, line 20
def clean(cookbook, destination)
  msg "Removing #{cookbook.cookbook_name} from #{rel_dir(destination)}"
end
error(msg) click to toggle source
# File lib/monolith/formatter.rb, line 42
def error(msg)
  STDERR.puts msg
end
install(cookbook, destination) click to toggle source
# File lib/monolith/formatter.rb, line 12
def install(cookbook, destination)
  msg "Installing #{cookbook.cookbook_name} to #{rel_dir(destination)}"
end
msg(msg) click to toggle source
# File lib/monolith/formatter.rb, line 38
def msg(msg)
  puts msg unless @quiet
end
rel_dir(dir) click to toggle source
# File lib/monolith/formatter.rb, line 46
def rel_dir(dir)
  return Pathname.new(dir).relative_path_from(@base_path)
end
skip(cookbook, reason) click to toggle source
# File lib/monolith/formatter.rb, line 24
def skip(cookbook, reason)
  msg "Skipping #{cookbook.cookbook_name} (#{reason})"
end
unsupported_location(cookbook, dep) click to toggle source
# File lib/monolith/formatter.rb, line 28
def unsupported_location(cookbook, dep)
  loctype = dep.location.class.name.split('::')[-1]
  msg "Unsupported location type #{loctype} for cookbook " \
    "#{cookbook.cookbook_name}. Skipping."
end
update(cookbook, destination) click to toggle source
# File lib/monolith/formatter.rb, line 16
def update(cookbook, destination)
  msg "Updating #{cookbook.cookbook_name} at #{rel_dir(destination)}"
end