Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: github/github-services
...
head fork: davglass/github-services
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 11 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 21 additions and 9 deletions.
  1. +2 −0  docs/irc
  2. +7 −3 docs/trac
  3. +12 −6 services/irc.rb
View
2  docs/irc
@@ -12,6 +12,7 @@ Install Notes
room_name::password
6. prefixing '#' to the room field is optional
7. nick is not required, if provided the IRCBot will use that nick
+ 8. quiet will make the bot only issue one message to the channel, omitting commit data.
Developer Notes
@@ -24,6 +25,7 @@ data
- password
- ssl
- nick
+ - quiet
payload
- refer to docs/github_payload
View
10 docs/trac
@@ -1,10 +1,13 @@
Trac
-====
+=====
-Install the following plugin on your Trac server before proceeding: http://github.com/davglass/github-trac/
+
+Install the following plugin on your Trac server before proceeding:
+http://github.com/davglass/github-trac/
1. url field is your Trac install's url
- 2. token (this needs to be the same token you put in your trac.ini installed via the plugin)
+ 2. token (this needs to be the same token you put in
+ your trac.ini installed via the plugin)
The plugin searches commit messages for text in the form of:
@@ -18,3 +21,4 @@ Instead of the short-hand syntax "#1", "ticket:1" can be used as well, e.g.:
command ticket:1, ticket:2
command ticket:1 & ticket:2
command ticket:1 and ticket:2
+
View
18 services/irc.rb
@@ -3,6 +3,7 @@
branch = (payload['ref'] =~ /^refs\/heads\/(.+)$/ ? $1 : payload['ref'])
rooms = data['room'].gsub(",", " ").split(" ").map{|room| room[0].chr == '#' ? room : "##{room}"}
botname = data['nick'] || "GitHub#{rand(200)}"
+ short = data['short'] || false
socket = nil
begin
@@ -46,14 +47,19 @@
rooms.each do |room|
room, pass = room.split("::")
irc.puts "JOIN #{room} #{pass}"
- payload['commits'].each do |commit|
- sha1 = commit['id']
+ if short
+ tiny_url = shorten_url(payload['repository']['url'])
+ irc.puts "PRIVMSG #{room} :\002#{repository} pushed to #{branch}: #{tiny_url}\002"
+ else
+ payload['commits'].each do |commit|
+ sha1 = commit['id']
- tiny_url = shorten_url(commit['url'])
+ tiny_url = shorten_url(commit['url'])
- irc.puts "PRIVMSG #{room} :\002#{repository}:\002 \0033#{commit['author']['name']} \00307#{branch}\0030 SHA1-\002#{sha1[0..6]}\002"
- irc.puts "PRIVMSG #{room} :#{commit['message']}"
- irc.puts "PRIVMSG #{room} :#{tiny_url}"
+ irc.puts "PRIVMSG #{room} :\002#{repository}:\002 \0033#{commit['author']['name']} \00307#{branch}\0030 SHA1-\002#{sha1[0..6]}\002"
+ irc.puts "PRIVMSG #{room} :#{commit['message']}"
+ irc.puts "PRIVMSG #{room} :#{tiny_url}"
+ end
end
irc.puts "PART #{room}"
end

No commit comments for this range

Something went wrong with that request. Please try again.