]> Dogcows Code - chaz/p5-Catalyst-Plugin-Sitemap/commitdiff
Build results of 0db120e (on www-sitemap-xml)
authorYanick Champoux <yanick@babyl.dyndns.org>
Wed, 1 Dec 2010 02:42:04 +0000 (21:42 -0500)
committerYanick Champoux <yanick@babyl.dyndns.org>
Wed, 1 Dec 2010 02:42:04 +0000 (21:42 -0500)
Build.PL
Changes
META.json
META.yml
SIGNATURE
lib/Catalyst/Plugin/Sitemap.pm
t/lib/TestApp/Controller/Root.pm
t/sitemap.t

index 00dbc32608bab5657092281e2abb33152fa95d6f..41817dd054c27022d6667fa8b80f4ca966c777b4 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -25,7 +25,7 @@ my %module_build_args = (
     'Yanick Champoux <yanick@babyl.dyndns.org>'
   ],
   'dist_name' => 'Catalyst-Plugin-Sitemap',
-  'dist_version' => '0.0.1',
+  'dist_version' => '1.0.0',
   'license' => 'perl',
   'module_name' => 'Catalyst::Plugin::Sitemap',
   'recommends' => {},
@@ -33,7 +33,7 @@ my %module_build_args = (
   'requires' => {
     'List::Util' => '0',
     'Moose::Role' => '0',
-    'Search::Sitemap' => '0'
+    'WWW::Sitemap::XML' => '0'
   },
   'script_files' => []
 );
diff --git a/Changes b/Changes
index 231a297571f96bf9d2113b29421f685c60a00ff8..50fa6d2a0e502d3494242d9192aa6bf0ecd1bdd7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,4 +1,8 @@
 Revision history for Catalyst-Plugin-Sitemap
 
+1.0.0     2010-11-30 21:41:34 America/Montreal
+    - Change sitemap object under the hood to WWW::Sitemap::XML.
+    - Add Dancer::Plugin::SiteMap in the 'SEE ALSO' section.
+
 0.0.1     2010-09-29 20:19:12 America/Montreal
     - original version unleashed on an unsuspecting world
index 68b84c2e9150fc86407c3cf4efa50838dc49509e..3f036fe02733c519f80e285590368f732dc54e62 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Yanick Champoux <yanick@babyl.dyndns.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590",
+   "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.101590",
    "license" : [
       "perl_5"
    ],
@@ -28,7 +28,7 @@
          "requires" : {
             "List::Util" : 0,
             "Moose::Role" : 0,
-            "Search::Sitemap" : 0
+            "WWW::Sitemap::XML" : 0
          }
       },
       "test" : {
@@ -47,7 +47,7 @@
    "provides" : {
       "Catalyst::Plugin::Sitemap" : {
          "file" : "lib/Catalyst/Plugin/Sitemap.pm",
-         "version" : "v0.0.1"
+         "version" : "v1.0.0"
       }
    },
    "release_status" : "stable",
@@ -63,6 +63,6 @@
          "web" : "http://github.com/yanick/Catalyst-Plugin-Sitemap/tree"
       }
    },
-   "version" : "0.0.1"
+   "version" : "1.0.0"
 }
 
index 5cb1a5eb111b653a693de01f1f87e81dfdc61b3e..225658e00324ceaffd64739011bc50b0d7774e9a 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -15,7 +15,7 @@ build_requires:
 configure_requires:
   Module::Build: 0.3601
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590'
+generated_by: 'Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.101590'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,13 +24,13 @@ name: Catalyst-Plugin-Sitemap
 provides:
   Catalyst::Plugin::Sitemap:
     file: lib/Catalyst/Plugin/Sitemap.pm
-    version: v0.0.1
+    version: v1.0.0
 requires:
   List::Util: 0
   Moose::Role: 0
-  Search::Sitemap: 0
+  WWW::Sitemap::XML: 0
 resources:
   bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Plugin-Sitemap
   homepage: http://search.cpan.org/dist/Catalyst-Plugin-Sitemap/
   repository: git://github.com/yanick/Catalyst-Plugin-Sitemap.git
