Sha256: 066df659687e1a362d93b45c02f341d9509b296ff35fdcdbe25fdff6b839caf0

Contents?: true

Size: 986 Bytes

Versions: 7

Compression:

Stored size: 986 Bytes

Contents

require 'thor/group'

module Engineyard::Recipes
  module Generators
    class LocalRecipeCloneGenerator < Thor::Group
      include Thor::Actions
      
      argument :recipe_name

      def self.source_root
        @tmpdir ||= Dir.mktmpdir
      end
      
      def install_cookbooks
        directory "cookbooks"
      end
      
      def auto_require_package
        file = "cookbooks/main/recipes/default.rb"
        file_path = File.join(destination_root, "cookbooks/main/recipes/default.rb")
        if !File.exists?(file_path)
          puts "Skipping auto-require of package recipe: #{file} is missing"
        elsif File.directory?(File.join(self.class.source_root, "cookbooks", recipe_name, "recipes"))
          require_recipe = "\nrequire_recipe '#{recipe_name}'\n"
          append_to_file file, require_recipe
        end
      end
      
      private
      def say(msg, color = nil)
        color ? shell.say(msg, color) : shell.say(msg)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
engineyard-recipes-0.2.0 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.2.0.pre3 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.2.0.pre2 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.2.0.pre1 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.1.3 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.1.2 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb
engineyard-recipes-0.1.1 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb