Class: Engineyard::Recipes::Generators::TimezoneGenerator

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

Defined Under Namespace

Classes: InvalidTimezone

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/engineyard-recipes/generators/timezone_generator.rb', line 11

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

Instance Method Details

#auto_require_packageObject



23
24
25
26
27
# File 'lib/engineyard-recipes/generators/timezone_generator.rb', line 23

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

#check_timezoneObject

Raises:



15
16
17
# File 'lib/engineyard-recipes/generators/timezone_generator.rb', line 15

def check_timezone
  raise InvalidTimezone.new(timezone) unless timezones =~ /^#{timezone}$/
end

#install_cookbooksObject



19
20
21
# File 'lib/engineyard-recipes/generators/timezone_generator.rb', line 19

def install_cookbooks
  directory "cookbooks", cookbooks_destination
end