[Bps-public-commit] smokingit branch, master, updated. bf412494e3c358d0a2888c790eb42423727f49ee
Kevin Falcone
falcone at bestpractical.com
Wed Aug 3 16:45:45 EDT 2011
The branch, master has been updated
via bf412494e3c358d0a2888c790eb42423727f49ee (commit)
from 53d9373e4d6ed8d6e04bd71a9a2b4b024cb09e5a (commit)
Summary of changes:
Makefile.PL | 1 +
lib/Smokingit/Model/Branch.pm | 22 ++++++++++++++++++++++
lib/Smokingit/View/Project.pm | 2 +-
3 files changed, 24 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit bf412494e3c358d0a2888c790eb42423727f49ee
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Wed Aug 3 16:44:15 2011 -0400
Add a format_user method and use it to show the next actor on a branch
This lets us tell from the top level view of a project who is supposed
to be working on a branch next.
diff --git a/Makefile.PL b/Makefile.PL
index 39552e1..44c4dfa 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,5 +4,6 @@ name 'Smokingit';
version '0.01';
requires 'Jifty' => '1.01209';
requires 'Gearman::Client';
+requires 'Git::PurePerl';
WriteAll;
diff --git a/lib/Smokingit/Model/Branch.pm b/lib/Smokingit/Model/Branch.pm
index 63c58a4..1c89eb3 100644
--- a/lib/Smokingit/Model/Branch.pm
+++ b/lib/Smokingit/Model/Branch.pm
@@ -260,5 +260,27 @@ sub test_status {
return $self->current_commit->status;
}
+=head2
+
+Looks at current_actor, owner or review_by (based on single argument) and tries
+to extract the local part of the email address using a stunningly bad regular expression.
+
+When we get user accounts, this will become $branch->current_actor->name
+
+=cut
+
+sub format_user {
+ my ($self, $type) = @_;
+ if ($self->can($type)) {
+ if ( $self->$type =~ m/<(.*?)@/ ) {
+ return $1;
+ }
+ } else {
+ Jifty->log->error("Unable to call $type on a branch");
+ }
+ return 'unknown';
+
+}
+
1;
diff --git a/lib/Smokingit/View/Project.pm b/lib/Smokingit/View/Project.pm
index f55c864..9f566c8 100644
--- a/lib/Smokingit/View/Project.pm
+++ b/lib/Smokingit/View/Project.pm
@@ -158,7 +158,7 @@ sub branchlist {
li {
{ class is $b->test_status; }
hyperlink(
- label => $b->name,
+ label => $b->name . " (" . $b->format_user('current_actor') . ")",
url => "branch/" . $b->name,
);
branchlist($b->branches, %args)
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list