Changeset 10388 for trunk/Padre/lib/Padre/Project/Perl.pm
- Timestamp:
- 01/30/10 18:47:42 (2 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Project/Perl.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Project/Perl.pm
r10203 r10388 6 6 use strict; 7 7 use warnings; 8 use Padre::Project (); 8 use Padre::Project (); 9 use Padre::Project::Perl::MI (); 10 use Padre::Project::Perl::MB (); 11 use Padre::Project::Perl::DZ (); 12 use Padre::Project::Perl::EUMM (); 9 13 10 14 our $VERSION = '0.55'; … … 16 20 # Check the file argument 17 21 my $focus_file = shift; 18 unless ( -f $focus_file ) { 19 return; 20 } 22 return unless -f $focus_file; 21 23 22 24 # Search upwards from the file to find the project root … … 24 26 my @d = File::Spec->splitdir($d); 25 27 pop @d if $d[-1] eq ''; 26 my $dirs = List::Util::first { 27 -f File::Spec->catpath( $v, $_, 'Makefile.PL' ) 28 or -f File::Spec->catpath( $v, $_, 'Build.PL' ) 29 or -f File::Spec->catpath( $v, $_, 'dist.ini' ) 30 or -f File::Spec->catpath( $v, $_, 'padre.yml' ); 31 } 32 map { File::Spec->catdir( @d[ 0 .. $_ ] ) } reverse( 0 .. $#d ); 33 unless ( defined $dirs ) { 28 foreach ( reverse 0 .. $#d ) { 29 my $dir = File::Spec->catdir( @d[ 0 .. $_ ] ); 30 31 # Check for Dist::Zilla support 32 my $dist_ini = File::Spec->catpath( $v, $dir, 'dist.ini' ); 33 if ( -f $dist_ini ) { 34 return Padre::Project::Perl::DZ->new( 35 root => File::Spec->catpath( $v, $dir ), 36 dist_ini => $dist_ini, 37 ); 38 } 39 40 # Check for Module::Build support 41 my $build_pl = File::Spec->catpath( $v, $dir, 'Build.PL' ); 42 if ( -f $build_pl ) { 43 return Padre::Project::Perl::MB->new( 44 root => File::Spec->catpath( $v, $dir ), 45 build_pl => $build_pl, 46 ); 47 } 48 49 # Check for ExtUtils::MakeMaker and Module::Install support 50 my $makefile_pl = File::Spec->catpath( $v, $dir, 'Makefile.PL' ); 51 if ( -f $makefile_pl ) { 52 # Differentiate between Module::Install and ExtUtils::MakeMaker 53 return Padre::Project::Perl::EUMM->new( 54 root => File::Spec->catpath( $v, $dir ), 55 makefile_pl => $makefile_pl, 56 ); 57 } 58 59 # Fall back to looking for null projects 60 my $padre_yml = File::Spec->catpath( $v, $dir, 'padre.yml' ); 61 if ( -f $padre_yml ) { 62 return Padre::Project::Perl->new( 63 root => File::Spec->catpath( $v, $dir ), 64 padre_yml => $padre_yml, 65 ); 66 } 67 34 68 return; 35 69 } 36 37 # Hand off to the regular constructor38 return $class->new(39 root => File::Spec->catpath( $v, $dirs ),40 );41 70 } 42 71
Note: See TracChangeset
for help on using the changeset viewer.
