Sha256: c7cf0d80b2881b96828fefa6f874768c78cb0cea0bde9b2407f5f562d9256a81

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

require 'chef/knife'

module Berkshelf
  class BerksUpload < Chef::Knife
    deps do
      require 'berkshelf'
    end

    banner "knife berks upload (options)"

    option :without,
      :short => "-W WITHOUT",
      :long => "--without WITHOUT",
      :description => "Exclude cookbooks that are in these groups",
      :proc => lambda { |w| w.split(",") },
      :default => Array.new

    option :freeze,
      :long => "--freeze",
      :description => "Freeze the uploaded cookbooks so that they cannot be overwritten",
      :boolean => true,
      :default => false

    option :force,
      :long => "--force",
      :description => "Upload all cookbooks even if a frozen one exists on the target Chef Server",
      :boolean => true,
      :default => false

    def run
      ::Berkshelf.ui = ui
      cookbook_file = ::Berkshelf::Berksfile.from_file(File.join(Dir.pwd, "Berksfile"))
      cookbook_file.upload(Chef::Config[:chef_server_url], config)
    rescue BerkshelfError => e
      Berkshelf.ui.fatal e
      exit e.status_code
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
berkshelf-0.2.0 lib/chef/knife/berks_upload.rb
berkshelf-0.1.5 lib/chef/knife/berks_upload.rb
berkshelf-0.1.4 lib/chef/knife/berks_upload.rb
berkshelf-0.1.3 lib/chef/knife/berks_upload.rb
berkshelf-0.1.2 lib/chef/knife/berks_upload.rb
berkshelf-0.1.1 lib/chef/knife/berks_upload.rb