Sha256: 053384fe16a93b7858d886f4e2fe5d0c33f5598943a834f09a1749bd1cd7193f

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

require 'chef/knife'

module Berkshelf
  class BerksInit < Chef::Knife
    deps do
      require 'berkshelf'
    end
    
    banner "knife berks init [PATH]"

    def run
      ::Berkshelf.ui = ui
      config[:path] = File.expand_path(@name_args.first || Dir.pwd)

      if File.chef_cookbook?(config[:path])
        config[:chefignore] = true
        config[:metadata_entry] = true
      end

      generator = ::Berkshelf::InitGenerator.new([], config)
      generator.invoke_all

      ::Berkshelf.ui.info "Successfully initialized"
    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_init.rb
berkshelf-0.1.5 lib/chef/knife/berks_init.rb
berkshelf-0.1.4 lib/chef/knife/berks_init.rb
berkshelf-0.1.3 lib/chef/knife/berks_init.rb
berkshelf-0.1.2 lib/chef/knife/berks_init.rb
berkshelf-0.1.1 lib/chef/knife/berks_init.rb