Class: Vx::Lib::Container::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/vx/lib/container/local.rb,
lib/vx/lib/container/local/spawner.rb

Defined Under Namespace

Classes: Spawner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Local

Returns a new instance of Local.



12
13
14
15
# File 'lib/vx/lib/container/local.rb', line 12

def initialize(options = {})
  @work_dir = options[:work_dir] || default_work_dir
  @work_dir = File.expand_path(@work_dir)
end

Instance Attribute Details

#work_dirObject (readonly)

Returns the value of attribute work_dir.



10
11
12
# File 'lib/vx/lib/container/local.rb', line 10

def work_dir
  @work_dir
end

Instance Method Details

#start(&block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vx/lib/container/local.rb', line 17

def start(&block)
  FileUtils.rm_rf(work_dir)
  FileUtils.mkdir_p(work_dir)

  begin
    spawner = Spawner.new(work_dir)
    yield spawner
  ensure
    FileUtils.mkdir_p(work_dir)
  end
end