Sha256: 290cc5a86b3a129861fda09e226875697b538cb2d1f372eca835275af096b6f1

Contents?: true

Size: 817 Bytes

Versions: 6

Compression:

Stored size: 817 Bytes

Contents

require 'thor/group'

module Berkshelf
  # @author Jamie Winsor <jamie@vialstudios.com>
  class InitGenerator < Thor::Group
    include Thor::Actions

    class_option :path,
      :type => :string,
      :required => true

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

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

    def self.source_root
      File.expand_path(File.join(File.dirname(__FILE__), "generator_files"))
    end

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

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

    private

      def target_path
        @target_path ||= File.expand_path(options[:path])
      end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
berkshelf-0.2.0 lib/berkshelf/init_generator.rb
berkshelf-0.1.5 lib/berkshelf/init_generator.rb
berkshelf-0.1.4 lib/berkshelf/init_generator.rb
berkshelf-0.1.3 lib/berkshelf/init_generator.rb
berkshelf-0.1.2 lib/berkshelf/init_generator.rb
berkshelf-0.1.1 lib/berkshelf/init_generator.rb