Sha256: dc00da21d2b56c8f9f044576ba0da0fa14536467f015d11d988d8adf47d9f3af

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

require 'thor/group'

module Berkshelf
  # @author Jamie Winsor <jamie@vialstudios.com>
  class InitGenerator < Thor::Group
    class << self
      def source_root
        File.expand_path(File.join(File.dirname(__FILE__), "generator_files"))
      end
    end
    
    include Thor::Actions

    argument :path,
      type: :string,
      required: true

    class_option :metadata_entry,
      type: :boolean,
      default: false

    class_option :chefignore,
      type: :boolean,
      default: false

    def generate
      target_path = File.expand_path(path)

      template "Berksfile.erb", File.join(target_path, "Berksfile")

      if options[:chefignore]
        copy_file "chefignore", File.join(target_path, "chefignore")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
berkshelf-0.4.0.rc1 lib/berkshelf/init_generator.rb