Class: Servitor::VagrantBoxProvisioner

Inherits:
Object
  • Object
show all
Defined in:
lib/provisioners/vagrant_box_provisioner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(requirements) ⇒ VagrantBoxProvisioner

Returns a new instance of VagrantBoxProvisioner.



6
7
8
# File 'lib/provisioners/vagrant_box_provisioner.rb', line 6

def initialize(requirements)
  @requirements = requirements
end

Instance Attribute Details

#requirementsObject (readonly)

Returns the value of attribute requirements.



4
5
6
# File 'lib/provisioners/vagrant_box_provisioner.rb', line 4

def requirements
  @requirements
end

Instance Method Details

#nameObject



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

def name
  @name ||= "#{@requirements.os_name}_#{@requirements.os_version}".gsub(/[^a-zA-Z0-9\-]/, '-')
end

#provisionObject



14
15
16
17
18
19
20
# File 'lib/provisioners/vagrant_box_provisioner.rb', line 14

def provision
  create_base_box unless VagrantBox.exists?(name)
  VagrantBox.new(name).tap do |box|
    box.init(name)
    box.up
  end
end