created proof of working app
Devin Austin [Fri, 17 Jul 2009 01:43:29 +0000 (01:43 +0000)]
30 files changed:
t/Test/Changes [new file with mode: 0644]
t/Test/Makefile.PL [new file with mode: 0644]
t/Test/README [new file with mode: 0644]
t/Test/lib/Test.pm [new file with mode: 0644]
t/Test/lib/Test/Controller/Root.pm [new file with mode: 0644]
t/Test/lib/Test/Controller/Snarf.pm [new file with mode: 0644]
t/Test/lib/Test/Model/YouTube.pm [new file with mode: 0644]
t/Test/lib/Test/View/TT.pm [new file with mode: 0644]
t/Test/root/favicon.ico [new file with mode: 0644]
t/Test/root/static/images/btn_120x50_built.png [new file with mode: 0644]
t/Test/root/static/images/btn_120x50_built_shadow.png [new file with mode: 0644]
t/Test/root/static/images/btn_120x50_powered.png [new file with mode: 0644]
t/Test/root/static/images/btn_120x50_powered_shadow.png [new file with mode: 0644]
t/Test/root/static/images/btn_88x31_built.png [new file with mode: 0644]
t/Test/root/static/images/btn_88x31_built_shadow.png [new file with mode: 0644]
t/Test/root/static/images/btn_88x31_powered.png [new file with mode: 0644]
t/Test/root/static/images/btn_88x31_powered_shadow.png [new file with mode: 0644]
t/Test/root/static/images/catalyst_logo.png [new file with mode: 0644]
t/Test/script/test_cgi.pl [new file with mode: 0755]
t/Test/script/test_create.pl [new file with mode: 0755]
t/Test/script/test_fastcgi.pl [new file with mode: 0755]
t/Test/script/test_server.pl [new file with mode: 0755]
t/Test/script/test_test.pl [new file with mode: 0755]
t/Test/t/01app.t [new file with mode: 0644]
t/Test/t/02pod.t [new file with mode: 0644]
t/Test/t/03podcoverage.t [new file with mode: 0644]
t/Test/t/controller_Snarf.t [new file with mode: 0644]
t/Test/t/model_YouTube.t [new file with mode: 0644]
t/Test/t/view_TT.t [new file with mode: 0644]
t/Test/test.conf [new file with mode: 0644]

