Provide .psgi for Plack goodness.
Dan Brook [Sun, 22 May 2011 16:22:01 +0000 (18:22 +0200)]
The .psgi was written by franky (Francoise Dehinbo) and gist-ed by
Ranguard (Leo Lapworth). I've tweaked it to play nice with checkouts
and "make install".

Makefile.PL
lib/Gitalist.pm
script/gitalist_app.psgi [new file with mode: 0644]

index efb6e76..1bf9848 100644 (file)
@@ -131,7 +131,7 @@ if ($ENV{GITALIST_RELEASE_TESTING}) {
     author_requires('WWW::Mechanize::TreeBuilder');
 }
 
-install_script glob('script/*.pl');
+install_script glob('script/*.p{l,sgi}');
 auto_install;
 
 {   # Make sure you REALLY REALLY have to have the env variable set to run
index bd2f533..a0aa3fd 100644 (file)
@@ -204,6 +204,14 @@ This example can be seen live here:
 
     http://example.gitalist.com
 
+=head2 Plack
+
+If you would like to run Gitalist under L<Plack> then one need only
+make use of L<plackup|search.cpan.org/perldoc?plackup> and the
+C<.psgi> found under C<scripts/>:
+
+    plackup script/gitalist_app.psgi
+
 =head1 CONFIGURATION
 
 The Gitalist config is loaded with L<Catalyst::Plugin::ConfigLoader>
diff --git a/script/gitalist_app.psgi b/script/gitalist_app.psgi
new file mode 100644 (file)
index 0000000..4a846e4
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+
+use strict;
+
+use FindBin;
+BEGIN {
+    my $env = "$FindBin::Bin/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
+
+use Gitalist;
+use Plack::Builder;
+
+Gitalist->setup_engine('PSGI');
+my $app = sub { Gitalist->run(@_) };
+
+builder { $app };