Class: Bellboy::Cli
- Inherits:
-
Thor
- Object
- Thor
- Bellboy::Cli
- Defined in:
- lib/bellboy/cli.rb
Overview
Simple CLI. Mirrors the Berkshelf options & commands where possible.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Cli
constructor
A new instance of Cli.
- #install ⇒ Object
- #list ⇒ Object
- #upload ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(*args) ⇒ Cli
Returns a new instance of Cli.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bellboy/cli.rb', line 24 def initialize(*args) super(*args) Bellboy.logger = Bellboy::Logger.new() if @options[:config] unless File.exist?(@options[:config]) raise ConfigNotFound, @options[:config] end Berkshelf::Config.set_path(@options[:config]) end end |
Instance Method Details
#install ⇒ Object
80 81 82 83 |
# File 'lib/bellboy/cli.rb', line 80 def install berksfile = Bellboy.berks_from_file([:berksfile]) Bellboy::Installer.install(berksfile, ) end |
#list ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/bellboy/cli.rb', line 126 def list berksfile = Bellboy.berks_from_file([:berksfile]) databags = Bellboy.list(berksfile) if [:json] Bellboy.logger.log databags.to_json else databags.each do |bag, items| Bellboy.logger.log [:bags] ? bag : "#{bag}:" items.each do |item| Bellboy.logger.log "\t#{item}" end unless [:bags] end end end |
#upload ⇒ Object
98 99 100 101 |
# File 'lib/bellboy/cli.rb', line 98 def upload berksfile = Bellboy.berks_from_file([:berksfile]) Bellboy::Uploader.upload(berksfile, ) end |
#version ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/bellboy/cli.rb', line 59 def version berksfile = Bellboy.berks_from_file([:berksfile]) = .reverse_merge(verbose: false) Bellboy::Versioner.version(berksfile, ) end |