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



26
27
28
29
30
31
32
# File 'lib/github-hooker/cli.rb', line 26

def campfire(repo, events)
  handle_404 do
    check_config!
    events = split_events(events)
    Github::Hooker.add_hook(repo, :name => "campfire", :events => events, :config => options.reverse_merge("token" => Github::Hooker::Config.config['campfire_token']))
  end
end

#delete(repo, hook) ⇒ Object



58
59
60
61
62
63
# File 'lib/github-hooker/cli.rb', line 58

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

#email(repo, events) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/github-hooker/cli.rb', line 38

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

#list(repo) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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 "> updated_at: #{hook['updated_at']}"
      puts "> created_at: #{hook['created_at']}"
      puts "> events:     #{hook['events'].join(", ")}"
      puts "> active:     #{hook['active']}"
      puts "> config:     #{hook['config']}"
      puts
    end unless hooks.nil?
  end
end

#web(repo, events) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/github-hooker/cli.rb', line 49

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