convert to Dist::Zilla bphillips/dzilification mirror/bphillips/dzilification
Brian Phillips [Thu, 13 Oct 2011 16:46:55 +0000 (11:46 -0500)]
33 files changed:
MANIFEST.SKIP [deleted file]
Makefile.PL
README [deleted file]
dist.ini [new file with mode: 0644]
lib/Catalyst/Action/Deserialize.pm
lib/Catalyst/Action/Deserialize/Callback.pm
lib/Catalyst/Action/Deserialize/Data/Serializer.pm
lib/Catalyst/Action/Deserialize/JSON.pm
lib/Catalyst/Action/Deserialize/View.pm
lib/Catalyst/Action/Deserialize/XML/Simple.pm
lib/Catalyst/Action/Deserialize/YAML.pm
lib/Catalyst/Action/DeserializeMultiPart.pm
lib/Catalyst/Action/REST.pm
lib/Catalyst/Action/REST/ForBrowsers.pm
lib/Catalyst/Action/Serialize.pm
lib/Catalyst/Action/Serialize/Callback.pm
lib/Catalyst/Action/Serialize/Data/Serializer.pm
lib/Catalyst/Action/Serialize/JSON.pm
lib/Catalyst/Action/Serialize/JSON/XS.pm
lib/Catalyst/Action/Serialize/JSONP.pm
lib/Catalyst/Action/Serialize/View.pm
lib/Catalyst/Action/Serialize/XML/Simple.pm
lib/Catalyst/Action/Serialize/YAML.pm
lib/Catalyst/Action/Serialize/YAML/HTML.pm
lib/Catalyst/Action/SerializeBase.pm
lib/Catalyst/Controller/REST.pm
lib/Catalyst/Request/REST.pm
lib/Catalyst/Request/REST/ForBrowsers.pm
lib/Catalyst/TraitFor/Request/REST.pm
lib/Catalyst/TraitFor/Request/REST/ForBrowsers.pm
xt/pod-spell.t [deleted file]
xt/pod.t [deleted file]
xt/version-numbers.t [deleted file]

diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
deleted file mode 100644 (file)
index 8363db3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Version control files and dirs.
-\bRCS\b
-\bCVS\b
-,v$
-\B\.svn\b
-\B\.git(ignore)?\b
-
-# Makemaker generated files and dirs.
-^MANIFEST\.
-^Makefile$
-^MYMETA\.
-^blib/
-^MakeMaker-\d
-^pm_to_blib$
-^Catalyst-Action-REST-
-# Temp, old and emacs backup files.
-~$
-\.old$
-^#.*#$
-^\.#
-\.shipit
index 8b0ce01..5242450 100644 (file)
@@ -74,7 +74,4 @@ if ($Module::Install::AUTHOR) {
 
 repository 'git://git.shadowcat.co.uk/catagits/Catalyst-Action-REST.git';
 
-add_metadata( x_authority => 'cpan:BOBTFISH' );
-
 WriteAll;
-
diff --git a/README b/README
deleted file mode 100644 (file)
index b7d5b0a..0000000
--- a/README
+++ /dev/null
@@ -1,110 +0,0 @@
-NAME
-    Catalyst::Action::REST - Automated REST Method Dispatching
-
-SYNOPSIS
-        sub foo :Local :ActionClass('REST') {
-          ... do setup for HTTP method specific handlers ...
-        }
-
-        sub foo_GET {
-          ... do something for GET requests ...
-        }
-
-        # alternatively use an Action
-        sub foo_PUT : Action {
-          ... do something for PUT requests ...
-        }
-
-DESCRIPTION
-    This Action handles doing automatic method dispatching for REST
-    requests. It takes a normal Catalyst action, and changes the dispatch to
-    append an underscore and method name. First it will try dispatching to
-    an action with the generated name, and failing that it will try to
-    dispatch to a regular method.
-
-    For example, in the synopsis above, calling GET on "/foo" would result
-    in the foo_GET method being dispatched.
-
-    If a method is requested that is not implemented, this action will
-    return a status 405 (Method Not Found). It will populate the "Allow"
-    header with the list of implemented request methods. You can override
-    this behavior by implementing a custom 405 handler like so:
-
-       sub foo_not_implemented {
-          ... handle not implemented methods ...
-       }
-
-    If you do not provide an _OPTIONS subroutine, we will automatically
-    respond with a 200 OK. The "Allow" header will be populated with the
-    list of implemented request methods.
-
-    It is likely that you really want to look at Catalyst::Controller::REST,
-    which brings this class together with automatic Serialization of
-    requests and responses.
-
-    When you use this module, it adds the Catalyst::TraitFor::Request::REST
-    role to your request class.
-
-METHODS
-    dispatch
-        This method overrides the default dispatch mechanism to the
-        re-dispatching mechanism described above.
-
-SEE ALSO
-    You likely want to look at Catalyst::Controller::REST, which implements
-    a sensible set of defaults for a controller doing REST.
-
-    This class automatically adds the Catalyst::TraitFor::Request::REST role
-    to your request class. If you're writing a web application which
-    provides RESTful responses and still needs to accommodate web browsers,
-    you may prefer to use Catalyst::TraitFor::Request::REST::ForBrowsers
-    instead.
-
-    Catalyst::Action::Serialize, Catalyst::Action::Deserialize
-
-TROUBLESHOOTING
-    Q: I'm getting a "415 Unsupported Media Type" error. What gives?!
-        A: Most likely, you haven't set Content-type equal to
-        "application/json", or one of the accepted return formats. You can
-        do this by setting it in your query accepted return formats. You can
-        do this by setting it in your query string thusly:
-        "?content-type=application%2Fjson (where %2F == / uri escaped)."
-
-        NOTE Apache will refuse %2F unless configured otherwise. Make sure
-        "AllowEncodedSlashes On" is in your httpd.conf file in order for
-        this to run smoothly.
-
-AUTHOR
-    Adam Jacob <adam@stalecoffee.org>, with lots of help from mst and
-    jrockway
-
-    Marchex, Inc. paid me while I developed this module.
-    (<http://www.marchex.com>)
-
-CONTRIBUTORS
-    Tomas Doran (t0m) <bobtfish@bobtfish.net>
-
-    John Goulah
-
-    Christopher Laco
-
-    Daisuke Maki <daisuke@endeworks.jp>
-
-    Hans Dieter Pearcey
-
-    Brian Phillips <bphillips@cpan.org>
-
-    Dave Rolsky <autarch@urth.org>
-
-    Luke Saunders
-
-    Arthur Axel "fREW" Schmidt <frioux@gmail.com>
-
-    J. Shirley <jshirley@gmail.com>
-
-COPYRIGHT
-    Copyright (c) 2006-2011 the above named AUTHOR and CONTRIBUTORS
-
-LICENSE
-    You may distribute this code under the same terms as Perl itself.
-
diff --git a/dist.ini b/dist.ini
new file mode 100644 (file)
index 0000000..09017d0
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,112 @@
+name    = Catalyst-Action-REST
+version = 0.93
+author  = Adam Jacob <adam@stalecoffee.org>
+license = Perl_5
+copyright_holder = Adam Jacob
+
+[GatherDir]
+[MetaJSON]
+
+; There's not good Module::Install support for our optional dependencies...
+; FakeFaker will just use our previously created Makefile.PL for now
+[FakeFaker]
+[Manifest]
+[ManifestSkip]
+[PruneCruft]
+[License]
+[Readme]
+[PkgVersion]
+[Repository]
+web = http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalyst-Action-REST.git;a=summary
+[Authority]
+
+[@Git]
+
+[ExtraTests]
+[PodSyntaxTests]
+[Test::PodSpelling]
+stopwords = Wiki
+stopwords = json
+stopwords = APIs
+stopwords = ActionClass
+stopwords = Daisuke
+stopwords = Daisuke
+stopwords = Deserialize
+stopwords = Deserializer
+stopwords = Deserializing
+stopwords = Doran
+stopwords = Goulah
+stopwords = JSON
+stopwords = Laco
+stopwords = Maki
+stopwords = Maki
+stopwords = Marchex
+stopwords = Multipart
+stopwords = Pearcey
+stopwords = Rolsky
+stopwords = RESTful
+stopwords = RESTful
+stopwords = SERIALIZERS
+stopwords = TT
+stopwords = Wikipedia
+stopwords = XHR
+stopwords = XMLHttpRequest
+stopwords = YAML
+stopwords = conf
+stopwords = deserialization
+stopwords = deserialize
+stopwords = deserialized
+stopwords = deserializing
+stopwords = fREW
+stopwords = html
+stopwords = http
+stopwords = javascript
+stopwords = jrockway
+stopwords = mst
+stopwords = multipart
+stopwords = namespace
+stopwords = plugins
+stopwords = request's
+stopwords = serializer
+stopwords = thusly
+stopwords = wildcard
+
+; Since we're using FakeFaker, these dependencies need to be added to the Makefile.PL as well
+[Prereqs]
+perl                      = 5.8.1
+Moose                     = 1.03
+namespace::autoclean      = 0
+Catalyst::Runtime         = 5.80030
+Params::Validate          = 0.76
+YAML::Syck                = 0.67
+Module::Pluggable::Object = 0
+LWP::UserAgent            = 2.033
+Data::Serializer          = 0.36
+Class::Inspector          = 1.13
+URI::Find                 = 0
+MRO::Compat               = 0.10
+
+; Since we're using FakeFaker, these dependencies need to be added to the Makefile.PL as well
+[Prereqs / RuntimeSuggests]
+JSON               = 2.12
+JSON::XS           = 2.2222
+Data::Taxi         = 0
+Config::General    = 0
+PHP::Serialization = 0
+FreezeThaw         = 0
+XML::Simple        = 0
+
+[Prereqs / TestRequires]
+Test::More = 0.88
+
+[Prereqs / AuthorRequires]
+Test::Pod        = 1.14
+Module::Info     = 0
+File::Find::Rule = 0
+JSON               = 2.12
+JSON::XS           = 2.2222
+Data::Taxi         = 0
+Config::General    = 0
+PHP::Serialization = 0
+FreezeThaw         = 0
+XML::Simple        = 0
index 62f05d7..0a19d00 100644 (file)
@@ -8,9 +8,6 @@ use Module::Pluggable::Object;
 use MRO::Compat;
 use Moose::Util::TypeConstraints;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 has plugins => ( is => 'rw' );
 
 has deserialize_http_methods => (
index 4558552..02d82c3 100644 (file)
@@ -6,9 +6,6 @@ use Scalar::Util qw(openhandle);
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $callbacks ) = @_;
index a667363..859cbac 100644 (file)
@@ -10,9 +10,6 @@ use Scalar::Util qw(openhandle);
 my $compartment = Safe->new;
 $compartment->permit_only( qw(padany null lineseq const pushmark list anonhash anonlist refgen leaveeval undef) );
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $serializer ) = @_;
index 87d33dd..2ad53a3 100644 (file)
@@ -7,9 +7,6 @@ use Scalar::Util qw(openhandle);
 extends 'Catalyst::Action';
 use JSON;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
index 8f33d40..11dd545 100644 (file)
@@ -5,9 +5,6 @@ use namespace::autoclean;
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     return 1;
 }
