[Catalyst-commits] r8079 - in Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk: . lib lib/Catalyst lib/Catalyst/Plugin lib/Catalyst/Plugin/Devel t t/author t/lib t/lib/TestApp t/lib/TestApp/Controller t/lib/script

omega at dev.catalyst.perl.org omega at dev.catalyst.perl.org
Thu Jul 3 21:40:33 BST 2008


Author: omega
Date: 2008-07-03 21:40:32 +0100 (Thu, 03 Jul 2008)
New Revision: 8079

Added:
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/.gitignore
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Changes
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST.SKIP
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Makefile.PL
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/README
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/Devel/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/Devel/ModuleVersions.pm
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/00-load.t
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod-coverage.t
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod.t
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/Makefile.PL
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp.pm
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/Controller/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/Controller/Root.pm
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_server.pl
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_test.pl
   Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/live-test.t
Log:
Initial import

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/.gitignore
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/.gitignore	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/.gitignore	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,8 @@
+cover_db
+META.yml
+Makefile
+blib
+inc
+pm_to_blib
+MANIFEST
+Makefile.old

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Changes
===================================================================

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,22 @@
+Changes
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/Catalyst/Plugin/Devel/ModuleVersions.pm
+Makefile.PL
+MANIFEST			This list of files
+MANIFEST.SKIP
+META.yml
+README
+t/00-load.t
+t/lib/Makefile.PL
+t/lib/script/testapp_server.pl
+t/lib/script/testapp_test.pl
+t/lib/TestApp.pm
+t/lib/TestApp/Controller/Root.pm
+t/live-test.t

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST.SKIP
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST.SKIP	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/MANIFEST.SKIP	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,10 @@
+.git/
+.gitignore
+t/author/
+blib
+pm_to_blib
+MANIFEST.bak
+MANIFEST.SKIP~
+cover_db
+Makefile$
+Makefile.old$

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Makefile.PL
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Makefile.PL	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/Makefile.PL	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,15 @@
+use inc::Module::Install;
+
+name 'Catalyst-Plugin-Devel-ModuleVersions';
+all_from 'lib/Catalyst/Plugin/Devel/ModuleVersions.pm';
+
+test_requires 'Catalyst::Runtime';
+test_requires 'Test::WWW::Mechanize::Catalyst';
+test_requires 'Test::More';
+test_requires 'ok';
+test_requires 'Test::MockObject';
+
+requires 'Catalyst';
+requires 'Class::C3';
+
+WriteAll();

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/README
===================================================================

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/Devel/ModuleVersions.pm
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/Devel/ModuleVersions.pm	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/lib/Catalyst/Plugin/Devel/ModuleVersions.pm	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,59 @@
+package Catalyst::Plugin::Devel::ModuleVersions;
+use strict;
+use warnings;
+
+use Class::C3;
+
+our $VERSION = '0.0001';
+
+=head1 NAME
+
+Catalyst::Plugin::Devel::ModuleVersions - 
+
+=cut
+
+
+=head1 INTERFACE
+
+=head2 EXTENDED METHODS
+
+=head3 dump_these
+
+Uses Class::C3 to extend the catalyst dump_these, and add some more information
+at the end of the debug screen, containing a list of strings that each is
+"Module::Name VERSION", ala:
+
+    "Catalyst::Plugin::Devel::ModuleVersions 0.0001"
+
+=cut
+
+sub dump_these {
+    my $c = shift; 
+     
+    ($c->next::method(@_), [ "Loaded Modules" => 
+        [ grep {
+            defined $_
+        } map { 
+            my $mod = $_;
+            $mod =~ s/\.pm$//;
+            $mod =~ s/\//::/g;
+            my $version = eval {no strict; ${"${mod}::VERSION"} };
+            $version && "$version" ne "-1"
+            ? $mod . " " . $version 
+            :  undef
+        } sort keys %INC
+        ]
+    ]); 
+}
+
+=head1 AUTHOR
+
+Andreas Marienborg C<<andremar at cpan.org>>
+
+=head1 LICENCE
+
+This library is free software, you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+
+1;

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/00-load.t
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/00-load.t	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/00-load.t	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 1;
+use ok 'Catalyst::Plugin::Devel::ModuleVersions';

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod-coverage.t
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod-coverage.t	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod-coverage.t	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod.t
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod.t	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/author/pod.t	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/Makefile.PL
===================================================================

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/Controller/Root.pm	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp/Controller/Root.pm	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,12 @@
+package TestApp::Controller::Root;
+use strict;
+use warnings;
+
+__PACKAGE__->config(namespace => q{});
+
+use base 'Catalyst::Controller';
+
+# your actions replace this one
+sub main :Path { die "forced debug" }
+
+1;

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp.pm
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp.pm	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/TestApp.pm	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,17 @@
+package TestApp;
+use strict;
+use warnings;
+
+use Catalyst qw/
+    -Debug
+    Devel::ModuleVersions
+    
+/;
+use Test::MockObject;
+
+my $mock = Test::MockObject->new();
+$mock->set_false(qw/debug error fatal info warn/);
+__PACKAGE__->log($mock);
+__PACKAGE__->setup;
+
+1;

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_server.pl
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_server.pl	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_server.pl	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,121 @@
+#!/usr/bin/env perl
+
+BEGIN { 
+    $ENV{CATALYST_ENGINE} ||= 'HTTP';
+    $ENV{CATALYST_SCRIPT_GEN} = 31;
+    require Catalyst::Engine::HTTP;
+}  
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/..";
+
+my $debug             = 0;
+my $fork              = 0;
+my $help              = 0;
+my $host              = undef;
+my $port              = 3000;
+my $keepalive         = 0;
+my $restart           = 0;
+my $restart_delay     = 1;
+my $restart_regex     = '\.yml$|\.yaml$|\.pm$';
+my $restart_directory = undef;
+my $background        = 0;
+my $pidfile           = "/tmp/testapp.pid";
+
+my @argv = @ARGV;
+
+GetOptions(
+    'debug|d'             => \$debug,
+    'fork'                => \$fork,
+    'help|?'              => \$help,
+    'host=s'              => \$host,
+    'port=s'              => \$port,
+    'keepalive|k'         => \$keepalive,
+    'restart|r'           => \$restart,
+    'restartdelay|rd=s'   => \$restart_delay,
+    'restartregex|rr=s'   => \$restart_regex,
+    'restartdirectory=s'  => \$restart_directory,
+    'daemon'              => \$background,
+    'pidfile=s'           => \$pidfile,          
+);
+
+pod2usage(1) if $help;
+
+if ( $restart ) {
+    $ENV{CATALYST_ENGINE} = 'HTTP::Restarter';
+}
+if ( $debug ) {
+    $ENV{CATALYST_DEBUG} = 1;
+}
+
+# This is require instead of use so that the above environment
+# variables can be set at runtime.
+require TestApp;
+
+TestApp->run( $port, $host, {
+    argv              => \@argv,
+    'fork'            => $fork,
+    keepalive         => $keepalive,
+    restart           => $restart,
+    restart_delay     => $restart_delay,
+    restart_regex     => qr/$restart_regex/,
+    restart_directory => $restart_directory,
+    background        => $background,
+    pidfile           => $pidfile,				
+} );
+
+1;
+
+=head1 NAME
+
+testapp_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+testapp_server.pl [options]
+
+ Options:
+   -d -debug          force debug mode
+   -f -fork           handle each request in a new process
+                      (defaults to false)
+   -? -help           display this help and exits
+      -host           host (defaults to all)
+   -p -port           port (defaults to 3000)
+   -k -keepalive      enable keep-alive connections
+   -r -restart        restart when files get modified
+                      (defaults to false)
+   -rd -restartdelay  delay between file checks
+   -rr -restartregex  regex match files that trigger
+                      a restart when modified
+                      (defaults to '\.yml$|\.yaml$|\.pm$')
+   -restartdirectory  the directory to search for
+                      modified files
+                      (defaults to '../')
+
+   -daemon            background the server
+   -pidfile=filename  store the pid if the server in filename, if
+                      daemonizing
+
+ See also:
+   perldoc Catalyst::Manual
+   perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Maintained by the Catalyst Core Team.
+
+=head1 COPYRIGHT
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_test.pl
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_test.pl	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/lib/script/testapp_test.pl	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/..";
+use Catalyst::Test 'TestApp';
+
+print request($ARGV[0])->content . "\n";
+
+1;

Added: Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/live-test.t
===================================================================
--- Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/live-test.t	                        (rev 0)
+++ Catalyst-Plugin-Devel-ModuleVersions/1.000/trunk/t/live-test.t	2008-07-03 20:40:32 UTC (rev 8079)
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+# setup library path
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+# make sure testapp works
+use ok 'TestApp';
+
+my $v = eval <<END;
+use Catalyst::Plugin::Devel::ModuleVersions;
+Catalyst::Plugin::Devel::ModuleVersions->VERSION
+END
+
+
+# a live test against TestApp, the test application
+use Test::WWW::Mechanize::Catalyst 'TestApp';
+my $mech = Test::WWW::Mechanize::Catalyst->new;
+$mech->{catalyst_debug} = 1;
+$mech->get('http://localhost/', 'get main page');
+$mech->content_like(qr/Loaded Modules/i, 'see if it has our text');
+$mech->content_like(qr/Catalyst::Plugin::Devel::ModuleVersions $v/, 
+    "see if we loaded the right version of us")




More information about the Catalyst-commits mailing list