Sha256: 12630e023b20fb1e780b1ab5a0f7d053469c79497bc3c2061898761163e76e90
Contents?: true
Size: 1.11 KB
Versions: 82
Compression:
Stored size: 1.11 KB
Contents
module Rails module Generators module Actions attr_accessor :stategies attr_accessor :recipes attr_reader :template_options def initialize_templater self.recipes = [] @stategies = [] @template_options = {} end def execute_stategies stategies.each {|stategy| stategy.call } end def recipe(name) recipes << name File.join File.dirname(__FILE__), 'recipes', "#{name}.rb" end # TODO: Refactor loading of files def load_snippet(name, group) path = File.expand_path name, snippet_path(group) File.read path end def load_template(name, group, match={}) path = File.expand_path name, template_path(group) contents = File.read path match.each do |key, value| contents.gsub! "\%#{key.to_s}\%", value end contents end def snippet_path(name) File.join(File.dirname(__FILE__), 'snippets', name) end def template_path(name) File.join(File.dirname(__FILE__), 'templates', name) end end end end
Version data entries
82 entries across 41 versions & 1 rubygems