Class: VagrantPlugins::PuppetInstall::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-puppet-install/plugin.rb

Constant Summary collapse

VAGRANT_VERSION_REQUIREMENT =
'>= 1.1.0'.freeze

Class Method Summary collapse

Class Method Details

.check_vagrant_version(*requirements) ⇒ Boolean

Returns true if the Vagrant version fulfills the requirements

Parameters:

  • requirements (String, Array<String>)

    the version requirement

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/vagrant-puppet-install/plugin.rb', line 16

def self.check_vagrant_version(*requirements)
  Gem::Requirement.new(*requirements).satisfied_by?(
    Gem::Version.new(Vagrant::VERSION))
end

.check_vagrant_version!Object

Verifies that the Vagrant version fulfills the requirements

is incompatible with the Vagrant version

Raises:

  • (VagrantPlugins::ProxyConf::VagrantVersionError)

    if this plugin



25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-puppet-install/plugin.rb', line 25

def self.check_vagrant_version!
  unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT)
    msg = I18n.t(
      'vagrant-puppet_install.errors.vagrant_version',
      requirement: VAGRANT_VERSION_REQUIREMENT.inspect)
    $stderr.puts msg
    raise msg
  end
end