move from Eventful repo to its own
Jonathan Rockway [Sun, 29 Mar 2009 23:32:12 +0000 (18:32 -0500)]
.gitignore [new file with mode: 0644]
Changes [new file with mode: 0644]
MANIFEST.SKIP [new file with mode: 0644]
Makefile.PL [new file with mode: 0644]
README [new file with mode: 0644]
lib/MooseX/Runnable.pm [new file with mode: 0644]
lib/MooseX/Runnable/Run.pm [new file with mode: 0644]
t/00-load.t [new file with mode: 0644]
xt/pod-coverage.t [new file with mode: 0644]
xt/pod.t [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..bfd20cf
--- /dev/null
@@ -0,0 +1,8 @@
+cover_db
+META.yml
+Makefile
+blib
+inc
+pm_to_blib
+MANIFEST
+Makefile.old
diff --git a/Changes b/Changes
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
new file mode 100644 (file)
index 0000000..8fb2024
--- /dev/null
@@ -0,0 +1,8 @@
+.git/
+blib
+pm_to_blib
+MANIFEST.bak
+MANIFEST.SKIP~
+cover_db
+Makefile$
+Makefile.old$
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644 (file)
index 0000000..951d9d8
--- /dev/null
@@ -0,0 +1,11 @@
+use inc::Module::Install;
+
+name 'MooseX-Runnable';
+all_from 'lib/MooseX/Runnable.pm';
+
+build_requires 'Catalyst::Runtime';
+build_requires 'Test::WWW::Mechanize::Catalyst';
+build_requires 'Test::More';
+build_requires 'ok';
+
+WriteAll();
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/MooseX/Runnable.pm b/lib/MooseX/Runnable.pm
new file mode 100644 (file)
index 0000000..d33a31d
--- /dev/null
@@ -0,0 +1,22 @@
+package MooseX::Runnable;
+use Moose::Role;
+
+our $RUNNING_APP;
+
+requires 'run';
+
+sub run_as_application {
+    my $class = shift;
+    my @args = @_;
+
+    if($class->does('MooseX::Getopt')){
+        my $self = $class->new_with_options(@args);
+        local $RUNNING_APP = $self;
+        exit $self->run( $self->extra_argv );
+    }
+
+    local $RUNNING_APP = $class->new(@args);
+    exit $RUNNING_APP->run;
+}
+
+1;
diff --git a/lib/MooseX/Runnable/Run.pm b/lib/MooseX/Runnable/Run.pm
new file mode 100644 (file)
index 0000000..4fe5759
--- /dev/null
@@ -0,0 +1,24 @@
+package MooseX::Runnable::Run;
+use strict;
+use warnings;
+
+use Class::MOP;
+
+use Sub::Exporter -setup => {
+    exports => ['run_as_application'],
+    groups  => {
+        default => ['run_as_application'],
+    },
+};
+
+sub run_as_application($;@){
+    my ($app, @args) = @_;
+
+    eval 'package main; use FindBin qw($Bin); use lib "$Bin/../lib"; 1;' or die;
+
+    Class::MOP::load_class($app);
+    die "$app is not runnable" unless $app->does('MooseX::Runnable');
+    $app->run_as_application(@args);
+}
+
+1;
diff --git a/t/00-load.t b/t/00-load.t
new file mode 100644 (file)
index 0000000..e29e35f
--- /dev/null
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 1;
+use ok 'MooseX::Runnable';
diff --git a/xt/pod-coverage.t b/xt/pod-coverage.t
new file mode 100644 (file)
index 0000000..703f91d
--- /dev/null
@@ -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();
diff --git a/xt/pod.t b/xt/pod.t
new file mode 100644 (file)
index 0000000..976d7cd
--- /dev/null
+++ b/xt/pod.t
@@ -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();