Sha256: 214fea4c8f6a13554e0939af4d7fa9eee2102c349c29ceeb0fde578f919fa5f0

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

require 'thor/group'

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

      def self.source_root
        File.join(File.dirname(__FILE__), "recipe_generator", "templates")
      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

2 entries across 2 versions & 1 rubygems

Version Path
engineyard-recipes-0.1.0 lib/engineyard-recipes/generators/recipe_generator.rb
engineyard-recipes-0.0.3 lib/engineyard-recipes/generators/recipe_generator.rb