Class: Llama::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/llama/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ Template

Returns a new instance of Template.



5
6
7
8
9
10
11
12
13
# File 'lib/llama/template.rb', line 5

def initialize(template)
  if template.include?('.git')
    @template_name = template.match(/\/(.+)\.git$/)[1]
    @repo_path = template
  else
    @template_name = template.split('/').last
    @repo_path = "[email protected]:#{template_name}.git"
  end
end

Instance Attribute Details

#repo_pathObject

Returns the value of attribute repo_path.



3
4
5
# File 'lib/llama/template.rb', line 3

def repo_path
  @repo_path
end

#template_nameObject

Returns the value of attribute template_name.



3
4
5
# File 'lib/llama/template.rb', line 3

def template_name
  @template_name
end

Instance Method Details

#render!(output_path, project_name) ⇒ Object



15
16
17
18
# File 'lib/llama/template.rb', line 15

def render!(output_path, project_name)
  fetch_template
  Llama::DirProcessor.new(template_path, output_path, project_name).process!
end