Class: IronWorkerNG::Code::Container::Dir
- Inherits:
-
Base
- Object
- Base
- IronWorkerNG::Code::Container::Dir
show all
- Defined in:
- lib/iron_worker_ng/code/container/dir.rb
Instance Attribute Summary
Attributes inherited from Base
#name, #runner_additions
Instance Method Summary
collapse
Methods inherited from Base
#clear_dest, #close, #commit, #initialize, #runner_add
Instance Method Details
#add(dest, src) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/iron_worker_ng/code/container/dir.rb', line 11
def add(dest, src)
FileUtils.mkdir_p(File.dirname(full_dest(dest)))
if File.directory?(src)
FileUtils.mkdir(full_dest(dest))
else
FileUtils.cp(src, full_dest(dest))
end
end
|
#full_dest(dest) ⇒ Object
7
8
9
|
# File 'lib/iron_worker_ng/code/container/dir.rb', line 7
def full_dest(dest)
@name + '/' + clear_dest(dest)
end
|
#get_output_stream(dest, &block) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/iron_worker_ng/code/container/dir.rb', line 21
def get_output_stream(dest, &block)
FileUtils.mkdir_p(File.dirname(full_dest(dest)))
file = File.open(full_dest(dest), 'wb')
block.call(file)
file.close
end
|