Class: VagrantGitHooks::Action::Install

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

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ Install

Returns a new instance of Install.



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

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

Instance Method Details

#call(env) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vagrant-git-hooks/plugin.rb', line 46

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.install_on_up
rescue StandardError => e
  UiHelpers.error(env[:ui], "VGH: #{e.message}")
ensure
  @app.call(env)
end