[Bps-public-commit] r17661 - in Net-Google-Code/trunk: lib/Net/Google lib/Net/Google/Code t/sample
fayland at bestpractical.com
fayland at bestpractical.com
Fri Jan 9 02:48:52 EST 2009
Author: fayland
Date: Fri Jan 9 02:48:52 2009
New Revision: 17661
Modified:
Net-Google-Code/trunk/lib/Net/Google/Code.pm
Net-Google-Code/trunk/lib/Net/Google/Code/Home.pm
Net-Google-Code/trunk/t/20.code.t
Net-Google-Code/trunk/t/sample/20.code.html
Log:
add labels in Net::Google::Code
Modified: Net-Google-Code/trunk/lib/Net/Google/Code.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code.pm (original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code.pm Fri Jan 9 02:48:52 2009
@@ -38,7 +38,7 @@
require Net::Google::Code::Home;
Net::Google::Code::Home->new( parent => $_[0] );
},
- handles => [ 'owners', 'members', 'description' ],
+ handles => [ 'owners', 'members', 'description', 'labels' ],
);
has 'issue' => (
@@ -105,40 +105,52 @@
=head1 ATTRIBUTES
-=head2 url
+=over 4
+
+=item url
the project homepage
-=head2 svn_url
+=item svn_url
the project svn url (without trunk)
-=head2 description
+=item description
+
+HTML Description in 'Project Home'
+
+=item labels
-HTML Description in Project Home
+'Labels' in 'Project Home'
-=head2 owners
+=item owners
ArrayRef. project owners
-=head2 members
+=item members
ArrayRef. project members
+=back
+
=head1 METHODS
-=head2 issue
+=over 4
+
+=item issue
read L<Net::Google::Code::Issue> for the API detail
-=head2 downloads
+=item downloads
read L<Net::Google::Code::Downloads> for the API detail
-=head2 wiki
+=item wiki
read L<Net::Google::Code::Wiki> for the API detail
+=over
+
=head1 DEPENDENCIES
L<Moose>, L<HTML::TreeBuilder>, L<WWW::Mechanize>, L<Params::Validate>
Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Home.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Home.pm (original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Home.pm Fri Jan 9 02:48:52 2009
@@ -87,6 +87,23 @@
},
);
+has 'labels' => (
+ isa => 'ArrayRef',
+ is => 'ro',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+
+ my $tree = $self->__html_tree;
+ my @tags = $tree->look_down( href => qr/q\=label\:/);
+ my @labels;
+ foreach my $tag ( @tags ) {
+ push @labels, $tag->content_array_ref->[0];
+ }
+ return \@labels;
+ },
+);
+
no Moose;
__PACKAGE__->meta->make_immutable;
Modified: Net-Google-Code/trunk/t/20.code.t
==============================================================================
--- Net-Google-Code/trunk/t/20.code.t (original)
+++ Net-Google-Code/trunk/t/20.code.t Fri Jan 9 02:48:52 2009
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 12;
use Test::MockModule;
use FindBin qw/$Bin/;
use File::Slurp;
@@ -32,6 +32,7 @@
is_deeply( $project->owners, [ 'sunnavy' ] );
is_deeply( $project->members, [ 'jessev', 'fayland' ] );
like $project->description, qr/Net\:\:Google\:\:Code/;
+is_deeply( $project->labels, [ 'perl', 'Google' ] );
isa_ok( $project->connection, 'Net::Google::Code::Connection' );
isa_ok( $project->issue, 'Net::Google::Code::Issue' );
Modified: Net-Google-Code/trunk/t/sample/20.code.html
==============================================================================
--- Net-Google-Code/trunk/t/sample/20.code.html (original)
+++ Net-Google-Code/trunk/t/sample/20.code.html Fri Jan 9 02:48:52 2009
@@ -277,8 +277,10 @@
<tr><th>Labels:</th>
<td>
- <a href="/hosting/search?q=label:perl">perl</a>
-
+ <a href="/hosting/search?q=label:perl">perl</a>,
+
+ <a href="/hosting/search?q=label:Google">Google</a>
+
</td>
</tr>
More information about the Bps-public-commit
mailing list