[Bps-public-commit] Shipwright branch, master, updated. d285d30cee3b944c702f369bf1144956164834de
? sunnavy
sunnavy at bestpractical.com
Sun Jul 3 10:06:31 EDT 2011
The branch, master has been updated
via d285d30cee3b944c702f369bf1144956164834de (commit)
from 27c43614acd5816a8b3a59ef89f1cdd0b47ba696 (commit)
Summary of changes:
Changes | 2 ++
lib/Shipwright.pm | 1 +
lib/Shipwright/Source/Compressed.pm | 32 +++++++++++++++++++++++---------
lib/Shipwright/Source/Directory.pm | 20 ++++++++++++++++++--
4 files changed, 44 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit d285d30cee3b944c702f369bf1144956164834de
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sun Jul 3 22:02:40 2011 +0800
auto build dzil dist if necessary
diff --git a/Changes b/Changes
index 9fa029a..64a14b7 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for Shipwright
2.4.28
+* auto build Dist::Zilla distribution when importing.
+
2.4.27 Mon Jun 13 09:55:12 CST 2011
* allow to import perl with full uri
diff --git a/lib/Shipwright.pm b/lib/Shipwright.pm
index 32ca1cb..04e2921 100644
--- a/lib/Shipwright.pm
+++ b/lib/Shipwright.pm
@@ -17,6 +17,7 @@ $ENV{SHIPWRIGHT_MAKE} ||= which('make') || which('dmake') || which( 'nmake' ) ||
$ENV{SHIPWRIGHT_SVK} ||= which 'svk';
$ENV{SHIPWRIGHT_SVN} ||= which 'svn';
$ENV{SHIPWRIGHT_GIT} ||= which 'git';
+$ENV{SHIPWRIGHT_DZIL} ||= which 'dzil';
$ENV{SHIPWRIGHT_LWP_TIMEOUT} ||= 1200;
$ENV{PERL_MM_USE_DEFAULT} = 1; # always true
diff --git a/lib/Shipwright/Source/Compressed.pm b/lib/Shipwright/Source/Compressed.pm
index faf5e0a..247ef23 100644
--- a/lib/Shipwright/Source/Compressed.pm
+++ b/lib/Shipwright/Source/Compressed.pm
@@ -9,6 +9,7 @@ use Archive::Extract;
use File::Temp qw/tempdir/;
use File::Copy::Recursive qw/rmove/;
use Shipwright::Util;
+use Cwd qw/getcwd/;
=head2 run
@@ -87,16 +88,29 @@ sub _cmd {
my $ae = Archive::Extract->new( archive => $self->source );
- my @cmds;
- push @cmds, sub { $ae->extract( to => $self->directory ) };
-
- if ( $from ne $to ) {
- push @cmds, sub {
+ return sub {
+ $ae->extract( to => $self->directory );
+
+ if ( -e catfile( $from, 'dist.ini' )
+ && !-e catfile( $from, 'configure' )
+ && !-e catfile( $from, 'Makefile.PL' )
+ && !-e catfile( $from, 'Build.PL' ) )
+ {
+ # assume it's a Dist::Zilla dist
+ if ( $from eq $to ) {
+ rmove( $from, $from . '-tmp' );
+ }
+
+ my $old = getcwd();
+ chdir $from . '-tmp';
+ run_cmd( [ 'dzil', 'build', '--in', $to ] );
+ chdir $old;
+ }
+
+ if ( $from ne $to ) {
rmove( $from, $to );
- };
- }
-
- return @cmds;
+ }
+ };
}
1;
diff --git a/lib/Shipwright/Source/Directory.pm b/lib/Shipwright/Source/Directory.pm
index e7b1619..cac2a73 100644
--- a/lib/Shipwright/Source/Directory.pm
+++ b/lib/Shipwright/Source/Directory.pm
@@ -2,9 +2,10 @@ package Shipwright::Source::Directory;
use strict;
use warnings;
use Shipwright::Util;
-use File::Spec::Functions qw/catdir/;
+use File::Spec::Functions qw/catfile catdir/;
use File::Basename;
use File::Copy::Recursive qw/rcopy/;
+use Cwd qw/getcwd/;
use base qw/Shipwright::Source::Base/;
@@ -69,7 +70,22 @@ sub _cmd {
$self->name || $self->just_name( $self->path ) );
return if -e $to;
- return sub { rcopy( $self->source, $to ) };
+ if ( -e catfile( $self->source, 'dist.ini' )
+ && !-e catfile( $self->source, 'configure' )
+ && !-e catfile( $self->source, 'Makefile.PL' )
+ && !-e catfile( $self->source, 'Build.PL' ) )
+ {
+ my $old = getcwd();
+ # assume it's a Dist::Zilla dist
+ return sub {
+ chdir $self->source;
+ run_cmd( [ 'dzil', 'build', '--in', $to ] );
+ chdir $old;
+ };
+ }
+ else {
+ return sub { rcopy( $self->source, $to ) };
+ }
}
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list