Sha256: 94c4174bf9cf03a910efd819be28eb3244d6ae4ab282a0b4feb01e043cea4486

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

require 'thor/group'

module Engineyard::Recipes
  module Generators
    class InitSmGenerator < Thor::Group
      include Thor::Actions
      
      def self.source_root
        File.join(File.dirname(__FILE__), "init_sm_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 = "\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
      
      def recipe_name
        'sm'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
engineyard-recipes-0.2.0 lib/engineyard-recipes/generators/init_sm_generator.rb
engineyard-recipes-0.2.0.pre3 lib/engineyard-recipes/generators/init_sm_generator.rb
engineyard-recipes-0.2.0.pre2 lib/engineyard-recipes/generators/init_sm_generator.rb
engineyard-recipes-0.2.0.pre1 lib/engineyard-recipes/generators/init_sm_generator.rb