Class: Vito::Tasks::VagrantBootstrap

Inherits:
Object
  • Object
show all
Defined in:
lib/vito/tasks/vagrant_bootstrap.rb

Instance Method Summary collapse

Constructor Details

#initialize(os_name) ⇒ VagrantBootstrap

Returns a new instance of VagrantBootstrap.



4
5
6
# File 'lib/vito/tasks/vagrant_bootstrap.rb', line 4

def initialize(os_name)
  @os_name = os_name
end

Instance Method Details

#installObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vito/tasks/vagrant_bootstrap.rb', line 8

def install
  puts "=> Initializing #{os_name} box called #{os_name}_test_box into: #{box_location(os_name)}"
  pwd = Dir.pwd
  Dir.chdir("spec/vagrant_boxes/#{os_name}")

  puts "Attempting to download and prepare the box..."
  system "vagrant up && vagrant halt"
  puts "Attempting to take snapshot of clean box..."

  install_snapshot_plugin
  system "vagrant snapshot take #{snapshot_name}" unless snapshot_exist?

  puts "Done.\n"
  Dir.chdir(pwd)
end