Class: Ghundle::Command::Run

Inherits:
Common
  • Object
show all
Defined in:
lib/ghundle/command/run.rb

Overview

Runs the given hook, providing it with the rest of the positional arguments on the command-line.

Instance Attribute Summary

Attributes inherited from Common

#args

Instance Method Summary collapse

Methods inherited from Common

call, #initialize

Constructor Details

This class inherits a constructor from Ghundle::Command::Common

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ghundle/command/run.rb', line 10

def call
  name      = args.first
  hook_path = config.hook_path(name)
  hook      = Hook.new(Source::Local.new(hook_path))

  say "Running hook #{hook.name}"

  Signal.trap('INT') do
    say "Ctrl+C caught, aborting"
    exit
  end

  hook.run(*args[1 .. -1])

  Signal.trap('INT', 'DEFAULT')
end