]> Dogcows Code - chaz/p5-Catalyst-Plugin-Sitemap/commitdiff
preparing for a first release
authorYanick Champoux <yanick@babyl.dyndns.org>
Thu, 30 Sep 2010 00:16:33 +0000 (20:16 -0400)
committerYanick Champoux <yanick@babyl.dyndns.org>
Thu, 30 Sep 2010 00:19:02 +0000 (20:19 -0400)
.gitignore [new file with mode: 0644]
Changes [new file with mode: 0644]
MANIFEST [new file with mode: 0644]
MANIFEST.SKIP [new file with mode: 0644]
dist.ini
lib/Catalyst/Plugin/Sitemap.pm

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5ecf871
--- /dev/null
@@ -0,0 +1 @@
+Catalyst-Plugin-Sitemap*
diff --git a/Changes b/Changes
new file mode 100644 (file)
index 0000000..176babc
--- /dev/null
+++ b/Changes
@@ -0,0 +1,4 @@
+Revision history for Catalyst-Plugin-Sitemap
+
+{{$NEXT}}
+    - original version unleashed on an unsuspecting world
diff --git a/MANIFEST b/MANIFEST
new file mode 100644 (file)
index 0000000..3ec753a
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,12 @@
+Build.PL
+Changes
+LICENSE
+MANIFEST
+META.json
+META.yml
+SIGNATURE
+lib/Catalyst/Plugin/Sitemap.pm
+t/000-report-versions.t
+t/lib/TestApp.pm
+t/lib/TestApp/Controller/Root.pm
+t/sitemap.t
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644 (file)
index 0000000..afd4b65
--- /dev/null
@@ -0,0 +1,4 @@
+Catalyst-Plugin-Sitemap
+dist.ini
+MANIFEST.SKIP
+.gitignore
index acbdfe9c029393bd62bb7b52d1b42b2a38116b77..d027d8071a6f1a6577c87278e7c0174a5bc0d6e3 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -4,3 +4,73 @@ license = Perl_5
 copyright_holder = Yanick Champoux
 copyright_year   = 2010
 
 copyright_holder = Yanick Champoux
 copyright_year   = 2010
 
+version = 0.0.1
+
+[ModuleBuild]
+
+[GithubMeta]
+remote=github
+
+[Homepage]
+[Bugtracker]
+
+[MetaYAML]
+[MetaJSON]
+
+[PodWeaver]
+
+;[ExecDir]
+;dir=scripts
+
+[License]
+;[Repository]
+
+[NextRelease]
+time_zone = America/Montreal
+
+[MetaProvides::Package]
+
+[MatchManifest]
+[ManifestSkip]
+
+[GatherDir]
+
+[PkgVersion]
+[PodVersion]
+
+;Tests
+[ReportVersions]
+
+[Signature]
+
+[AutoPrereq]
+
+
+; Build
+
+; Release 
+[CheckChangesHasContent]
+
+[TestRelease]
+
+
+[ConfirmRelease]
+
+[Git::Check]
+
+[Git::Commit]
+
+[Git::CommitBuild]
+release_branch = releases
+
+[Git::Tag]
+tag_format = v%v
+branch = releases
+
+[Git::Push]
+push_to = github
+
+[UploadToCPAN]
+
+[Twitter]
+;hash_tags = #perl #cpan #netpacket
index 73639508f26c3c2b1fa3034011aa8b9861e4e0d2..3cadf65c89ae51ea3cdb4192e9cb0e7308d417d2 100644 (file)
@@ -1,4 +1,137 @@
 package Catalyst::Plugin::Sitemap;
 package Catalyst::Plugin::Sitemap;
+# ABSTRACT: Sitemap support for Catalyst.
+
+=head1 SYNOPSIS
+
+    # in MyApp.pm
+
+    use Catalyst qw/ Sitemap /;
+
+    # in the controller
+    
+    sub alone :Local :Sitemap { 
+        ... 
+    }
+    
+    sub with_priority :Local :Sitemap(0.75) {
+        ... 
+    }
+    
+    sub with_args :Local
+            :Sitemap( lastmod => 2010-09-27, changefreq => daily ) {
+        ...
+    }
+    
+    sub with_function :Local :Sitemap(*) { 
+        ... 
+    }
+    
+    sub with_function_sitemap {
+        $_[2]->add( 'http://localhost/with_function' );
+    }
+
+    # and then...
+    
+    sub sitemap : Path('/sitemap') {
+        my ( $self, $c ) = @_;
+        $c->res->body( $c->sitemap->xml );
+    }
+
+=head1 DESCRIPTION
+
+L<Catalyst::Plugin::Sitemap> provides a way to semi-automate the creation 
+of the sitemap of a Catalyst application.
+
+=head1 CONTEXT METHOD
+
+=head2 sitemap()
+
+Returns a L<Search::Sitemap> object. The sitemap object is populated by 
+inspecting the controllers of the application for actions with the 
+sub attribute C<:Sitemap>.
+
+=head1 C<:Sitemap> Subroutine Attribute
+
+The sitemap is populated by actions ear-marked with the <:Sitemap> sub
+attribute.  It can be invoked in different ways:
+
+=over
+
+=item C<:Sitemap>
+
+    sub alone :Local :Sitemap {
+        ...
+    }
+
+Adds the url of the action to the sitemap.  
+
+If the action does not
+resolves in a single url, this will results in an error.
+
+=item C<:Sitemap($priority)>
+
+
+    sub with_priority :Local :Sitemap(0.9) {
+        ...
+    }
+
+Adds the url, with the given number, which has to be between 1 (inclusive)
+and 0 (exclusive), as its priority.
+
+If the action does not
+resolves in a single url, this will results in an error.
+
+=item C<:Sitemap( %attributes )>
+
+    sub with_args :Local
+            :Sitemap( lastmod => 2010-09-27, changefreq => daily ) {
+        ...
+    }
+
+Adds the url with the given entry attributes (as defined by C<Search::Sitemap>).
+
+If the action does not
+resolves in a single url, this will results in an error.
+
+=item C<:Sitemap(*)>
+
+    sub with_function :Local :Sitemap(*) { }
+    
+    sub with_function_sitemap {
+        my ( $self, $c, $sitemap ) = @_;
+
+        $sitemap->add( 'http://localhost/with_function' );
+    }
+
+Calls the function 'I<action>_sitemap', if it exists, and passes it the
+controller, context and sitemap objects.
+
+This is currently the only way to invoke C<:Sitemap> on an action 
+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<Search::Sitemap>
+
+=item http://babyl.dyndns.org/techblog/entry/catalyst-plugin-sitemap
+
+=back
+
+=cut
 
 use strict;
 use warnings;
 
 use strict;
 use warnings;
@@ -67,23 +200,3 @@ sub sitemap {
 1;
 
 __END__
 1;
 
 __END__
-
-ways I can do it
-
-is Sitemap( <yadah> ) ? => use it as is
-else => has <action>_sitemap? => use it
-else => use the uri directly
-
-
-sitemap => sub {
-    my ( $self, $c, $sitemap ) = @_;
-
-    ...
-};
-
-sub action_sitemap {
-    my ( $self, $c, $sitemap ) = @_;
-}
-
-sub do_stuff :Local :Sitemap {
-}
This page took 0.026526 seconds and 4 git commands to generate.