Sha256: 850625f3072091f5601bc74aa34250c1decbb50aebbddaf851b08cfcfb1f6cf9

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

require_relative "BetterHosts"
require_relative "Action/BaseAction"
require_relative "Action/UpdateHosts"
require_relative "Action/RemoveHosts"

module VagrantPlugins
  module BetterHosts
    class Plugin < Vagrant.plugin('2')
      name 'BetterHosts'
      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(:betterhosts) do
        require_relative 'config'
        Config
      end

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

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

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

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

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-betterhosts-0.2.1 lib/vagrant-betterhosts/plugin.rb
vagrant-betterhosts-0.2.0 lib/vagrant-betterhosts/plugin.rb
vagrant-betterhosts-0.1.0 lib/vagrant-betterhosts/plugin.rb