Class: Agilib::Composer::Templater

Inherits:
Object
  • Object
show all
Defined in:
lib/agilib/composer/templater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTemplater

Returns a new instance of Templater.



7
8
9
10
# File 'lib/agilib/composer/templater.rb', line 7

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

Instance Attribute Details

#post_bundler_strategiesObject (readonly)

Returns the value of attribute post_bundler_strategies.



5
6
7
# File 'lib/agilib/composer/templater.rb', line 5

def post_bundler_strategies
  @post_bundler_strategies
end

Instance Method Details

#load_snippet(name, group) ⇒ Object



24
25
26
27
# File 'lib/agilib/composer/templater.rb', line 24

def load_snippet(name, group)
  group_path = snippet_path(group)
  File.read  File.expand_path("#{name}.rb", group_path)
end

#post_bundler(&block) ⇒ Object



12
13
14
# File 'lib/agilib/composer/templater.rb', line 12

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

#recipe(name) ⇒ Object



16
17
18
# File 'lib/agilib/composer/templater.rb', line 16

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

#snippet_path(group) ⇒ Object



20
21
22
# File 'lib/agilib/composer/templater.rb', line 20

def snippet_path(group)
  File.expand_path("snippets/#{group}", @template_framework_path)
end