lib/berkshelf/cli.rb in berkshelf-1.1.6 vs lib/berkshelf/cli.rb in berkshelf-1.2.0.rc1
- old
+ new
@@ -1,11 +1,9 @@
require 'berkshelf'
module Berkshelf
- Thor::Base.shell = Berkshelf::UI
-
- # @author Jamie Winsor <jamie@vialstudios.com>
+ # @author Jamie Winsor <reset@riotgames.com>
class Cli < Thor
class << self
def dispatch(meth, given_args, given_opts, config)
super
Berkshelf.formatter.cleanup_hook unless config[:current_task].name == "help"
@@ -20,10 +18,14 @@
raise BerksConfigNotFound, "You specified a path to a configuration file that did not exist: '#{@options[:config]}'"
end
Berkshelf::Config.path = @options[:config]
end
+ if @options[:quiet]
+ Berkshelf.ui.mute!
+ end
+
Berkshelf.set_format @options[:format]
@options = options.dup # unfreeze frozen options Hash from Thor
end
namespace "berkshelf"
@@ -33,10 +35,12 @@
map 'ud' => :update
map 'ls' => :list
map 'ver' => :version
map 'book' => :cookbook
+ default_task :install
+
class_option :config,
type: :string,
desc: "Path to Berkshelf configuration to use.",
aliases: "-c",
banner: "PATH"
@@ -44,10 +48,15 @@
type: :string,
default: "human",
desc: "Output format to use.",
aliases: "-F",
banner: "FORMAT"
+ class_option :quiet,
+ type: :boolean,
+ desc: "Silence all informational output.",
+ aliases: "-q",
+ default: false
method_option :force,
type: :boolean,
default: false,
desc: "create a new configuration file even if one already exists."
@@ -186,10 +195,15 @@
option :skip_syntax_check,
type: :boolean,
default: false,
desc: "Skip Ruby syntax check when uploading cookbooks",
aliases: "-s"
+ option :skip_dependencies,
+ type: :boolean,
+ desc: 'Do not upload dependencies',
+ default: false,
+ aliases: '-D'
desc "upload [COOKBOOKS]", "Upload cookbook(s) specified by a Berksfile to the configured Chef Server."
def upload(*cookbook_names)
berksfile = ::Berkshelf::Berksfile.from_file(options[:berksfile])
unless Berkshelf::Config.instance.chef.chef_server_url.present?
@@ -371,10 +385,10 @@
unless Config.instance.valid?
raise InvalidConfiguration.new(Config.instance.errors)
end
- ::Berkshelf::CookbookGenerator.new([name, File.join(Dir.pwd, name)], options).invoke_all
+ ::Berkshelf::CookbookGenerator.new([File.join(Dir.pwd, name), name], options).invoke_all
end
private
def version_header