Sha256: dc70ec36e425e6ff77e0882d50801e5c31c8d6a204ff7324cfd4222259606ed5

Contents?: true

Size: 972 Bytes

Versions: 3

Compression:

Stored size: 972 Bytes

Contents

require 'thor/group'

module Engineyard::Recipes
  module Generators
    class RecipeGenerator < BaseGenerator
      include Thor::Actions
      
      argument :recipe_name
      argument :package
      argument :version
      argument :flags, :type => :hash # :unmasked & :local

      def self.source_root
        File.join(File.dirname(__FILE__), "recipe_generator", "templates")
      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 known_package?
        package =~ /UNKNOWN/
      end
      
      def local?
        flags[:local]
      end
      
      def unmasked
        flags[:unmasked]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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