index f1e882d..8d232bc 100644 (file)
@@ -6,9 +6,6 @@ use Scalar::Util qw(openhandle);
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
index f361760..8fc0cdd 100644 (file)
@@ -7,9 +7,6 @@ use Scalar::Util qw(openhandle);
 extends 'Catalyst::Action';
 use YAML::Syck;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $test ) = @_;
index d15de85..f1f1f8c 100644 (file)
@@ -6,9 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action::Deserialize';
 use HTTP::Body;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 our $NO_HTTP_BODY_TYPES_INITIALIZATION;
 $HTTP::Body::TYPES->{'multipart/mixed'} = 'HTTP::Body::MultiPart' unless $NO_HTTP_BODY_TYPES_INITIALIZATION;
 
index c871f98..d442f2e 100644 (file)
@@ -10,9 +10,6 @@ use Catalyst::Controller::REST;
 
 BEGIN { require 5.008001; }
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub BUILDARGS {
     my $class  = shift;
     my $config = shift;
index 8e03b72..c06e425 100644 (file)
@@ -3,9 +3,6 @@ package Catalyst::Action::REST::ForBrowsers;
 use Moose;
 use namespace::autoclean;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 extends 'Catalyst::Action::REST';
 use Catalyst::Request::REST::ForBrowsers;
 
index e5f7c96..6c595f7 100644 (file)
@@ -7,9 +7,6 @@ extends 'Catalyst::Action::SerializeBase';
 use Module::Pluggable::Object;
 use MRO::Compat;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 has _encoders => (
    is => 'ro',
    isa => 'HashRef',
index 711d346..64903e8 100644 (file)
@@ -5,9 +5,6 @@ use namespace::autoclean;
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $callbacks ) = @_;
index a6fe43b..e993a17 100644 (file)
@@ -6,9 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action';
 use Data::Serializer;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $serializer ) = @_;
