Sha256: be9d450ab3f3997657156c182ea2636fe3bb36ae4b9dde5b6185d2e571eb56b9

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

require_relative "GoodHosts"
require_relative "Action/BaseAction"
require_relative "Action/UpdateHosts"
require_relative "Action/RemoveHosts"

module VagrantPlugins
  module GoodHosts
    # Various Vagrant hooks
    class Plugin < Vagrant.plugin('2')
      name 'GoodHosts'
      description <<-DESC
        This plugin manages the /etc/hosts file for the host machine. An entry is
        created for the hostname attribute in the vm.config.
      DESC

      config(:goodhosts) do
        require_relative 'config'
        Config
      end

      action_hook(:goodhosts, :machine_action_up) do |hook|
        hook.append(Action::UpdateHosts)
      end

      action_hook(:goodhosts, :machine_action_boot) do |hook|
        hook.append(Action::UpdateHosts)
      end

      action_hook(:goodhosts, :machine_action_provision) do |hook|
        hook.before(Vagrant::Action::Builtin::Provision, Action::UpdateHosts)
      end

      action_hook(:goodhosts, :machine_action_halt) do |hook|
        hook.append(Action::RemoveHosts)
      end

      action_hook(:goodhosts, :machine_action_suspend) do |hook|
        hook.append(Action::RemoveHosts)
      end

      action_hook(:goodhosts, :machine_action_destroy) do |hook|
        hook.append(Action::RemoveHosts)
      end

      action_hook(:goodhosts, :machine_action_reload) do |hook|
        hook.prepend(Action::RemoveHosts)
        hook.append(Action::UpdateHosts)
      end

      action_hook(:goodhosts, :machine_action_resume) do |hook|
        hook.prepend(Action::RemoveHosts)
        hook.append(Action::UpdateHosts)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-goodhosts-1.1.4 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.3 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.2 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.1 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.0 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.0beta2 lib/vagrant-goodhosts/plugin.rb
vagrant-goodhosts-1.1.0beta lib/vagrant-goodhosts/plugin.rb