-version: 0.0.1
+version: 1.0.0
index 25fc16887dee709995d3d70c4f967d631dbe5950..ee9b3497621203de39d809f4a82dd5d540a7135c 100644 (file)
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -14,21 +14,21 @@ not run its Makefile.PL or Build.PL.
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 6e9257c1f0d56e7477a6c3dd0a89aa12da99ee34 Build.PL
-SHA1 6c29f09fb70d3a649beeeba49c327c508b8d3f21 Changes
+SHA1 ec9d7233b92322084ff257368adcd37e8f392c4f Build.PL
+SHA1 a5008ab99697e794fd04d95f623e7862990bb888 Changes
 SHA1 3ee0d276167c367325eebe1d5ec9877ade504d93 LICENSE
 SHA1 27dbcf2e21d25049bc4486395d18d7550732f2d3 MANIFEST
-SHA1 39b94a4484567596f4e466bc82f30785018cd502 META.json
-SHA1 2376cd5a83bdb52d9400ece68d4d7c5d4c7376e7 META.yml
-SHA1 659d2f7059534127e8b98ce9b276fec2be7a02a8 lib/Catalyst/Plugin/Sitemap.pm
+SHA1 abde2a3863a49bfec78410e7371c8196f4cef1ac META.json
+SHA1 7362ebdd1d8b2b1085bd8ead8ba7c574de7bc22b META.yml
+SHA1 9d90ff124e267a7a5f7968bad9197ea89d919fe4 lib/Catalyst/Plugin/Sitemap.pm
 SHA1 050aa113e828a52db3c86065c0c0ed50198b7ce8 t/000-report-versions.t
 SHA1 bcc4b2250ff00f7dfad036512681c9ee57b9cf5a t/lib/TestApp.pm
-SHA1 f2cb7af81edd193cac613e42116d29215e4d2e58 t/lib/TestApp/Controller/Root.pm
-SHA1 a3bbccffc4212a277329be0055742310bfd4eebb t/sitemap.t
+SHA1 7906b6e31e1e56c59cc970c66332f56cd41635ec t/lib/TestApp/Controller/Root.pm
+SHA1 67c7e4f0af7ea5454b0f33fb971675f2be5eb973 t/sitemap.t
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.10 (GNU/Linux)
 
-iEYEARECAAYFAkyj14cACgkQ34Hwf+GwC4zEfQCg9EWt7+v9hzOQnvTansbtqmUx
-xCAAn32842Ivd3MNl3ek05Jq239wv+Fg
-=ct87
+iEYEARECAAYFAkz1teUACgkQ34Hwf+GwC4yskQCdHR3zsy//6fNlszKwS+aF1NxO
+lnUAoOaZJ1iW9BZYtNPWsgr+/ALcUm5L
+=CqLE
 -----END PGP SIGNATURE-----
index 4730f200a6f8993a4a827fcc6f57b6be16c09366..7b172711f3807ebe3747a2c7e3768e852f8cd02b 100644 (file)
@@ -1,7 +1,8 @@
 package Catalyst::Plugin::Sitemap;
 BEGIN {
-  $Catalyst::Plugin::Sitemap::VERSION = '0.0.1';
+  $Catalyst::Plugin::Sitemap::VERSION = '1.0.0';
 }
+
 # ABSTRACT: Sitemap support for Catalyst.
 
 
@@ -12,16 +13,26 @@ use Moose::Role;
 
 no warnings qw/uninitialized/;
 
-use Search::Sitemap;
+use WWW::Sitemap::XML;
 use List::Util qw/ first /;
 
-sub sitemap {
+has sitemap => (
+    is      => 'ro',
+    builder => '_build_sitemap',
+    lazy    => 1,
+);
+
+sub sitemap_as_xml {
+    my $self = shift;
+    return $self->sitemap->as_xml->toString;
+}
+
+sub _build_sitemap {
     my $self = shift;
 
-    my $sitemap = Search::Sitemap->new;
-    $sitemap->pretty(1);
+    my $sitemap = WWW::Sitemap::XML->new;
 
-    for my $controller ( $self->controller(qr//) ) {
+    for my $controller ( map { $self->controller($_) } $self->controllers ) {
       ACTION:
         for my $a ( $controller->get_action_methods ) {
 
@@ -48,6 +59,7 @@ sub sitemap {
                 }
 
                 if ( $attr[0] + 0 > 0 ) {
+
                     # it's a number
                     $uri_params{priority} = $attr[0];
                 }
@@ -59,9 +71,7 @@ sub sitemap {
 
             $uri_params{loc} = $self->uri_for_action( $action->private_path );
 
-            $sitemap->add( \%uri_params );
-
-            next ACTION;
+            $sitemap->add(%uri_params);
         }
 
     }
@@ -81,7 +91,7 @@ Catalyst::Plugin::Sitemap - Sitemap support for Catalyst.
 
 =head1 VERSION
 
-version 0.0.1
+version 1.0.0
 
 =head1 SYNOPSIS
 
@@ -117,7 +127,7 @@ version 0.0.1
     sub sitemap : Path('/sitemap') {
         my ( $self, $c ) = @_;
  
-        $c->res->body( $c->sitemap->xml );
+        $c->res->body( $c->sitemap_as_xml );
     }
 
 =head1 DESCRIPTION
@@ -129,10 +139,14 @@ of the sitemap of a Catalyst application.
 
 =head2 sitemap()
 
-Returns a L<Search::Sitemap> object. The sitemap object is populated by 
+Returns a L<WWW::Sitemap::XML> object. The sitemap object is populated by 
 inspecting the controllers of the application for actions with the 
 sub attribute C<:Sitemap>.
 
+=head2 sitemap_as_xml()
+
+Returns the sitemap as a string containing its XML representation.
+
 =head1 C<:Sitemap> Subroutine Attribute
 
 The sitemap is populated by actions ear-marked with the <:Sitemap> sub
@@ -170,7 +184,8 @@ resolves in a single url, this will results in an error.
         ...
     }
 
-Adds the url with the given entry attributes (as defined by C<Search::Sitemap>).
+Adds the url with the given entry attributes (as defined by
+L<WWW::Sitemap::XML::URL>).
 
 If the action does not
 resolves in a single url, this will results in an error.
@@ -193,26 +208,32 @@ resolving to many urls.
 
 =back
 
-=head1 BUGS AND LIMITATIONS
-
-Currently, each invocation of the method C<sitemap()> will 
-re-generate the C<Search::Sitemap> object.  A future version
-of this module might offer a way to only compute the sitemap
-once.
-
 =head1 SEE ALSO
 
 =over
 
+=item L<WWW::Sitemap::XML>
+
+Module that C<Catalyst::Plugin::Sitemap> currently uses under the hood.
+
 =item L<Search::Sitemap>
 
+Original module that this plugin was using under the hood.
+
+=item L<Dancer::Plugin::SiteMap>
+
+Similar plugin for the L<Dancer> framework, which inspired
+C<Catalyst::Plugin::Sitemap>. 
+
 =item http://babyl.dyndns.org/techblog/entry/catalyst-plugin-sitemap
 
+Blog article introducing C<Catalyst::Plugin::Sitemap>.
+
 =back
 
 =head1 AUTHOR
 
-  Yanick Champoux <yanick@babyl.dyndns.org>
+Yanick Champoux <yanick@babyl.dyndns.org>
 
 =head1 COPYRIGHT AND LICENSE
 
index 0eb3c6e546eb7399551f5f3110f02b61fae0547a..34aa0be522c5de11b55e88e752b370f5971f0016 100644 (file)
@@ -7,8 +7,15 @@ use parent 'Catalyst::Controller';
 
 sub sitemap : Path('/sitemap') {
     my ( $self, $c ) = @_;
+    $c->res->body( $c->sitemap_as_xml );
+}
+
+sub dynamic :Path('/dynamic') {
+    my ( $self, $c ) = @_;
+
+    $c->sitemap->add( "http://localhost/sumfin" ); #''.$c->uri_for( '/sumfin' ) );
 
-    $c->res->body( $c->sitemap->xml );
+    $c->res->body( 'dynamic it is' );
 }
 
 sub alone :Local :Sitemap { }
index 10f3efe86b0d61e8c53e2a57e0f4a1f1082b2626..27804983cdc79f3f0db2b9122cf4075a8c2c4a14 100644 (file)
@@ -5,12 +5,11 @@ use warnings;
 use Test::More tests => 4;    # last test to print
 
 use lib 't/lib';
-
 use Catalyst::Test 'TestApp';
 
-my $xml = request('/sitemap')->content;
+my $xml = get('/sitemap');
 
-diag $xml;
+note $xml;
 
 $xml =~ s/\s+//g;
 
This page took 0.031063 seconds and 4 git commands to generate.