index 9728d39..5f9d23b 100644 (file)
@@ -6,9 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action';
 use JSON ();
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 has encoder => (
    is => 'ro',
    lazy_build => 1,
index b474dcf..c2d2c71 100644 (file)
@@ -6,9 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action::Serialize::JSON';
 use JSON::XS ();
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub _build_encoder {
    my $self = shift;
    return JSON::XS->new->convert_blessed;
index 150dd5a..a595b2e 100644 (file)
@@ -4,9 +4,6 @@ use namespace::autoclean;
 
 extends 'Catalyst::Action::Serialize::JSON';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 after 'execute' => sub {
   my $self = shift;
   my ($controller, $c) = @_;
index 1c19926..63780ea 100644 (file)
@@ -4,9 +4,6 @@ use namespace::autoclean;
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c, $view ) = @_;
index 643349b..5b35c7e 100644 (file)
@@ -5,9 +5,6 @@ use namespace::autoclean;
 
 extends 'Catalyst::Action';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
index a55b381..b27cda8 100644 (file)
@@ -6,9 +6,6 @@ use namespace::autoclean;
 extends 'Catalyst::Action';
 use YAML::Syck;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
index e25de57..6b2395c 100644 (file)
@@ -7,9 +7,6 @@ extends 'Catalyst::Action';
 use YAML::Syck;
 use URI::Find;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
index fe9e609..32de9df 100644 (file)
@@ -8,9 +8,6 @@ use Module::Pluggable::Object;
 use Catalyst::Request::REST;
 use Catalyst::Utils ();
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 after BUILDARGS => sub {
     my $class  = shift;
     my $config = shift;
index 45d5b7b..1e6bf60 100644 (file)
@@ -2,9 +2,6 @@ package Catalyst::Controller::REST;
 use Moose;
 use namespace::autoclean;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 =head1 NAME
 
 Catalyst::Controller::REST - A RESTful controller
@@ -455,6 +452,46 @@ sub status_multiple_choices {
     return 1;
 }
 
+=item status_moved
+
+Returns a "301 MOVED" response.  Takes an "entity" to serialize,
+and a "location" where the created object can be found.
+
+Example:
+
+ $self->status_moved(
+   $c,
+   location => '/somewhere/else',
+   entity => {
+       radiohead => "Is a good band!",
+   }
+ );
+
+=cut
+
+sub status_moved {
+   my $self = shift;
+   my $c    = shift;
+   my %p    = Params::Validate::validate(
+       @_,
+       {
+           location => { type     => SCALAR | OBJECT },
+           entity   => { optional => 1 },
+       },
+   );
+
+   my $location;
+   if ( ref( $p{'location'} ) ) {
+       $location = $p{'location'}->as_string;
+   } else {
+       $location = $p{'location'};
+   }
+   $c->response->status(301);
+   $c->response->header( 'Location' => $location );
+   $self->_set_entity( $c, $p{'entity'} );
+   return 1;
+}
+
 =item status_bad_request
 
 Returns a "400 BAD REQUEST" response.  Takes a "message" argument
index c9338cd..7be01cf 100644 (file)
@@ -7,9 +7,6 @@ use namespace::autoclean;
 extends 'Catalyst::Request';
 with 'Catalyst::TraitFor::Request::REST';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 # Please don't take this as a recommended way to do things.
 # The code below is grotty, badly factored and mostly here for back
 # compat..
index 7cc6c50..30cea06 100644 (file)
@@ -3,9 +3,6 @@ use Moose;
 
 use namespace::autoclean;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 extends 'Catalyst::Request::REST';
 with 'Catalyst::TraitFor::Request::REST::ForBrowsers';
 
index 9216831..582f6c4 100644 (file)
@@ -3,9 +3,6 @@ use Moose::Role;
 use HTTP::Headers::Util qw(split_header_words);
 use namespace::autoclean;
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 has [qw/ data accept_only /] => ( is => 'rw' );
 
 has accepted_content_types => (
index c4c18ed..74ab60d 100644 (file)
@@ -4,9 +4,6 @@ use namespace::autoclean;
 
 with 'Catalyst::TraitFor::Request::REST';
 
-our $VERSION = '0.93';
-$VERSION = eval $VERSION;
-
 has _determined_real_method => (
     is  => 'rw',
     isa => 'Bool',
diff --git a/xt/pod-spell.t b/xt/pod-spell.t
deleted file mode 100644 (file)
index 6b6ee9a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-eval "use Test::Spelling";
-plan skip_all => "Test::Spelling required for testing POD coverage"
-    if $@;
-
-my @stopwords;
-for (<DATA>) {
-    chomp;
-    push @stopwords, $_
-        unless /\A (?: \# | \s* \z)/msx;    # skip comments, whitespace
-}
-
-add_stopwords(@stopwords);
-set_spell_cmd('aspell list -l en');
-
-# This prevents a weird segfault from the aspell command - see
-# https://bugs.launchpad.net/ubuntu/+source/aspell/+bug/71322
-local $ENV{LC_ALL} = 'C';
-all_pod_files_spelling_ok();
-
-__DATA__
-Wiki
-json
-APIs
-ActionClass
-Daisuke
-Daisuke
-Deserialize
-Deserializer
-Deserializing
-Doran
-Goulah
-JSON
-Laco
-Maki
-Maki
-Marchex
-Multipart
-Pearcey
-Rolsky
-RESTful
-RESTful
-SERIALIZERS
-TT
-Wikipedia
-XHR
-XMLHttpRequest
-YAML
-conf
-deserialization
-deserialize
-deserialized
-deserializing
-fREW
-html
-http
-javascript
-jrockway
-mst
-multipart
-namespace
-plugins
-request's
-serializer
-thusly
-wildcard
diff --git a/xt/pod.t b/xt/pod.t
deleted file mode 100644 (file)
index 6a644e9..0000000
--- a/xt/pod.t
+++ /dev/null
@@ -1,7 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-
-use Test::Pod 1.14;
-
-all_pod_files_ok();
diff --git a/xt/version-numbers.t b/xt/version-numbers.t
deleted file mode 100644 (file)
index a0a08fa..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-use strict;
-use warnings;
-
-use FindBin qw/$Bin/;
-use File::Spec;
-use File::Find::Rule;
-use Module::Info;
-
-use Test::More;
-
-my %versions;
-for my $pm_file ( File::Find::Rule->file->name( qr/\.pm$/ )->in(File::Spec->catdir($Bin, '..', 'lib') ) ) {
-    my $mod = Module::Info->new_from_file($pm_file);
-
-    ( my $stripped_file = $pm_file ) =~ s{.*/lib/}{};
-
-    $versions{$stripped_file} = $mod->version;
-}
-
-my $ver = delete $versions{'Catalyst/Action/REST.pm'};
-ok $ver;
-ok scalar(keys %versions);
-
-for my $module ( sort keys %versions ) {
-    is( $versions{$module}, $ver,
-        "version for $module is the same as in Catalyst/Action/REST.pm" );
-}
-
-done_testing;
-