Class: Vx::Lib::Container::Local
- Inherits:
-
Object
- Object
- Vx::Lib::Container::Local
- Includes:
- Instrument
- Defined in:
- lib/vx/lib/container/local.rb,
lib/vx/lib/container/local/spawner.rb
Defined Under Namespace
Classes: Spawner
Instance Attribute Summary collapse
-
#work_dir ⇒ Object
readonly
Returns the value of attribute work_dir.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Local
constructor
A new instance of Local.
- #start(&block) ⇒ Object
Methods included from Instrument
Constructor Details
#initialize(options = {}) ⇒ Local
14 15 16 17 |
# File 'lib/vx/lib/container/local.rb', line 14 def initialize( = {}) @work_dir = [:work_dir] || default_work_dir @work_dir = File.(@work_dir) end |
Instance Attribute Details
#work_dir ⇒ Object (readonly)
Returns the value of attribute work_dir.
12 13 14 |
# File 'lib/vx/lib/container/local.rb', line 12 def work_dir @work_dir end |
Instance Method Details
#start(&block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vx/lib/container/local.rb', line 19 def start(&block) instrument( "create", container_type: 'local', container: { work_dir: work_dir }) do FileUtils.rm_rf(work_dir) FileUtils.mkdir_p(work_dir) end begin spawner = Spawner.new(work_dir) yield spawner ensure instrument( "kill", container_type: 'local', container: { work_dir: work_dir }) do FileUtils.mkdir_p(work_dir) end end end |