[Jifty-commit] r1060 - in jifty/trunk: lib/Jifty t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon May 15 08:40:55 EDT 2006


Author: jesse
Date: Mon May 15 08:40:54 2006
New Revision: 1060

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Util.pm
   jifty/trunk/t/01-version_checks.t

Log:
 r13798 at hualien:  jesse | 2006-05-15 08:40:18 -0400
 * Win32 cleanups from Kenichi Ishigaki


Modified: jifty/trunk/lib/Jifty/Util.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Util.pm	(original)
+++ jifty/trunk/lib/Jifty/Util.pm	Mon May 15 08:40:54 2006
@@ -19,6 +19,7 @@
 use UNIVERSAL::require;
 use ExtUtils::MakeMaker ();
 use Cwd ();
+use Config;
 
 # Trivial memoization to ward off evil Cwd calls.
 use vars qw/%ABSOLUTE_PATH $JIFTY_ROOT $SHARE_ROOT $APP_ROOT/;
@@ -114,9 +115,16 @@
         while (@root) {
             my $try = File::Spec->catdir( @root, "bin", "jifty" );
             if (    -e $try
-                and (-x $try or MM->maybe_command($try))
-                and $try ne "/usr/bin/jifty"
-                and $try ne "/usr/local/bin/jifty" )
+                # XXX: Just a quick hack
+                # MSWin32's 'maybe_command' sees only file extension.
+                # Maybe we should check 'jifty.bat' instead on Win32,
+                # if it is (or would be) provided.
+                # Also, /usr/bin or /usr/local/bin should be taken from
+                # %Config{bin} or %Config{scriptdir} or something like that
+                # for portablility.
+                and (-x $try or MM->maybe_command($try) or $^O eq 'MSWin32')
+                and $try ne File::Spec->catdir($Config{bin}, "jifty")
+                and $try ne File::Spec->catdir($Config{scriptdir}, "jifty") )
             {
                 return $APP_ROOT = File::Spec->catdir(@root);
             }
@@ -126,7 +134,7 @@
     warn "Can't guess application root from current path ("
         . Cwd::cwd()
         . ") or bin path ($FindBin::Bin)\n";
-    return undef;
+    return ''; # returning undef causes tons of 'uninitialized...' warnings.
 }
 
 =head2 default_app_name
@@ -175,6 +183,13 @@
     my $self = shift;
     my $class = shift;
 
+    # Quick hack to silence warnings.
+    # Maybe some dependencies were lost.
+    unless ($class) {
+        Jifty->log->error(sprintf("no class was given at %s line %d\n", (caller)[1,2]));
+        return 0;
+    }
+
     my $path =  join('/', split(/::/,$class)).".pm";
     return 1 if $INC{$path};
 

Modified: jifty/trunk/t/01-version_checks.t
==============================================================================
--- jifty/trunk/t/01-version_checks.t	(original)
+++ jifty/trunk/t/01-version_checks.t	Mon May 15 08:40:54 2006
@@ -16,6 +16,7 @@
 # just look for Jifty.pm
 my $dir = $INC{'Jifty.pm'};
 $dir =~ s/Jifty\.pm$//;
+$dir = quotemeta $dir;  # as MSWin32 has backslashes in the path
 my @files = grep({$_ =~ m/^$dir/} map({$INC{$_}} grep(/^Jifty\//, keys(%INC))));
 ok(scalar(@files));
 


More information about the Jifty-commit mailing list