Sha256: 2be4ea6fd0a5ee10210136663c47b795b4c22e3c1286c171f8d34c967490b172

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

require 'thor/group'

module Engineyard::Recipes
  module Generators
    class LocalRecipeCloneGenerator < BaseGenerator
      include Thor::Actions
      
      argument :recipe_name
      argument :flags, :type => :hash

      def self.source_root
        @tmpdir ||= Dir.mktmpdir
      end
      
      def install_cookbooks
        directory "cookbooks", cookbooks_destination
      end
      
      def auto_require_package
        unless local?
          file = cookbooks_dir "main/recipes/default.rb"
          require_recipe = "\nrequire_recipe '#{recipe_name}'\n"
          append_to_file file, require_recipe
        end
      end
      
      private
      def local?
        flags[:local]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
engineyard-recipes-0.4.0 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.3.2 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.3.2.pre lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.3.0 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb