Skip to content

Loading…

Fix missing require, working hipchat support. #26

Merged
merged 11 commits into from

3 participants

@jsmestad

Think this was missed in the latest merge and I have verified working hipchat support with these changes.

@schisamo

@jsmestad good catch on this stuff. @sr we will def want to merge these few fixes/enhancements

@sr sr commented on the diff
lib/janky/notifier/chat.rb
@@ -5,13 +5,14 @@ def self.completed(build)
status = build.green? ? "was successful" : "failed"
color = build.green? ? "green" : "red"
- message = "Build #%s (%s) of %s/%s %s (%ss) %s" % [
+ message = "Build #%s (%s) of %s/%s %s (%ss) <a href='%s'>%s</a>" % [
@sr
sr added a note

Reverting this, won't work in Campfire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sr sr commented on the diff
lib/janky.rb
@@ -156,7 +155,7 @@ def self.setup(settings)
chat_name = settings["JANKY_CHAT"] || "campfire"
chat_settings = {}
settings.each do |key, value|
- if key =~ /^JANKY_CHAT_#{chat_name}_/
+ if key =~ /^JANKY_CHAT_#{chat_name}_/i
@sr
sr added a note

Reverting this as well, we always want uppercases here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sr
sr commented

Awesome, thanks. Sorry for the delay.

@sr sr merged commit 4738159 into github:master
@sr sr commented on the diff
lib/janky/hubot.rb
@@ -35,7 +35,7 @@ class Hubot < Sinatra::Base
repo = find_repo(repo_name)
branch = repo.branch_for(branch_name)
build = branch.current_build
- room_id = params["room_id"] && Integer(params["room_id"])
+ room_id = params["room_id"] && Integer(params["room_id"]) rescue nil
@sr
sr added a note

What was the issue here? Does Hubot/HipChat not send a room_id or something?

Hipchat supports private messages which does not have a room id. This fixes that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gavinheavyside gavinheavyside pushed a commit that referenced this pull request
@sr sr revert unwanted changes introduced in #26 b5d2cb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 15 additions and 15 deletions.
  1. +1 −2 lib/janky.rb
  2. +2 −2 lib/janky/chat/campfire.rb
  3. +3 −3 lib/janky/chat/hipchat.rb
  4. +7 −7 lib/janky/hubot.rb
  5. +2 −1 lib/janky/notifier/chat.rb
View
3 lib/janky.rb
@@ -38,7 +38,6 @@
require "janky/chat/campfire"
require "janky/chat/hipchat"
require "janky/chat/mock"
-require "janky/chat/room"
require "janky/exception"
require "janky/notifier"
require "janky/notifier/chat"
@@ -156,7 +155,7 @@ def self.setup(settings)
chat_name = settings["JANKY_CHAT"] || "campfire"
chat_settings = {}
settings.each do |key, value|
- if key =~ /^JANKY_CHAT_#{chat_name}_/
+ if key =~ /^JANKY_CHAT_#{chat_name}_/i
@sr
sr added a note

Reverting this as well, we always want uppercases here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
chat_settings[key] = value
end
end
View
4 lib/janky/chat/campfire.rb
@@ -3,8 +3,8 @@ module Chat
class Campfire
def initialize(settings)
Broach.settings = {
- "account" => settings['JANKY_CAMPFIRE_ACCOUNT'],
- "token" => settings['JANKY_CAMPFIRE_TOKEN'],
+ "account" => settings['JANKY_CHAT_CAMPFIRE_ACCOUNT'],
+ "token" => settings['JANKY_CHAT_CAMPFIRE_TOKEN'],
"use_ssl" => true
}
end
View
6 lib/janky/chat/hipchat.rb
@@ -2,12 +2,12 @@ module Janky
module Chat
class HipChat
def initialize(settings)
- @client = ::HipChat::Client.new(settings["JANKY_HIPCHAT_TOKEN"])
- @from = settings["JANKY_HIPCHAT_FROM"] || "CI"
+ @client = ::HipChat::Client.new(settings["JANKY_CHAT_HIPCHAT_TOKEN"])
+ @from = settings["JANKY_CHAT_HIPCHAT_FROM"] || "CI"
end
def speak(message, room_id, options = {:color => "yellow"})
- @client[room_id].send(from, message, options[:color])
+ @client[room_id].send(@from, message, options)
end
def rooms
View
14 lib/janky/hubot.rb
@@ -35,7 +35,7 @@ class Hubot < Sinatra::Base
repo = find_repo(repo_name)
branch = repo.branch_for(branch_name)
build = branch.current_build
- room_id = params["room_id"] && Integer(params["room_id"])
+ room_id = params["room_id"] && Integer(params["room_id"]) rescue nil
@sr
sr added a note

What was the issue here? Does Hubot/HipChat not send a room_id or something?

Hipchat supports private messages which does not have a room id. This fixes that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if build
build.rerun(room_id)
@@ -105,12 +105,12 @@ class Hubot < Sinatra::Base
get "/help" do
content_type "text/plain"
<<-EOS
-hubot ci build janky
-hubot ci build janky/fix-everything
-hubot ci setup github/janky [name]
-hubot ci toggle janky
-hubot ci rooms
-hubot ci set room janky The Danger Room
+ci build janky
+ci build janky/fix-everything
+ci setup github/janky [name]
+ci toggle janky
+ci rooms
+ci set room janky development
EOS
end
end
View
3 lib/janky/notifier/chat.rb
@@ -5,13 +5,14 @@ def self.completed(build)
status = build.green? ? "was successful" : "failed"
color = build.green? ? "green" : "red"
- message = "Build #%s (%s) of %s/%s %s (%ss) %s" % [
+ message = "Build #%s (%s) of %s/%s %s (%ss) <a href='%s'>%s</a>" % [
@sr
sr added a note

Reverting this, won't work in Campfire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
build.number,
build.sha1,
build.repo_name,
build.branch_name,
status,
build.duration,
+ build.compare,
build.compare
]
Something went wrong with that request. Please try again.