From 34e903f5a1bb0ab937da92b495544dc902bee44a Mon Sep 17 00:00:00 2001 From: "Christian M. Weis" Date: Tue, 7 Dec 2010 22:39:05 +0100 Subject: [PATCH 1/5] display branch name on status page --- lib/cijoe.rb | 3 ++- lib/cijoe/build.rb | 2 +- lib/cijoe/views/template.erb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cijoe.rb b/lib/cijoe.rb index b5d3b36..7e082eb 100644 --- a/lib/cijoe.rb +++ b/lib/cijoe.rb @@ -124,13 +124,14 @@ def open_pipe(cmd) def build!(branch=nil) @git_branch = branch build = @current_build + @current_build.branch = git_branch output = '' git_update build.sha = git_sha write_build 'current', build open_pipe("cd #{@project_path} && #{runner_command} 2>&1") do |pipe, pid| - puts "#{Time.now.to_i}: Building #{build.short_sha}: pid=#{pid}" + puts "#{Time.now.to_i}: Building #{build.branch} at #{build.short_sha}: pid=#{pid}" build.pid = pid write_build 'current', build diff --git a/lib/cijoe/build.rb b/lib/cijoe/build.rb index 654741e..2f4ead2 100644 --- a/lib/cijoe/build.rb +++ b/lib/cijoe/build.rb @@ -1,7 +1,7 @@ require 'yaml' class CIJoe - class Build < Struct.new(:project_path, :user, :project, :started_at, :finished_at, :sha, :status, :output, :pid) + class Build < Struct.new(:project_path, :user, :project, :started_at, :finished_at, :sha, :status, :output, :pid, :branch) def initialize(*args) super self.started_at ||= Time.now diff --git a/lib/cijoe/views/template.erb b/lib/cijoe/views/template.erb index 9c60a1d..d343239 100644 --- a/lib/cijoe/views/template.erb +++ b/lib/cijoe/views/template.erb @@ -19,7 +19,7 @@
  • <%= pretty_time(joe.current_build.started_at) if joe.current_build %> » <% if joe.current_build.sha %> - Building <%= joe.current_build.short_sha %> (pid: <%= joe.pid %>) + Building <%= joe.current_build.branch %> at <%= joe.current_build.short_sha %> (pid: <%= joe.pid %>) <% else %> Build starting... <% end %> @@ -32,7 +32,7 @@
  • <%= pretty_time(joe.last_build.finished_at) %> » <% if joe.last_build.sha %> - Built <%= joe.last_build.short_sha %> + Built <%= joe.current_build.branch %> at <%= joe.last_build.short_sha %> <% end %> (<%= joe.last_build.status %>) <% if joe.last_build.duration %> From 762593c88225a3c0234ac7f1fdf271f60f8aed5b Mon Sep 17 00:00:00 2001 From: "Christian M. Weis" Date: Tue, 7 Dec 2010 22:43:14 +0100 Subject: [PATCH 2/5] version bump for 'gem build' to work --- lib/cijoe/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cijoe/version.rb b/lib/cijoe/version.rb index b47aa1f..3004e1a 100644 --- a/lib/cijoe/version.rb +++ b/lib/cijoe/version.rb @@ -1,3 +1,3 @@ class CIJoe - Version = VERSION = "0.5.0" + Version = VERSION = "0.7.2" end From 230c66439b5d9a091fade63903d41095a01f858c Mon Sep 17 00:00:00 2001 From: "Christian M. Weis" Date: Tue, 7 Dec 2010 23:18:58 +0100 Subject: [PATCH 3/5] fixed wrong method call --- lib/cijoe/views/template.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cijoe/views/template.erb b/lib/cijoe/views/template.erb index d343239..e646e07 100644 --- a/lib/cijoe/views/template.erb +++ b/lib/cijoe/views/template.erb @@ -32,7 +32,7 @@
  • <%= pretty_time(joe.last_build.finished_at) %> » <% if joe.last_build.sha %> - Built <%= joe.current_build.branch %> at <%= joe.last_build.short_sha %> + Built <%= joe.last_build.branch %> at <%= joe.last_build.short_sha %> <% end %> (<%= joe.last_build.status %>) <% if joe.last_build.duration %> From 93fdd30d20776e0e46a8de50c2bc0f3d384fc2aa Mon Sep 17 00:00:00 2001 From: "Christian M. Weis" Date: Tue, 7 Dec 2010 23:19:55 +0100 Subject: [PATCH 4/5] make the way branch set the same way sha is --- lib/cijoe.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cijoe.rb b/lib/cijoe.rb index 7e082eb..7249e27 100644 --- a/lib/cijoe.rb +++ b/lib/cijoe.rb @@ -124,10 +124,10 @@ def open_pipe(cmd) def build!(branch=nil) @git_branch = branch build = @current_build - @current_build.branch = git_branch output = '' git_update build.sha = git_sha + build.branch = git_branch write_build 'current', build open_pipe("cd #{@project_path} && #{runner_command} 2>&1") do |pipe, pid| From b8826b7aec2417fec7b37dde604f2b53760aa0de Mon Sep 17 00:00:00 2001 From: "Christian M. Weis" Date: Tue, 7 Dec 2010 23:36:58 +0100 Subject: [PATCH 5/5] add branch to dump... --- lib/cijoe/build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cijoe/build.rb b/lib/cijoe/build.rb index 2f4ead2..5276be9 100644 --- a/lib/cijoe/build.rb +++ b/lib/cijoe/build.rb @@ -52,7 +52,7 @@ def commit end def dump(file) - config = [user, project, started_at, finished_at, sha, status, output, pid] + config = [user, project, started_at, finished_at, sha, status, output, pid, branch] data = YAML.dump(config) File.open(file, 'wb') { |io| io.write(data) } end