Class: Veewee::Provider::Vmfusion::Provider

Inherits:
Core::Provider show all
Defined in:
lib/veewee/provider/vmfusion/provider.rb

Instance Attribute Summary

Attributes inherited from Core::Provider

#env, #name, #options, #type

Instance Method Summary collapse

Methods inherited from Core::Provider

available?, #gem_available?, #gems_available?, #get_box, #initialize, #ui

Methods included from Core::Helper::Shell

#shell_exec

Constructor Details

This class inherits a constructor from Veewee::Provider::Core::Provider

Instance Method Details

#check_requirementsObject

include ::Veewee::Provider::Vmfusion::ProviderCommand


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/veewee/provider/vmfusion/provider.rb', line 10

def check_requirements
  require 'fission'

  if
    ::Fission.config.attributes["vmrun_bin"].nil? ||
    !File.exists?(::Fission.config.attributes["vmrun_bin"])
  then
    raise Veewee::Error,"Could not find vmrun at standard locations. Probably you don't have Vmware fusion installed"
  end
  env.logger.info("Found fusion version: #{fusion_version}")
end

#fusion_versionObject


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/veewee/provider/vmfusion/provider.rb', line 22

def fusion_version
  # We ask the system profiler for all installed software
  shell_results = shell_exec("system_profiler SPApplicationsDataType", :external_encoding => Encoding::UTF_8)

  env.logger.info("Checking version by querying the system_profiler")
  env.logger.debug(shell_results.stdout)

  if shell_results.stdout == ""
    ui.warn "Could not detect the exact version of vmware. assuming 5.1"
    version = "5.1"
  else
    version = shell_results.stdout.split(/VMware/)[1].split(/\n/)[2].split(/:/)[1].strip
  end

  return version
end