aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authormatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-12 18:11:34 +0000
committermatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-09-12 18:11:34 +0000
commit7adfd53f17f66ffe93763e944ed1d3fc52a369dc (patch)
tree19e599e74419b41cbbe651fd226b81e8b73551d3 /script
parentc728c97cb1061330e63c7cc048e768ef74988fe6 (diff)
downloadreaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.tar.gz
reaction-7adfd53f17f66ffe93763e944ed1d3fc52a369dc.zip
moved shit to trunk
Diffstat (limited to 'script')
-rwxr-xr-xscript/componentui_cgi.pl37
-rwxr-xr-xscript/componentui_create.pl74
-rwxr-xr-xscript/componentui_fastcgi.pl76
-rwxr-xr-xscript/componentui_server.pl110
-rwxr-xr-xscript/componentui_test.pl54
-rwxr-xr-xscript/moose_to_rclass.pl33
6 files changed, 384 insertions, 0 deletions
diff --git a/script/componentui_cgi.pl b/script/componentui_cgi.pl
new file mode 100755
index 0000000..f75d75e
--- /dev/null
+++ b/script/componentui_cgi.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'CGI' }
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use ComponentUI;
+
+ComponentUI->run;
+
+1;
+
+=head1 NAME
+
+componentui_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+
+=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/script/componentui_create.pl b/script/componentui_create.pl
new file mode 100755
index 0000000..b99305c
--- /dev/null
+++ b/script/componentui_create.pl
@@ -0,0 +1,74 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use Catalyst::Helper;
+
+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( 'ComponentUI', @ARGV );
+
+1;
+
+=head1 NAME
+
+componentui_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+componentui_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:
+ componentui_create.pl controller My::Controller
+ componentui_create.pl -mechanize controller My::Controller
+ componentui_create.pl view My::View
+ componentui_create.pl view MyView TT
+ componentui_create.pl view TT TT
+ componentui_create.pl model My::Model
+ componentui_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+ dbi:SQLite:/tmp/my.db
+ componentui_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 AUTHOR
+
+Sebastian Riedel, C<sri@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
diff --git a/script/componentui_fastcgi.pl b/script/componentui_fastcgi.pl
new file mode 100755
index 0000000..d21ea3f
--- /dev/null
+++ b/script/componentui_fastcgi.pl
@@ -0,0 +1,76 @@
+#!/usr/bin/perl -w
+
+BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' }
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use ComponentUI;
+
+my $help = 0;
+my ( $listen, $nproc, $pidfile, $manager, $detach );
+
+GetOptions(
+ 'help|?' => \$help,
+ 'listen|l=s' => \$listen,
+ 'nproc|n=i' => \$nproc,
+ 'pidfile|p=s' => \$pidfile,
+ 'manager|M=s' => \$manager,
+ 'daemon|d' => \$detach,
+);
+
+pod2usage(1) if $help;
+
+ComponentUI->run(
+ $listen,
+ { nproc => $nproc,
+ pidfile => $pidfile,
+ manager => $manager,
+ detach => $detach,
+ }
+);
+
+1;
+
+=head1 NAME
+
+componentui_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+componentui_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
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@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
diff --git a/script/componentui_server.pl b/script/componentui_server.pl
new file mode 100755
index 0000000..a5775fc
--- /dev/null
+++ b/script/componentui_server.pl
@@ -0,0 +1,110 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ $ENV{CATALYST_ENGINE} ||= 'HTTP';
+ $ENV{CATALYST_SCRIPT_GEN} = 28;
+}
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+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 @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,
+);
+
+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 ComponentUI;
+
+ComponentUI->run( $port, $host, {
+ argv => \@argv,
+ 'fork' => $fork,
+ keepalive => $keepalive,
+ restart => $restart,
+ restart_delay => $restart_delay,
+ restart_regex => qr/$restart_regex/,
+ restart_directory => $restart_directory,
+} );
+
+1;
+
+=head1 NAME
+
+componentui_server.pl - Catalyst Testserver
+
+=head1 SYNOPSIS
+
+componentui_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 '../')
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@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
diff --git a/script/componentui_test.pl b/script/componentui_test.pl
new file mode 100755
index 0000000..c9fc92b
--- /dev/null
+++ b/script/componentui_test.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Pod::Usage;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Catalyst::Test 'ComponentUI';
+
+my $help = 0;
+
+GetOptions( 'help|?' => \$help );
+
+pod2usage(1) if ( $help || !$ARGV[0] );
+
+print request($ARGV[0])->content . "\n";
+
+1;
+
+=head1 NAME
+
+componentui_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+componentui_test.pl [options] uri
+
+ Options:
+ -help display this help and exits
+
+ Examples:
+ componentui_test.pl http://localhost/some_action
+ componentui_test.pl /some_action
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@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
diff --git a/script/moose_to_rclass.pl b/script/moose_to_rclass.pl
new file mode 100755
index 0000000..67d0e73
--- /dev/null
+++ b/script/moose_to_rclass.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+
+# THIS IS A FUCKING CHEESY HACK. DON'T RUN IT ON ANYTHING YOU CARE ABOUT
+# (and don't have in svn at least. Oh, and it breaks horribly on with)
+
+use strict;
+use warnings;
+
+my $data;
+
+foreach my $file (@ARGV) {
+ open IN, $file;
+ { local $/; $data = <IN>; }
+ close IN;
+ unless ($data =~ m/(.*?\n)(?:extends (.*?);)?\n+?(has.*)\n(1;\s*\n.*)/s) {
+ warn "Failed to match for ${file}\n";
+ next;
+ }
+ my ($front, $super_list, $body, $rest) = ($1, $2, $3, $4);
+ my @supers = split(/\s*,\s*/, $super_list);
+ my $pkg = (split(/\//, $file))[-1];
+ $pkg =~ s/\.pm//;
+ $body =~ s/^sub (\S+) {$/method $1 => sub {/mg;
+ $body =~ s/^}$/};/mg;
+ $body =~ s/^(\S+) '([^\+]\S+)' =>/$1 $2 =>/mg;
+ $body =~ s/^/ /mg;
+ my $is_list = join('', map { "is $_, " } @supers);
+ open OUT, '>', $file;
+ print OUT "${front}class ${pkg} ${is_list}which {\n${body}\n};\n\n${rest}";
+ close OUT;
+}
+
+exit 0;