[Catalyst-commits] r12366 - in trunk/examples: . Placky Placky/lib
Placky/lib/Placky Placky/lib/Placky/Controller Placky/root
Placky/root/static Placky/root/static/images Placky/script Placky/t
dhoss at dev.catalyst.perl.org
dhoss at dev.catalyst.perl.org
Mon Dec 14 20:56:36 GMT 2009
Author: dhoss
Date: 2009-12-14 20:56:36 +0000 (Mon, 14 Dec 2009)
New Revision: 12366
Added:
trunk/examples/Placky/
trunk/examples/Placky/Changes
trunk/examples/Placky/Makefile.PL
trunk/examples/Placky/README
trunk/examples/Placky/lib/
trunk/examples/Placky/lib/Placky.pm
trunk/examples/Placky/lib/Placky/
trunk/examples/Placky/lib/Placky/Controller/
trunk/examples/Placky/lib/Placky/Controller/Root.pm
trunk/examples/Placky/lib/Placky/Model/
trunk/examples/Placky/lib/Placky/View/
trunk/examples/Placky/placky.conf
trunk/examples/Placky/root/
trunk/examples/Placky/root/favicon.ico
trunk/examples/Placky/root/static/
trunk/examples/Placky/root/static/images/
trunk/examples/Placky/root/static/images/btn_120x50_built.png
trunk/examples/Placky/root/static/images/btn_120x50_built_shadow.png
trunk/examples/Placky/root/static/images/btn_120x50_powered.png
trunk/examples/Placky/root/static/images/btn_120x50_powered_shadow.png
trunk/examples/Placky/root/static/images/btn_88x31_built.png
trunk/examples/Placky/root/static/images/btn_88x31_built_shadow.png
trunk/examples/Placky/root/static/images/btn_88x31_powered.png
trunk/examples/Placky/root/static/images/btn_88x31_powered_shadow.png
trunk/examples/Placky/root/static/images/catalyst_logo.png
trunk/examples/Placky/script/
trunk/examples/Placky/script/app.psgi
trunk/examples/Placky/script/placky_cgi.pl
trunk/examples/Placky/script/placky_create.pl
trunk/examples/Placky/script/placky_fastcgi.pl
trunk/examples/Placky/script/placky_server.pl
trunk/examples/Placky/script/placky_test.pl
trunk/examples/Placky/t/
trunk/examples/Placky/t/01app.t
trunk/examples/Placky/t/02pod.t
trunk/examples/Placky/t/03podcoverage.t
Log:
basic app for plack deploy article
Added: trunk/examples/Placky/Changes
===================================================================
--- trunk/examples/Placky/Changes (rev 0)
+++ trunk/examples/Placky/Changes 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension Placky.
+
+0.01 2009-12-14 13:53:57
+ - initial revision, generated by Catalyst
Added: trunk/examples/Placky/Makefile.PL
===================================================================
--- trunk/examples/Placky/Makefile.PL (rev 0)
+++ trunk/examples/Placky/Makefile.PL 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+# IMPORTANT: if you delete this file your app will not work as
+# expected. You have been warned.
+use inc::Module::Install;
+
+name 'Placky';
+all_from 'lib/Placky.pm';
+
+requires 'Catalyst::Runtime' => '5.80016';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'Moose';
+requires 'namespace::autoclean';
+requires 'Config::General'; # This should reflect the config file format you've chosen
+ # See Catalyst::Plugin::ConfigLoader for supported formats
+test_requires 'Test::More' => '0.88';
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
Added: trunk/examples/Placky/README
===================================================================
--- trunk/examples/Placky/README (rev 0)
+++ trunk/examples/Placky/README 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1 @@
+Run script/placky_server.pl to test the application.
Added: trunk/examples/Placky/lib/Placky/Controller/Root.pm
===================================================================
--- trunk/examples/Placky/lib/Placky/Controller/Root.pm (rev 0)
+++ trunk/examples/Placky/lib/Placky/Controller/Root.pm 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,61 @@
+package Placky::Controller::Root;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config(namespace => '');
+
+=head1 NAME
+
+Placky::Controller::Root - Root Controller for Placky
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 index
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $c->response->body( $c->welcome_message );
+}
+
+sub default :Path {
+ my ( $self, $c ) = @_;
+ $c->response->body( 'Page not found' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+=head1 AUTHOR
+
+Devin Austin
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
Added: trunk/examples/Placky/lib/Placky.pm
===================================================================
--- trunk/examples/Placky/lib/Placky.pm (rev 0)
+++ trunk/examples/Placky/lib/Placky.pm 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,72 @@
+package Placky;
+use Moose;
+use namespace::autoclean;
+
+use Catalyst::Runtime 5.80;
+
+# Set flags and add plugins for the application
+#
+# -Debug: activates the debug mode for very useful log messages
+# ConfigLoader: will load the configuration from a Config::General file in the
+# application's home directory
+# Static::Simple: will serve static files from the application's root
+# directory
+
+use Catalyst qw/
+ -Debug
+ ConfigLoader
+ Static::Simple
+/;
+
+extends 'Catalyst';
+
+our $VERSION = '0.01';
+$VERSION = eval $VERSION;
+
+# Configure the application.
+#
+# Note that settings in placky.conf (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with an external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config(
+ name => 'Placky',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+);
+
+# Start the application
+__PACKAGE__->setup();
+
+
+=head1 NAME
+
+Placky - Catalyst based application
+
+=head1 SYNOPSIS
+
+ script/placky_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<Placky::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Devin Austin
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: trunk/examples/Placky/placky.conf
===================================================================
--- trunk/examples/Placky/placky.conf (rev 0)
+++ trunk/examples/Placky/placky.conf 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,3 @@
+# rename this file to Placky.yml and put a ':' in front of 'name' if
+# you want to use YAML like in old versions of Catalyst
+name Placky
Added: trunk/examples/Placky/root/favicon.ico
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_120x50_built.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_120x50_built.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_120x50_built_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_120x50_built_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_120x50_powered.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_120x50_powered.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_120x50_powered_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_120x50_powered_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_88x31_built.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_88x31_built.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_88x31_built_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_88x31_built_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_88x31_powered.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_88x31_powered.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/btn_88x31_powered_shadow.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/btn_88x31_powered_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/root/static/images/catalyst_logo.png
===================================================================
(Binary files differ)
Property changes on: trunk/examples/Placky/root/static/images/catalyst_logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/Placky/script/app.psgi
===================================================================
--- trunk/examples/Placky/script/app.psgi (rev 0)
+++ trunk/examples/Placky/script/app.psgi 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+use strict;
+use Placky;
+
+Placky->setup_engine('PSGI');
+my $app = sub { Placky->run(@_) };
Added: trunk/examples/Placky/script/placky_cgi.pl
===================================================================
--- trunk/examples/Placky/script/placky_cgi.pl (rev 0)
+++ trunk/examples/Placky/script/placky_cgi.pl 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Placky', 'CGI');
+
+1;
+
+=head1 NAME
+
+placky_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/Placky/script/placky_cgi.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/Placky/script/placky_create.pl
===================================================================
--- trunk/examples/Placky/script/placky_create.pl (rev 0)
+++ trunk/examples/Placky/script/placky_create.pl 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,85 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+eval "use Catalyst::Helper;";
+
+if ($@) {
+ die <<END;
+To use the Catalyst development tools including catalyst.pl and the
+generated script/myapp_create.pl you need Catalyst::Helper, which is
+part of the Catalyst-Devel distribution. Please install this via a
+vendor package or by running one of -
+
+ perl -MCPAN -e 'install Catalyst::Devel'
+ perl -MCPANPLUS -e 'install Catalyst::Devel'
+END
+}
+
+my $force = 0;
+my $mech = 0;
+my $help = 0;
+
+GetOptions(
+ 'nonew|force' => \$force,
+ 'mech|mechanize' => \$mech,
+ 'help|?' => \$help
+ );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+my $helper = Catalyst::Helper->new( { '.newfiles' => !$force, mech => $mech } );
+
+pod2usage(1) unless $helper->mk_component( 'Placky', @ARGV );
+
+1;
+
+=head1 NAME
+
+placky_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+placky_create.pl [options] model|view|controller name [helper] [options]
+
+ Options:
+ -force don't create a .new file where a file to be created exists
+ -mechanize use Test::WWW::Mechanize::Catalyst for tests if available
+ -help display this help and exits
+
+ Examples:
+ placky_create.pl controller My::Controller
+ placky_create.pl -mechanize controller My::Controller
+ placky_create.pl view My::View
+ placky_create.pl view MyView TT
+ placky_create.pl view TT TT
+ placky_create.pl model My::Model
+ placky_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+ dbi:SQLite:/tmp/my.db
+ placky_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
+ dbi:Pg:dbname=foo root 4321
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Create a new Catalyst Component.
+
+Existing component files are not overwritten. If any of the component files
+to be created already exist the file will be written with a '.new' suffix.
+This behavior can be suppressed with the C<-force> option.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/Placky/script/placky_create.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/Placky/script/placky_fastcgi.pl
===================================================================
--- trunk/examples/Placky/script/placky_fastcgi.pl (rev 0)
+++ trunk/examples/Placky/script/placky_fastcgi.pl 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Placky','FastCGI');
+
+1;
+
+=head1 NAME
+
+placky_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+placky_fastcgi.pl [options]
+
+ Options:
+ -? -help display this help and exits
+ -l -listen Socket path to listen on
+ (defaults to standard input)
+ can be HOST:PORT, :PORT or a
+ filesystem path
+ -n -nproc specify number of processes to keep
+ to serve requests (defaults to 1,
+ requires -listen)
+ -p -pidfile specify filename for pid file
+ (requires -listen)
+ -d -daemon daemonize (requires -listen)
+ -M -manager specify alternate process manager
+ (FCGI::ProcManager sub-class)
+ or empty string to disable
+ -e -keeperr send error messages to STDOUT, not
+ to the webserver
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/Placky/script/placky_fastcgi.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/Placky/script/placky_server.pl
===================================================================
--- trunk/examples/Placky/script/placky_server.pl (rev 0)
+++ trunk/examples/Placky/script/placky_server.pl 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Placky', 'Server');
+
+1;
Property changes on: trunk/examples/Placky/script/placky_server.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/Placky/script/placky_test.pl
===================================================================
--- trunk/examples/Placky/script/placky_test.pl (rev 0)
+++ trunk/examples/Placky/script/placky_test.pl 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,41 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Placky','Test');
+
+1;
+
+
+=head1 NAME
+
+placky_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+placky_test.pl [options] uri
+
+ Options:
+ -help display this help and exits
+
+ Examples:
+ placky_test.pl http://localhost/some_action
+ placky_test.pl /some_action
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Property changes on: trunk/examples/Placky/script/placky_test.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/examples/Placky/t/01app.t
===================================================================
--- trunk/examples/Placky/t/01app.t (rev 0)
+++ trunk/examples/Placky/t/01app.t 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Catalyst::Test', 'Placky' }
+
+ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();
Added: trunk/examples/Placky/t/02pod.t
===================================================================
--- trunk/examples/Placky/t/02pod.t (rev 0)
+++ trunk/examples/Placky/t/02pod.t 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
Added: trunk/examples/Placky/t/03podcoverage.t
===================================================================
--- trunk/examples/Placky/t/03podcoverage.t (rev 0)
+++ trunk/examples/Placky/t/03podcoverage.t 2009-12-14 20:56:36 UTC (rev 12366)
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
More information about the Catalyst-commits
mailing list