Class: Engineyard::Recipes::Generators::PackageGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

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

Instance Method Details

#auto_require_packageObject



25
26
27
28
29
30
31
# File 'lib/engineyard-recipes/generators/package_generator.rb', line 25

def auto_require_package
  file           = cookbooks_dir "main/recipes/default.rb"
  require_recipe = "\nrequire_recipe '#{recipe_name}'\n"
  append_to_file file, require_recipe
rescue CookbooksNotFound
  # step not required if no cookbooks/ found
end

#install_cookbooksObject



17
18
19
20
21
22
23
# File 'lib/engineyard-recipes/generators/package_generator.rb', line 17

def install_cookbooks
  begin
    directory "cookbooks", cookbooks_destination
  rescue CookbooksNotFound
    directory "cookbooks/%recipe_name%", "."
  end
end