Class: P::Builder
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Actions
#directory, #file, #touch
Constructor Details
#initialize(template) ⇒ Builder
Returns a new instance of Builder.
12
13
14
15
|
# File 'lib/p/builder.rb', line 12
def initialize(template)
@template = template
copy_template_variables!
end
|
Instance Attribute Details
#template ⇒ Object
Returns the value of attribute template.
5
6
7
|
# File 'lib/p/builder.rb', line 5
def template
@template
end
|
Class Method Details
.run!(template) ⇒ Object
8
9
10
|
# File 'lib/p/builder.rb', line 8
def self.run!(template)
new(template).run!
end
|
Instance Method Details
#_binding ⇒ Object
35
36
37
|
# File 'lib/p/builder.rb', line 35
def _binding
binding
end
|
#destination_file(path) ⇒ Object
31
32
33
|
# File 'lib/p/builder.rb', line 31
def destination_file(path)
File.join(base_directory, path)
end
|
#run! ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/p/builder.rb', line 17
def run!
announce "Generating #{@template.template} project `#{@name}`"
say "Creating base directory `#{@name}`" do
FileUtils.mkdir(base_directory)
end
eval(IO.read(@template.path))
end
|
#source_file(path) ⇒ Object
27
28
29
|
# File 'lib/p/builder.rb', line 27
def source_file(path)
File.join(@template.directory, path)
end
|