class Bellboy::Cli

Simple CLI. Mirrors the Berkshelf options & commands where possible.

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/bellboy/cli.rb, line 24
def initialize(*args)
  super(*args)

  Bellboy.logger = Bellboy::Logger.new(options)

  if @options[:config]
    unless File.exist?(@options[:config])
      raise ConfigNotFound, @options[:config]
    end
      Berkshelf::Config.set_path(@options[:config])
    end
end

Public Instance Methods

install() click to toggle source
# File lib/bellboy/cli.rb, line 80
def install
  berksfile = Bellboy.berks_from_file(options[:berksfile])
  Bellboy::Installer.install(berksfile, options)
end
list() click to toggle source
# File lib/bellboy/cli.rb, line 126
def list
  berksfile = Bellboy.berks_from_file(options[:berksfile])
  databags = Bellboy.list(berksfile)

  if options[:json]
    Bellboy.logger.log databags.to_json
  else
    databags.each do |bag, items|
      Bellboy.logger.log options[:bags] ? bag : "#{bag}:"

      items.each do |item|
        Bellboy.logger.log "\t#{item}"
      end unless options[:bags]
    end
  end

end
upload() click to toggle source
# File lib/bellboy/cli.rb, line 98
def upload
  berksfile = Bellboy.berks_from_file(options[:berksfile])
  Bellboy::Uploader.upload(berksfile, options)
end
version() click to toggle source
# File lib/bellboy/cli.rb, line 59
def version
  berksfile = Bellboy.berks_from_file(options[:berksfile])

  version_options = options.reverse_merge(verbose: false)

  Bellboy::Versioner.version(berksfile, version_options)
end