Sha256: 452d224a78db42e4cf65ae036dc65b263a197ac8ab96bfa4872cfc7f0647187e
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
module VagrantMutate class Qemu # http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby def self.verify_qemu_installed logger = Log4r::Logger.new('vagrant::mutate') exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "qemu-img#{ext}") if File.executable? exe logger.info 'Found qemu' return end end end # if we make it here qemu-img command was not found fail Errors::QemuImgNotFound end def self.verify_qemu_version(env) usage = `qemu-img --version` if usage =~ /(\d+\.\d+\.\d+)/ installed_version = Gem::Version.new(Regexp.last_match[1]) # less than 1.2 or equal to 1.6.x if installed_version < Gem::Version.new('1.2.0') or (installed_version >= Gem::Version.new('1.6.0') and installed_version < Gem::Version.new('1.7.0')) env.ui.warn "You have qemu #{installed_version} installed. "\ 'This version cannot read some virtualbox boxes. '\ 'If conversion fails, see below for recommendations. '\ 'https://github.com/sciurus/vagrant-mutate/wiki/QEMU-Version-Compatibility' end else fail Errors::ParseQemuVersionFailed end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagrant-mutate-1.0.2 | lib/vagrant-mutate/qemu.rb |
vagrant-mutate-1.0.1 | lib/vagrant-mutate/qemu.rb |
vagrant-mutate-1.0.0 | lib/vagrant-mutate/qemu.rb |