Class: Github::Hooker::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/github-hooker/cli.rb

Instance Method Summary collapse

Instance Method Details

#campfire(repo, events) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/github-hooker/cli.rb', line 22

def campfire(repo, events)
  handle_404 do
    check_config!
    events = split_events(events)
    Github::Hooker.add_hook(repo, :name => "campfire", :events => events, :config => options)
  end
end

#delete(repo, hook) ⇒ Object



41
42
43
44
45
46
# File 'lib/github-hooker/cli.rb', line 41

def delete(repo, hook)
  handle_404 do
    check_config!
    Github::Hooker.delete_hook(repo, hook)
  end
end

#list(repo) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/github-hooker/cli.rb', line 5

def list(repo)
  handle_404 do
    check_config!
    hooks = Github::Hooker.hooks(repo)
    hooks.each do |hook|
      puts "#{hook['url']}"
      puts "> name:   #{hook['name']}"
      puts "> events: #{hook['events'].join(", ")}"
      puts "> config: #{hook['config']}"
      puts
    end unless hooks.nil?
  end
end

#web(repo, events) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/github-hooker/cli.rb', line 32

def web(repo, events)
  handle_404 do
    check_config!
    events = split_events(events)
    Github::Hooker.add_hook(repo, :name => "web", :events => events, :config => options)
  end
end