Class: Juggle::Op::Template
- Inherits:
-
Base
- Object
- Base
- Juggle::Op::Template
show all
- Defined in:
- lib/juggle/ops/template.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#env, #opts
Instance Method Summary
collapse
Methods inherited from Base
default_opts, #initialize
Instance Attribute Details
#glob ⇒ Object
Returns the value of attribute glob.
7
8
9
|
# File 'lib/juggle/ops/template.rb', line 7
def glob
@glob
end
|
Instance Method Details
#make(glob) ⇒ Object
9
10
11
|
# File 'lib/juggle/ops/template.rb', line 9
def make(glob)
self.glob = glob
end
|
#manifest ⇒ Object
28
29
30
|
# File 'lib/juggle/ops/template.rb', line 28
def manifest
Dir[glob].map {|f| ::File.expand_path(f)}
end
|
#render ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/juggle/ops/template.rb', line 13
def render
Dir[glob].map do |path|
path = ::File.expand_path(path)
file = ::File.read(path)
path.sub!('.mustache', '')
prefix = ::File.expand_path(opts[:prefix] || Juggle.settings[:templates]) + '/'
path.sub!(prefix, '')
"Template[#{path.to_json}] = #{file.to_json};"
end.join("\n")
end
|