lib/engineyard-recipes/generators/package_generator.rb in engineyard-recipes-0.4.0 vs lib/engineyard-recipes/generators/package_generator.rb in engineyard-recipes-0.5.0

- old
+ new

@@ -6,25 +6,29 @@ include Thor::Actions argument :recipe_name argument :package argument :version - argument :flags, :type => :hash # :unmasked & :local + argument :flags, :type => :hash # :unmasked def self.source_root File.join(File.dirname(__FILE__), "package_generator", "templates") end def install_cookbooks - directory "cookbooks", cookbooks_destination + begin + directory "cookbooks", cookbooks_destination + rescue CookbooksNotFound + directory "cookbooks/%recipe_name%", "." + end 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 + 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 protected def recipe_name_variable_name @recipe_name_variable_name ||= recipe_name.gsub(/\W+/, '_')