class Preseason::Recipe

Attributes

config[R]

Public Class Methods

new(config) click to toggle source
# File lib/preseason/recipe.rb, line 9
def initialize(config)
  @config = config
end

Public Instance Methods

post_install_hook() click to toggle source
# File lib/preseason/recipe.rb, line 17
def post_install_hook
  # implement in child classes
end
recipe_root() click to toggle source
# File lib/preseason/recipe.rb, line 13
def recipe_root
  "#{template_path}/#{self.class.name.demodulize.underscore}"
end

Private Instance Methods

insert(path, opts = {}) click to toggle source
# File lib/preseason/recipe.rb, line 35
def insert(path, opts = {})
  insert_into_file path, File.read("#{recipe_root}/#{path}"), opts
end
mirror_file(path) click to toggle source
# File lib/preseason/recipe.rb, line 22
def mirror_file(path)
  remove_file(path) if File.exist?(path)
  copy_file "#{recipe_root}/#{path}", path
end
parse_template(path) click to toggle source
# File lib/preseason/recipe.rb, line 27
def parse_template(path)
  ERB.new(File.read(File.join(template_path, path))).result(binding)
end
template_path() click to toggle source
# File lib/preseason/recipe.rb, line 31
def template_path
  @template_path ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end