diff --git a/t/Test/Changes b/t/Test/Changes
new file mode 100644 (file)
index 0000000..e82c704
--- /dev/null
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension Test.
+
+0.01  2009-07-16 19:29:11
+        - initial revision, generated by Catalyst
diff --git a/t/Test/Makefile.PL b/t/Test/Makefile.PL
new file mode 100644 (file)
index 0000000..ebdd762
--- /dev/null
@@ -0,0 +1,20 @@
+#!/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 'Test';
+all_from 'lib/Test.pm';
+
+requires 'Catalyst::Runtime' => '5.80005';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'parent';
+requires 'Config::General'; # This should reflect the config file format you've chosen
+                 # See Catalyst::Plugin::ConfigLoader for supported formats
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
diff --git a/t/Test/README b/t/Test/README
new file mode 100644 (file)
index 0000000..145842f
--- /dev/null
@@ -0,0 +1 @@
+Run script/test_server.pl to test the application.
diff --git a/t/Test/lib/Test.pm b/t/Test/lib/Test.pm
new file mode 100644 (file)
index 0000000..abbf562
--- /dev/null
@@ -0,0 +1,64 @@
+package Test;
+
+use strict;
+use warnings;
+
+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 parent qw/Catalyst/;
+use Catalyst qw/-Debug
+                ConfigLoader
+                Static::Simple/;
+our $VERSION = '0.01';
+
+# Configure the application.
+#
+# Note that settings in test.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 => 'Test' );
+
+# Start the application
+__PACKAGE__->setup();
+
+
+=head1 NAME
+
+Test - Catalyst based application
+
+=head1 SYNOPSIS
+
+    script/test_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<Test::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;
diff --git a/t/Test/lib/Test/Controller/Root.pm b/t/Test/lib/Test/Controller/Root.pm
new file mode 100644 (file)
index 0000000..f4f7f48
--- /dev/null
@@ -0,0 +1,61 @@
+package Test::Controller::Root;
+
+use strict;
+use warnings;
+use parent '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
+
+Test::Controller::Root - Root Controller for Test
+
+=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
+
+1;
diff --git a/t/Test/lib/Test/Controller/Snarf.pm b/t/Test/lib/Test/Controller/Snarf.pm
new file mode 100644 (file)
index 0000000..e88eee3
--- /dev/null
@@ -0,0 +1,42 @@
+package Test::Controller::Snarf;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+=head1 NAME
+
+Test::Controller::Snarf - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index :Path :Args(0) {
+    my ( $self, $c ) = @_;
+
+    $c->response->body('Matched Test::Controller::Snarf in Snarf.');
+}
+
+
+=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;
diff --git a/t/Test/lib/Test/Model/YouTube.pm b/t/Test/lib/Test/Model/YouTube.pm
new file mode 100644 (file)
index 0000000..ee93533
--- /dev/null
@@ -0,0 +1,26 @@
+package Test::Model::YouTube;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Model';
+
+=head1 NAME
+
+Test::Model::YouTube - Catalyst Model
+
+=head1 DESCRIPTION
+
+Catalyst Model.
+
+=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;
diff --git a/t/Test/lib/Test/View/TT.pm b/t/Test/lib/Test/View/TT.pm
new file mode 100644 (file)
index 0000000..6e8619b
--- /dev/null
@@ -0,0 +1,31 @@
+package Test::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+
+=head1 NAME
+
+Test::View::TT - TT View for Test
+
+=head1 DESCRIPTION
+
+TT View for Test. 
+
+=head1 SEE ALSO
+
+L<Test>
+
+=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;
diff --git a/t/Test/root/favicon.ico b/t/Test/root/favicon.ico
new file mode 100644 (file)
index 0000000..5ad723d
Binary files /dev/null and b/t/Test/root/favicon.ico differ
diff --git a/t/Test/root/static/images/btn_120x50_built.png b/t/Test/root/static/images/btn_120x50_built.png
new file mode 100644 (file)
index 0000000..c709fd6
Binary files /dev/null and b/t/Test/root/static/images/btn_120x50_built.png differ
diff --git a/t/Test/root/static/images/btn_120x50_built_shadow.png b/t/Test/root/static/images/btn_120x50_built_shadow.png
new file mode 100644 (file)
index 0000000..15142fe
Binary files /dev/null and b/t/Test/root/static/images/btn_120x50_built_shadow.png differ
diff --git a/t/Test/root/static/images/btn_120x50_powered.png b/t/Test/root/static/images/btn_120x50_powered.png
new file mode 100644 (file)
index 0000000..7249b47
Binary files /dev/null and b/t/Test/root/static/images/btn_120x50_powered.png differ
diff --git a/t/Test/root/static/images/btn_120x50_powered_shadow.png b/t/Test/root/static/images/btn_120x50_powered_shadow.png
new file mode 100644 (file)
index 0000000..e6876c0
Binary files /dev/null and b/t/Test/root/static/images/btn_120x50_powered_shadow.png differ
diff --git a/t/Test/root/static/images/btn_88x31_built.png b/t/Test/root/static/images/btn_88x31_built.png
new file mode 100644 (file)
index 0000000..007b5db
Binary files /dev/null and b/t/Test/root/static/images/btn_88x31_built.png differ
diff --git a/t/Test/root/static/images/btn_88x31_built_shadow.png b/t/Test/root/static/images/btn_88x31_built_shadow.png
new file mode 100644 (file)
index 0000000..ccf4624
Binary files /dev/null and b/t/Test/root/static/images/btn_88x31_built_shadow.png differ
diff --git a/t/Test/root/static/images/btn_88x31_powered.png b/t/Test/root/static/images/btn_88x31_powered.png
new file mode 100644 (file)
index 0000000..8f0cd9f
Binary files /dev/null and b/t/Test/root/static/images/btn_88x31_powered.png differ
diff --git a/t/Test/root/static/images/btn_88x31_powered_shadow.png b/t/Test/root/static/images/btn_88x31_powered_shadow.png
new file mode 100644 (file)
index 0000000..aa776fa
Binary files /dev/null and b/t/Test/root/static/images/btn_88x31_powered_shadow.png differ
diff --git a/t/Test/root/static/images/catalyst_logo.png b/t/Test/root/static/images/catalyst_logo.png
new file mode 100644 (file)
index 0000000..21f1cac
Binary files /dev/null and b/t/Test/root/static/images/catalyst_logo.png differ
diff --git a/t/Test/script/test_cgi.pl b/t/Test/script/test_cgi.pl
new file mode 100755 (executable)
index 0000000..03a6b1c
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test', 'CGI');
+
+1;
+
+=head1 NAME
+
+test_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
diff --git a/t/Test/script/test_create.pl b/t/Test/script/test_create.pl
new file mode 100755 (executable)
index 0000000..26c89bb
--- /dev/null
@@ -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( 'Test', @ARGV );
+
+1;
+
+=head1 NAME
+
+test_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+test_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:
+   test_create.pl controller My::Controller
+   test_create.pl -mechanize controller My::Controller
+   test_create.pl view My::View
+   test_create.pl view MyView TT
+   test_create.pl view TT TT
+   test_create.pl model My::Model
+   test_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+   dbi:SQLite:/tmp/my.db
+   test_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
diff --git a/t/Test/script/test_fastcgi.pl b/t/Test/script/test_fastcgi.pl
new file mode 100755 (executable)
index 0000000..5b650f3
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test','FastCGI');
+
+1;
+
+=head1 NAME
+
+test_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+test_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
diff --git a/t/Test/script/test_server.pl b/t/Test/script/test_server.pl
new file mode 100755 (executable)
index 0000000..0ac37b6
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test', 'Server');
+
+1;
diff --git a/t/Test/script/test_test.pl b/t/Test/script/test_test.pl
new file mode 100755 (executable)
index 0000000..9a6dff3
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('Test','Test');
+
+1;
+
+
+=head1 NAME
+
+test_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+test_test.pl [options] uri
+
+ Options:
+   -help    display this help and exits
+
+ Examples:
+   test_test.pl http://localhost/some_action
+   test_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
diff --git a/t/Test/t/01app.t b/t/Test/t/01app.t
new file mode 100644 (file)
index 0000000..4af8276
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'Test' }
+
+ok( request('/')->is_success, 'Request should succeed' );
diff --git a/t/Test/t/02pod.t b/t/Test/t/02pod.t
new file mode 100644 (file)
index 0000000..3d1bab1
--- /dev/null
@@ -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();
diff --git a/t/Test/t/03podcoverage.t b/t/Test/t/03podcoverage.t
new file mode 100644 (file)
index 0000000..4e1c6e7
--- /dev/null
@@ -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();
diff --git a/t/Test/t/controller_Snarf.t b/t/Test/t/controller_Snarf.t
new file mode 100644 (file)
index 0000000..106c0d5
--- /dev/null
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'Snarf' }
+BEGIN { use_ok 'Test::Controller::Snarf' }
+
+ok( request('/snarf')->is_success, 'Request should succeed' );
+
+
diff --git a/t/Test/t/model_YouTube.t b/t/Test/t/model_YouTube.t
new file mode 100644 (file)
index 0000000..78f9385
--- /dev/null
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Test::Model::YouTube' }
+
diff --git a/t/Test/t/view_TT.t b/t/Test/t/view_TT.t
new file mode 100644 (file)
index 0000000..aff30cc
--- /dev/null
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'Test::View::TT' }
+
diff --git a/t/Test/test.conf b/t/Test/test.conf
new file mode 100644 (file)
index 0000000..f6c00f2
--- /dev/null
@@ -0,0 +1,3 @@
+# rename this file to Test.yml and put a ':' in front of 'name' if
+# you want to use YAML like in old versions of Catalyst
+name Test