Class: VagrantPlugins::ProxyConf::Plugin

Inherits:
Vagrant::Plugin::V2::Plugin
  • Object
show all
Defined in:
lib/vagrant-proxyconf/plugin.rb,
lib/vagrant-proxyconf/plugin.rb

Overview

Vagrant Plugin class that registers all proxy configs, hooks, etc.

Constant Summary collapse

MIN_VAGRANT_VERSION =

The minimum compatible Vagrant version

'1.2.0'

Class Method Summary collapse

Class Method Details

.aws_plugin_installed?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/vagrant-proxyconf/plugin.rb', line 40

def self.aws_plugin_installed?
  VagrantPlugins.const_defined?('AWS')
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



16
17
18
19
20
21
22
# File 'lib/vagrant-proxyconf/plugin.rb', line 16

def self.check_vagrant_version!
  if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(MIN_VAGRANT_VERSION)
    msg = I18n.t('vagrant_proxyconf.errors.vagrant_version', min_version: MIN_VAGRANT_VERSION)
    $stderr.puts msg
    raise msg
  end
end

.omnibus_plugin_installed?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/vagrant-proxyconf/plugin.rb', line 44

def self.omnibus_plugin_installed?
  VagrantPlugins.const_defined?('Omnibus')
end

.register_hooks(hook, provision_action) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/vagrant-proxyconf/plugin.rb', line 30

def self.register_hooks(hook, provision_action)
  require_relative 'action/configure_apt_proxy'
  require_relative 'action/configure_chef_proxy'
  require_relative 'action/configure_env_proxy'

  hook.after provision_action, Action::ConfigureAptProxy
  hook.after provision_action, Action::ConfigureChefProxy
  hook.after provision_action, Action::ConfigureEnvProxy
end

.setup_i18nObject

Initializes the internationalization strings



25
26
27
28
# File 'lib/vagrant-proxyconf/plugin.rb', line 25

def self.setup_i18n
  I18n.load_path << File.expand_path('../../../locales/en.yml', __FILE__)
  I18n.reload!
end