Merge 'generated_app-fix' into 'trunk'
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 6a052e6..d407fee 100644 (file)
@@ -15,6 +15,11 @@ use Path::Class qw/dir file/;
 use File::ShareDir qw/dist_dir/;
 use namespace::autoclean;
 
+with 'MooseX::Emulate::Class::Accessor::Fast';
+
+# Change Catalyst/Devel.pm also
+our $VERSION = '1.22';
+
 my %cache;
 
 =head1 NAME
@@ -30,7 +35,10 @@ Catalyst::Helper - Bootstrap a Catalyst application
 sub get_sharedir_file {
     my ($self, @filename) = @_;
     my $dist_dir;
-    if (-d "inc/.author" && -f "lib/Catalyst/Helper.pm"
+    if (exists $ENV{CATALYST_DEVEL_SHAREDIR}) {
+        $dist_dir = $ENV{CATALYST_DEVEL_SHAREDIR};
+    }
+    elsif (-d "inc/.author" && -f "lib/Catalyst/Helper.pm"
             ) { # Can't use sharedir if we're in a checkout
                 # this feels horrible, better ideas?
         $dist_dir = 'share';
@@ -185,17 +193,19 @@ sub mk_component {
                     message => qq/Couldn't load helper "$class", "$@"/ );
             }
 
-            ## must be left for back compat! ###################################
             if ( $class->can('mk_compclass') ) {
                 return 1 unless $class->mk_compclass( $self, @args );
             }
-            else { return 1 unless $self->_mk_compclass }
+            else {
+                return 1 unless $self->_mk_compclass
+            }
 
             if ( $class->can('mk_comptest') ) {
                 $class->mk_comptest( $self, @args );
             }
-            else { $self->_mk_comptest }
-            ####################################################################
+            else {
+                $self->_mk_comptest
+            }
         }
 
         # Fallback