Class: Gitty::HookCommand::Uninstall

Inherits:
Runner show all
Includes:
FileUtils
Defined in:
lib/gitty/commands/uninstall.rb

Instance Attribute Summary

Attributes inherited from Runner

#args, #stderr, #stdout

Instance Method Summary collapse

Methods inherited from Runner

#handle_show_help, run

Constructor Details

#initialize(args, stdout = STDOUT, stderr = STDERR) ⇒ Uninstall

Returns a new instance of Uninstall.



3
4
5
6
# File 'lib/gitty/commands/uninstall.rb', line 3

def initialize(args, stdout = STDOUT, stderr = STDERR)
  super
  @hookname = args.shift
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitty/commands/uninstall.rb', line 8

def run
  options = {:installed => true}
  options[:install_kind] = options[:kind] if options[:kind]
  hook = Gitty::Hook.find(@hookname, options)
  return no_hook_found unless hook
  hook.uninstall

  stdout.puts "#{hook.install_kind} hook #{hook.name} has been successfully uninstalled."
  if hook.install_kind == :shared
    stdout.puts "To propagate this change other developers, run 'git hook publish -m \"removed #{hook.name}\""
  end
end