Permalink
Browse files

campfire hook sends url with pushes

  • Loading branch information...
1 parent 5d0c03e commit df7097eebbc7a52ae0bf34cb913cb1af4f25f3e7 @technoweenie technoweenie committed Sep 19, 2012
Showing with 12 additions and 7 deletions.
  1. +7 −2 services/campfire.rb
  2. +5 −5 services/irc.rb
View
@@ -12,7 +12,7 @@ class << self
default_events :push, :pull_request, :issues
def receive_push
- url = data['long_url'].to_i == 1 ? summary_url : shorten_url(summary_url)
+ url = configured_summary_url
messages = []
messages << "#{summary_message}: #{url}"
messages += commit_messages.first(8)
@@ -26,7 +26,8 @@ def receive_push
end
def receive_pull_request
- send_messages summary_message if action =~ /(open)|(close)/
+ message = "#{summary_message}: #{configured_summary_url}"
+ send_messages message if action =~ /(open)|(close)/
end
alias receive_issues receive_pull_request
@@ -62,6 +63,10 @@ def campfire_domain
data['subdomain'].to_s.sub /\.campfirenow\.com$/i, ''
end
+ def configured_summary_url
+ data['long_url'].to_i == 1 ? summary_url : shorten_url(summary_url)
+ end
+
def find_room
room = campfire.find_room_by_name(data['room'])
rescue StandardError
View
@@ -97,7 +97,7 @@ def irc
socket
end
end
-
+
def new_ssl_wrapper(socket)
ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -106,19 +106,19 @@ def new_ssl_wrapper(socket)
ssl_socket.connect
ssl_socket
end
-
+
def use_ssl?
data['ssl'].to_i == 1
end
-
+
def default_port
use_ssl? ? 9999 : 6667
end
-
+
def port
data['port'] || default_port
end
-
+
def url
data['long_url'].to_i == 1 ? summary_url : shorten_url(summary_url)
end

0 comments on commit df7097e

Please sign in to comment.