Class: Terraspace::Terraform::Ihooks::After::Plan
- Inherits:
-
Base
show all
- Defined in:
- lib/terraspace/terraform/ihooks/after/plan.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods inherited from CLI::Base
#initialize
#pretty_path, #pretty_time
Methods included from Util::Sure
#sure?
#logger
Instance Method Details
#copy_to_root(file) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/terraspace/terraform/ihooks/after/plan.rb', line 8
def copy_to_root(file)
return if file =~ %r{^/} name = file.sub("#{Terraspace.root}/",'')
src = "#{@mod.cache_dir}/#{name}"
dest = name
FileUtils.mkdir_p(File.dirname(dest))
FileUtils.cp(src, dest)
end
|
#run ⇒ Object
3
4
5
6
|
# File 'lib/terraspace/terraform/ihooks/after/plan.rb', line 3
def run
return if !@options[:out] || @options[:copy_to_root] == false
copy_to_root(@options[:out])
end
|