Class: Servitor::VagrantBoxProvisioner
- Inherits:
-
Object
- Object
- Servitor::VagrantBoxProvisioner
- Defined in:
- lib/provisioners/vagrant_box_provisioner.rb
Instance Attribute Summary collapse
-
#requirements ⇒ Object
readonly
Returns the value of attribute requirements.
Instance Method Summary collapse
-
#initialize(requirements) ⇒ VagrantBoxProvisioner
constructor
A new instance of VagrantBoxProvisioner.
- #name ⇒ Object
- #provision ⇒ Object
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
#requirements ⇒ Object (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
#name ⇒ Object
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 |
#provision ⇒ Object
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 |