Created
May 14, 2009 10:16
-
-
Save susieyy/111606 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redmine-supybot-plugin / init.rb | |
require_dependency 'supy_issue_hook' | |
# redmine-supybot-plugin / lib / suppy_issue_hook.rb | |
class SupyIssueHook < Redmine::Hook::Listener | |
def controller_issues_new_after_save(context = { }) | |
subject = context[:issue].subject | |
project = context[:project].description | |
tracker = Tracker.find(context[:issue].tracker_id) | |
aut = User.find_by_id(context[:issue].author_id) | |
if aut | |
author = aut.login | |
else | |
author = 'Anonymous' | |
end | |
binary = '/path/to/sypybot-external-control-script' | |
network = 'network' # freenode, oftc | |
port = 'supybot port' | |
channel = 'channel to announce to' | |
msg = 'echo [ color green ' + author + ':][ color yellow Added new ' + tracker.name + '][color teal on ' + project + '][color orange * ' + subject + ']' | |
msg2 = 'echo [ color green ' + author + ':][ color white http://dev.opensde.net/issues/show/' + context[:issue].id.to_s + ']' | |
cmd = 'binary -d -n network -p port -c "channel" -t "' + msg + '"' | |
cmd2 = 'binary -d -n network -p port -c "channel" -t "' + msg2 + '"' | |
value1 = system("#{cmd}") | |
value2 = system("#{cmd2}") | |
return '' | |
end | |
def controller_issues_edit_after_save(context = { }) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment