Sha256: 75510e843dba708f613ede24416a7f70a6b8a340dfef436999e8d988d2cc10b2

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module RailsTemplater
  class Templater

    attr_reader :post_bundler_strategies

    def initialize
      @post_bundler_strategies = []
      @template_framework_path = File.join(File.dirname(__FILE__), '..', 'template_framework')
    end

    def fixture_replacement
      @fixture_replacement ||= FixtureReplacement.new
    end

    def orm
      @orm ||= Orm.new
    end

    def javascript_framework
      @javascript_framework ||= JavaScriptFramework.new
    end

    def template_engine
      @template_engine ||= TemplateEngine.new
    end

    def post_bundler(&block)
      @post_bundler_strategies << block
    end

    def recipe(name)
      File.expand_path("recipes/#{name}.rb", @template_framework_path)
    end

    ['snippet', 'template'].each do |type|

      define_method "#{type}_path" do |group|
        File.expand_path("#{type.pluralize}/#{group}", @template_framework_path)
      end

      define_method "load_#{type}" do |name, group|
        group_path = send("#{type}_path".to_sym, group)
        File.read  File.expand_path(name, group_path)
      end

    end

    def testing_framework
      @testing_framework ||= TestingFramework.new
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_templater-0.2.0 lib/rails_templater/templater.rb
rails_templater-0.1.2 lib/rails_templater/templater.rb