class CookieCutter::Recipe
Reads config file information and builds a cookie from the selected template
Constants
- CONFIG_PATH
- DEFAULT_CONFIG_FILENAME
Attributes
config_file_path[RW]
Public Class Methods
new(config_file_path = nil)
click to toggle source
# File lib/cookie_cutter/recipe.rb, line 11 def initialize(config_file_path = nil) throw ArgumentError if config_file_path.nil? @config_file_path = config_file_path @_config = Recipe.read_config_file(config_file_path) end
Private Class Methods
config_is_dir(config_path)
click to toggle source
# File lib/cookie_cutter/recipe.rb, line 34 def self.config_is_dir(config_path) path = File.expand_path(config_path) File.directory? path end
read_config_file(template_path)
click to toggle source
# File lib/cookie_cutter/recipe.rb, line 39 def self.read_config_file(template_path) if Recipe.config_is_dir(template_path) == true full_path = File.expand_path File.join(template_path, Recipe::DEFAULT_CONFIG_FILENAME) else full_path = File.expand_path File.join(template_path) end return YAML::load_file(full_path) end
Public Instance Methods
config()
click to toggle source
# File lib/cookie_cutter/recipe.rb, line 18 def config @_config end
template()
click to toggle source
# File lib/cookie_cutter/recipe.rb, line 22 def template @_template[Recipe::CONFIG_PATH] = @config_file_path @_template end