Only include the lib directory when we detect a Makefile.PL or similar
Tomas Doran [Mon, 6 Feb 2012 21:27:51 +0000 (21:27 +0000)]
Changes
lib/Catalyst/ScriptRunner.pm

diff --git a/Changes b/Changes
index e153c22..a2bc3d0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+ Bug fixes:
+  - The Catalyst::Utils::home function is used to find if the application
+    is a checkout in Catalyst::ScriptRunner. This means that a non-existant
+    lib directory that is relative to the script install location is not
+    included when not running from a checkout.
+
 5.90008 - TRIAL 2012-02-06 20:49:00
 
  New features and refactoring:
index 7619e61..1b52e13 100644 (file)
@@ -4,6 +4,7 @@ use FindBin;
 use lib;
 use File::Spec;
 use Class::Load qw/ load_first_existing_class load_optional_class /;
+use Catalyst::Utils;
 use namespace::autoclean -also => 'subclass_with_traits';
 use Try::Tiny;
 
@@ -34,7 +35,9 @@ sub subclass_with_traits {
 sub run {
     my ($self, $appclass, $scriptclass) = @_;
 
-    lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
+    if (my $home = Catalyst::Utils::home($appclass)) {
+        lib->import(File::Spec->catdir($home, 'lib'));
+    }
 
     my $class = $self->find_script_class($appclass, $scriptclass);