5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/erasmus/github.rb', line 5
def self.extended(obj)
obj.instance_eval {
repo = Octopi::Repository.find("xiongchiamiov", "erasmus")
@flags['issues'] = lambda { |user, host, arguments, source|
if arguments[0] and arguments[0] =~ /^\d+$/
begin
issue = repo.issue(arguments[0])
say "Issue #{issue.number}: #{issue.title}"
rescue Octopi::APIError
say "No issue with id #{arguments[0]} found."
end
else
begin
repo.issues.each do |issue|
say "Issue #{issue.number}: #{issue.title}"
end
rescue Octopi::APIError
say "I'm having a problem connecting to GitHub. Try again in a bit."
end
end
}
@flags['issue-detail'] = lambda { |user, host, arguments, source|
if arguments[0] and arguments[0] =~ /^\d+$/
begin
issue = repo.issue(arguments[0])
say "Issue #{issue.number}: #{issue.title} (reported by #{issue.user})"
say "#{issue.body}"
say 'http://github.com/xiongchiamiov/erasmus/issues/#issue/' + issue.number.to_s
rescue Octopi::APIError
say "No issue with id #{arguments[0]} found."
end
end
}
}
end
|