Class: ConfigmonkeyCli::Application::ManifestAction::Template
- Inherits:
-
Copy
- Object
- Base
- Copy
- ConfigmonkeyCli::Application::ManifestAction::Template
show all
- Defined in:
- lib/configmonkey_cli/application/manifest_actions/template.rb
Instance Attribute Summary
Attributes inherited from Base
#app, #args, #manifest, #opts, #thor
Instance Method Summary
collapse
Methods inherited from Copy
#destructive
Methods inherited from Base
#args_and_opts, #destructive, #exists?, #expand_dst, #expand_src, #initialize, #rel, #to_s
Instance Method Details
23
24
25
|
# File 'lib/configmonkey_cli/application/manifest_actions/template.rb', line 23
def _perform_directory(source, destination, opts)
status :invalid, :red, "directory not allowed for template", :red
end
|
27
28
29
30
|
# File 'lib/configmonkey_cli/application/manifest_actions/template.rb', line 27
def _perform_file(source, destination, opts)
hostname = app.opts[:hostname]
thor.template(@source, @destination, @opts.merge(context: binding))
end
|
#init(hargs_and_opts = {}) ⇒ Object
5
6
7
|
# File 'lib/configmonkey_cli/application/manifest_actions/template.rb', line 5
def init hargs_and_opts = {}
@args, @opts = args_and_opts(hargs_and_opts)
end
|
#prepare ⇒ Object
9
10
11
12
13
|
# File 'lib/configmonkey_cli/application/manifest_actions/template.rb', line 9
def prepare
@opts[:force] = app.opts[:default_yes]
@source = @args[0]
@destination = File.join(thor.destination_root, @args[1])
end
|
#simulate ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/configmonkey_cli/application/manifest_actions/template.rb', line 15
def simulate
if thor.options[:pretend]
destructive
else
status :fake, :black, rel(@destination)
end
end
|