Module: Boxes
- Defined in:
- lib/vagrant_commands/boxes.rb
Defined Under Namespace
Classes: VagrantBox
Class Method Summary collapse
Class Method Details
.find_by_box_name(box) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant_commands/boxes.rb', line 30 def self.find_by_box_name(box) found = nil boxes = get_vagrant_boxes boxes.each { |o| found = o if o.box_name == box.box_name } found end |
.get_vagrant_boxes ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant_commands/boxes.rb', line 3 def self.get_vagrant_boxes result = Commands::vagrant_box_list boxes = Array.new box_name = nil box_version = nil box_provider = nil lines = result.lines.map(&:chomp) lines.each { |line| cols = line.split(/,/) if cols[2] == "box-name" box_name = cols[3] end if cols[2] == "box-provider" box_provider = cols[3] end if cols[2] == "box-version" box_version = cols[3] boxes.push VagrantBox.new(box_name, box_version, box_provider,nil) end } boxes end |
.install_box_if_missing(box) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/vagrant_commands/boxes.rb', line 40 def self.install_box_if_missing(box) if find_by_box_name(box) == nil puts "Base box not found importing base box" Commands::vagrant_box_add(box.box_location,box.box_name) end end |