Module: VagrantVbguest

Defined in:
lib/vagrant-vbguest.rb,
lib/vagrant-vbguest/config.rb,
lib/vagrant-vbguest/errors.rb,
lib/vagrant-vbguest/command.rb,
lib/vagrant-vbguest/machine.rb,
lib/vagrant-vbguest/version.rb,
lib/vagrant-vbguest/download.rb,
lib/vagrant-vbguest/installer.rb,
lib/vagrant-vbguest/hosts/base.rb,
lib/vagrant-vbguest/middleware.rb,
lib/vagrant-vbguest/installers/base.rb,
lib/vagrant-vbguest/installers/suse.rb,
lib/vagrant-vbguest/hosts/virtualbox.rb,
lib/vagrant-vbguest/installers/linux.rb,
lib/vagrant-vbguest/installers/centos.rb,
lib/vagrant-vbguest/installers/debian.rb,
lib/vagrant-vbguest/installers/fedora.rb,
lib/vagrant-vbguest/installers/oracle.rb,
lib/vagrant-vbguest/installers/redhat.rb,
lib/vagrant-vbguest/installers/ubuntu.rb,
lib/vagrant-vbguest/helpers/os_release.rb,
lib/vagrant-vbguest/helpers/rebootable.rb,
lib/vagrant-vbguest/installers/windows.rb,
lib/vagrant-vbguest/installers/opensuse.rb,
lib/vagrant-vbguest/installers/archlinux.rb,
lib/vagrant-vbguest/helpers/vm_compatible.rb

Defined Under Namespace

Modules: Helpers, Hosts, Installers Classes: Command, Config, Download, DownloadingDisabledError, Installer, IsoPathAutodetectionError, Machine, Middleware, NoVirtualBoxMachineError, Plugin, VbguestError

Constant Summary collapse

VERSION =
File.read(File.expand_path("../../../VERSION", __FILE__)).chop

Class Method Summary collapse

Class Method Details

.Version(input, pattern = /(\d+\.\d+\.\d+)/) ⇒ nil|Gem::Version

Helper to create a new Gem::Version by parsing the common version pattern. When overwriting the pattern, make sure that the matched version string is the capture ‘1`

Parameters:

  • input (String)

    The text to parse for a version.

  • pattern (Regexp) (defaults to: /(\d+\.\d+\.\d+)/)

    The optional overwrite of the version string pattern (see PATTERN)

Returns:

  • (nil|Gem::Version)

    returns ‘nil` if the input could not been pared



13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-vbguest/version.rb', line 13

def self.Version(input, pattern = /(\d+\.\d+\.\d+)/)
  if input.nil?
    nil
  elsif Gem::Version === input
    input
  else
    Gem::Version.create(input[pattern, 1])
  end
end