Class: VagrantGitHooks::Action::Uninstall

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-git-hooks/plugin.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ Uninstall

Returns a new instance of Uninstall.



84
# File 'lib/vagrant-git-hooks/plugin.rb', line 84

def initialize(app, _env) = (@app = app)

Instance Method Details

#call(env) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vagrant-git-hooks/plugin.rb', line 86

def call(env)
  UiHelpers.setup_i18n!
  cfg = env[:machine].config.git_hooks
  UiHelpers.setup_locale_from_config!(cfg)
  ui   = env[:ui]
  root = env[:machine].env.root_path.to_s

  run(cfg, ui, root) if cfg.remove_on_destroy
rescue StandardError => e
  UiHelpers.error(env[:ui], "VGH: #{e.message}")
ensure
  @app.call(env)
end