Class: Servitor::VeeweeBox

Inherits:
Object
  • Object
show all
Includes:
ChildProcessHelper
Defined in:
lib/provisioners/veewee_box.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ChildProcessHelper

#execute_child_process, #execute_child_process_and_capture_output, included

Constructor Details

#initialize(name, os_name, os_version, os_arch = nil) ⇒ VeeweeBox

Returns a new instance of VeeweeBox.

Raises:



26
27
28
29
30
31
32
# File 'lib/provisioners/veewee_box.rb', line 26

def initialize(name, os_name, os_version, os_arch=nil)
  raise InvalidNameError, name unless name =~ /^[a-zA-Z0-9\-]+$/
  @name = name
  @os_name = os_name
  @os_version = os_version
  @os_arch = os_arch || '64'
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/provisioners/veewee_box.rb', line 24

def name
  @name
end

#os_nameObject (readonly)

Returns the value of attribute os_name.



24
25
26
# File 'lib/provisioners/veewee_box.rb', line 24

def os_name
  @os_name
end

#os_versionObject (readonly)

Returns the value of attribute os_version.



24
25
26
# File 'lib/provisioners/veewee_box.rb', line 24

def os_version
  @os_version
end

Class Method Details

.find(name) ⇒ Object



10
11
12
13
# File 'lib/provisioners/veewee_box.rb', line 10

def find(name)
  definition = self.veewee.definitions[name]
  VeeweeBox.new(name, nil, nil) if definition # we don't have the os name & version available
end

.vagrantObject



19
20
21
# File 'lib/provisioners/veewee_box.rb', line 19

def vagrant
  VagrantBox.vagrant
end

.veeweeObject



15
16
17
# File 'lib/provisioners/veewee_box.rb', line 15

def veewee
  @veewee ||= Veewee::Environment.new
end

Instance Method Details

#build(options = {}) ⇒ Object



38
39
40
41
42
# File 'lib/provisioners/veewee_box.rb', line 38

def build(options={})
  build_args = ['vagrant', 'basebox', 'build', @name, '--auto']
  build_args << '--nogui' if options[:nogui]
  execute_child_process(*build_args)
end

#defineObject



34
35
36
# File 'lib/provisioners/veewee_box.rb', line 34

def define
  execute_child_process('vagrant', 'basebox', 'define', @name, template_name)
end