Class: Engineyard::Recipes::Generators::SmGenerator

Inherits:
BaseGenerator
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/engineyard-recipes/generators/sm_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 7

def command
  @command
end

Class Method Details

.source_rootObject



13
14
15
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 13

def self.source_root
  File.join(File.dirname(__FILE__), "sm_generator", "templates")
end

Instance Method Details

#auto_require_packageObject



30
31
32
33
34
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 30

def auto_require_package
  file = cookbooks_dir "main/recipes/default.rb"
  require_recipe = "\nrequire_recipe '#{recipe_name}'\n"
  append_to_file file, require_recipe
end

#install_cookbooksObject



17
18
19
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 17

def install_cookbooks
  directory "cookbooks", cookbooks_destination
end

#vendorObject



36
37
38
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 36

def vendor
  FetchUri.vendor_recipe_into_recipe(sm_ext_uri, recipe_vendor_path)
end

#wrap_commandsObject



21
22
23
24
25
26
27
28
# File 'lib/engineyard-recipes/generators/sm_generator.rb', line 21

def wrap_commands
  template_file = 'command_recipe.rb.tt'
  sm_ext_commands.each do |command|
    self.command = command # for the template
    recipe = cookbooks_dir "#{recipe_name}/recipes/#{command}.rb"
    template(template_file, recipe)
  end
end