Sha256: 0edf3428c43900d98fdd191d6c009c67566d21c03817941f05b1394e8d235cdf

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 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")
        unless File.exists?(file_path)
          puts "Skipping auto-require of package recipe: #{file} is missing"
        else
          require_recipe = "require_recipe '#{recipe_name}'"
          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

1 entries across 1 versions & 1 rubygems

Version Path
engineyard-recipes-0.1.0 lib/engineyard-recipes/generators/local_recipe_clone_generator.rb