lib/berkshelf/cli.rb in berkshelf-3.0.0.beta7 vs lib/berkshelf/cli.rb in berkshelf-3.0.0.beta8
- old
+ new
@@ -197,18 +197,17 @@
method_option :halt_on_frozen,
type: :boolean,
default: false,
desc: 'Halt uploading and exit if the Chef Server has a frozen version of the cookbook(s).'
desc 'upload [COOKBOOKS]', 'Upload the cookbook specified in the Berksfile to the Chef Server'
- def upload(*cookbook_names)
+ def upload(*names)
berksfile = Berksfile.from_options(options)
- options[:cookbooks] = cookbook_names
options[:freeze] = !options[:no_freeze]
options[:validate] = false if options[:skip_syntax_check]
- berksfile.upload(options.symbolize_keys)
+ berksfile.upload(names, options.symbolize_keys)
end
method_option :lockfile,
type: :string,
default: Berkshelf::Lockfile::DEFAULT_FILENAME,
@@ -257,10 +256,22 @@
end
Berkshelf.formatter.outdated(outdated)
end
+ method_option :source,
+ type: :string,
+ default: Berksfile::DEFAULT_API_URL,
+ desc: 'URL to search for sources',
+ banner: 'URL'
+ desc 'search NAME', 'Search the remote source for cookbooks matching the partial name'
+ def search(name)
+ source = Source.new(options[:source])
+ cookbooks = source.search(name)
+ Berkshelf.formatter.search(cookbooks)
+ end
+
desc 'init [PATH]', 'Initialize Berkshelf in the given directory'
def init(path = '.')
Berkshelf.formatter.deprecation '--git is now the default' if options[:git]
Berkshelf.formatter.deprecation '--vagrant is now the default' if options[:vagrant]
@@ -382,9 +393,10 @@
Berkshelf::CookbookGenerator.new([File.join(Dir.pwd, name), name], options).invoke_all
end
tasks['cookbook'].options = Berkshelf::CookbookGenerator.class_options
private
+
# Print a list of the given cookbooks. This is used by various
# methods like {list} and {contingent}.
#
# @param [Array<CachedCookbook>] cookbooks
#