Skip to content

Commit

Permalink
Oops, need to pass the build to campfire when we notify. Just did a p…
Browse files Browse the repository at this point in the history
…roduction test.
  • Loading branch information
queso committed Apr 19, 2011
1 parent 3ffcbbd commit 02d4ef6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/cijoe.rb
Expand Up @@ -79,7 +79,7 @@ def finish_build(status, output)
@current_build = nil
write_build 'current', @current_build
write_build 'last', @last_build
@campfire.notify if @campfire.valid?
@campfire.notify(@last_build) if @campfire.valid?

# another build waits
if !repo_config.buildallfile.to_s.empty? && File.exist?(repo_config.buildallfile.to_s)
Expand Down
21 changes: 11 additions & 10 deletions lib/cijoe/campfire.rb
@@ -1,6 +1,6 @@
class CIJoe
class Campfire
attr_reader :project_path
attr_reader :project_path, :build

def initialize(project_path)
@project_path = project_path
Expand Down Expand Up @@ -34,10 +34,11 @@ def valid?
end
end

def notify
def notify(build)
begin
room.speak "#{short_message}. #{commit.url}"
room.paste full_message if failed?
@build = build
room.speak "#{short_message}. #{build.commit.url}"
room.paste full_message if build.failed?
room.leave
rescue
puts "Please check your campfire config for #{project_path}."
Expand All @@ -56,17 +57,17 @@ def room
end

def short_message
"#{branch} at #{short_sha} of #{project} " +
(worked? ? "passed" : "failed") + " (#{duration.to_i}s)"
"#{build.branch} at #{build.short_sha} of #{build.project} " +
(build.worked? ? "passed" : "failed") + " (#{build.duration.to_i}s)"
end

def full_message
<<-EOM
Commit Message: #{commit.message}
Commit Date: #{commit.committed_at}
Commit Author: #{commit.author}
Commit Message: #{build.commit.message}
Commit Date: #{build.commit.committed_at}
Commit Author: #{build.commit.author}
#{clean_output}
#{build.clean_output}
EOM
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cijoe/version.rb
@@ -1,3 +1,3 @@
class CIJoe
Version = VERSION = "0.9.1"
Version = VERSION = "0.9.2"
end

0 comments on commit 02d4ef6

Please sign in to comment.