Perl-Dist-WiX

changeset 1030:af7b8d5d5959 maint-May2011

Backport of revisions 60125669, c8a45351, and 4d84f3b9 to maint-May2011.

(Getting rid of dependency on File::Remove and correcting an error in an
exception)
author Curtis Jewell <perl@curtisjewell.name>
date Sat Jun 04 21:15:41 2011 -0600 (2011-06-04)
parents c55213daa821
children 64d56901c1e7
files Build.PL Changes lib/Perl/Dist/WiX.pm lib/Perl/Dist/WiX/Asset/DistFile.pm lib/Perl/Dist/WiX/Asset/Distribution.pm lib/Perl/Dist/WiX/Asset/File.pm lib/Perl/Dist/WiX/Asset/Library.pm lib/Perl/Dist/WiX/Asset/Perl.pm lib/Perl/Dist/WiX/Mixin/Checkpoint.pm lib/Perl/Dist/WiX/Mixin/Support.pm lib/Perl/Dist/WiX/Role/Asset.pm lib/Perl/Dist/WiX/Util/Machine.pm
line diff
     1.1 --- a/Build.PL	Fri May 27 07:03:21 2011 -0600
     1.2 +++ b/Build.PL	Sat Jun 04 21:15:41 2011 -0600
     1.3 @@ -39,10 +39,9 @@
     1.4  		'File::Find::Rule'           => '0.30',
     1.5  		'File::HomeDir'              => '0.82',
     1.6  		'File::List::Object'         => '0.201',
     1.7 -		'File::Path'                 => '2.07',
     1.8 +		'File::Path'                 => '2.08',
     1.9  		'File::PathList'             => '1.04',
    1.10  		'File::pushd'                => '1.00',
    1.11 -		'File::Remove'               => '1.42',
    1.12  		'File::ShareDir'             => '1.02',
    1.13  		'File::Spec'                 => '3.29',
    1.14  		'File::Temp'                 => '0.21',
     2.1 --- a/Changes	Fri May 27 07:03:21 2011 -0600
     2.2 +++ b/Changes	Sat Jun 04 21:15:41 2011 -0600
     2.3 @@ -1,6 +1,9 @@
     2.4  Changes for Perl extension Perl-Dist-WiX
     2.5  
     2.6 -1.500001   Wed 23 Feb 2011
     2.7 +1.500002   Sat 04 Jun 2011
     2.8 +    1. (backported) Remove File::Remove from dependencies.
     2.9 +
    2.10 +1.500001   Thu 19 May 2011
    2.11      1. Used to build Strawberry Perl 5.12.3.0/5.10.1.5.
    2.12      2. Includes the 5.12.3 plugin for testing purposes.
    2.13  
     3.1 --- a/lib/Perl/Dist/WiX.pm	Fri May 27 07:03:21 2011 -0600
     3.2 +++ b/lib/Perl/Dist/WiX.pm	Sat Jun 04 21:15:41 2011 -0600
     3.3 @@ -155,7 +155,6 @@
     3.4  #>>>
     3.5  
     3.6  our $VERSION = '1.500002';
     3.7 -$VERSION =~ s/_//ms;
     3.8  
     3.9  with
    3.10    'MooseX::Object::Pluggable'          => { -version => 0.0011 },
    3.11 @@ -163,12 +162,12 @@
    3.12    ;
    3.13  extends
    3.14    'Perl::Dist::WiX::Mixin::BuildPerl'    => { -version => 1.500002 },
    3.15 -  'Perl::Dist::WiX::Mixin::Checkpoint'   => { -version => 1.500 },
    3.16 +  'Perl::Dist::WiX::Mixin::Checkpoint'   => { -version => 1.500002 },
    3.17    'Perl::Dist::WiX::Mixin::Libraries'    => { -version => 1.500002 },
    3.18    'Perl::Dist::WiX::Mixin::Installation' => { -version => 1.500 },
    3.19    'Perl::Dist::WiX::Mixin::ReleaseNotes' => { -version => 1.500 },
    3.20    'Perl::Dist::WiX::Mixin::Patching'     => { -version => 1.500 },
    3.21 -  'Perl::Dist::WiX::Mixin::Support'      => { -version => 1.500001 },
    3.22 +  'Perl::Dist::WiX::Mixin::Support'      => { -version => 1.500002 },
    3.23    ;
    3.24  
    3.25  #####################################################################
    3.26 @@ -1951,7 +1950,7 @@
    3.27  
    3.28  	if ( $self->_has_moved_cpan() ) {
    3.29  		my $x = eval {
    3.30 -			File::Remove::remove( \1, $self->_cpan_sources_from() );
    3.31 +			$self->remove_path( $self->_cpan_sources_from() );
    3.32  			File::Copy::Recursive::move( $self->_cpan_sources_to(),
    3.33  				$self->_cpan_sources_from() );
    3.34  		};
    3.35 @@ -2285,7 +2284,7 @@
    3.36  		PDWiX::Parameter->throw(
    3.37  			parameter => 'perl_version: No plugin installed'
    3.38  			  . " for the requested version of perl ($version_plugin)",
    3.39 -			where => '->final_initialization',
    3.40 +			where => '->run',
    3.41  		);
    3.42  	}
    3.43  
    3.44 @@ -2375,6 +2374,8 @@
    3.45  	$ENV{TEMP} = $self->tempenv_dir();
    3.46  	$self->trace_line( 5, 'Emptied: ' . $self->tempenv_dir() . "\n" );
    3.47  
    3.48 +	### *** TODO: Move AppData/.cpan/CPAN/MyConfig.pm out of the way. ***
    3.49 +
    3.50  	# If we have a file:// url for the CPAN, move the
    3.51  	# sources directory out of the way.
    3.52  	if ( $self->cpan()->as_string() =~ m{\Afile://}mxsi ) {
    3.53 @@ -3020,7 +3021,7 @@
    3.54  	my $self = shift;
    3.55  	my $dir  = $self->dir(@_);
    3.56  	if ( -e $dir ) {
    3.57 -		File::Remove::remove( \1, $dir );
    3.58 +		$self->remove_path( $dir );
    3.59  	}
    3.60  	return 1;
    3.61  }
    3.62 @@ -3029,7 +3030,7 @@
    3.63  	my $self = shift;
    3.64  	my $file = $self->file(@_);
    3.65  	if ( -e $file ) {
    3.66 -		File::Remove::remove( \1, $file );
    3.67 +		unlink( $file );
    3.68  	}
    3.69  	return 1;
    3.70  }
     4.1 --- a/lib/Perl/Dist/WiX/Asset/DistFile.pm	Fri May 27 07:03:21 2011 -0600
     4.2 +++ b/lib/Perl/Dist/WiX/Asset/DistFile.pm	Sat Jun 04 21:15:41 2011 -0600
     4.3 @@ -8,7 +8,7 @@
     4.4  
     4.5  =head1 VERSION
     4.6  
     4.7 -This document describes Perl::Dist::WiX::Asset::DistFile version 1.500.
     4.8 +This document describes Perl::Dist::WiX::Asset::DistFile version 1.500002.
     4.9  
    4.10  =head1 SYNOPSIS
    4.11  
    4.12 @@ -53,20 +53,19 @@
    4.13  
    4.14  =cut
    4.15  
    4.16 +#<<<
    4.17  use 5.010;
    4.18  use Moose;
    4.19 -use MooseX::Types::Moose qw( Str Maybe Bool ArrayRef );
    4.20 -use File::Spec::Functions qw( catdir catfile splitpath );
    4.21 +use MooseX::Types::Moose        qw( Str Maybe Bool ArrayRef );
    4.22 +use File::Spec::Functions       qw( catdir catfile splitpath );
    4.23 +use URI                         qw();
    4.24 +use File::Spec::Unix            qw();
    4.25 +use Perl::Dist::WiX::Exceptions qw();
    4.26 +#>>>
    4.27  
    4.28 -require File::Remove;
    4.29 -require URI;
    4.30 -require File::Spec::Unix;
    4.31 -require Perl::Dist::WiX::Exceptions;
    4.32 +our $VERSION = '1.500002';
    4.33  
    4.34 -our $VERSION = '1.500';
    4.35 -$VERSION =~ s/_//ms;
    4.36 -
    4.37 -with qw(Perl::Dist::WiX::Role::Asset WiX3::Role::Traceable);
    4.38 +with qw( Perl::Dist::WiX::Role::Asset WiX3::Role::Traceable );
    4.39  extends 'Perl::Dist::WiX::Asset::DistBase';
    4.40  
    4.41  =head1 METHODS
    4.42 @@ -266,7 +265,7 @@
    4.43  	# Extract the tarball
    4.44  	if ( -d $unpack_to ) {
    4.45  		$self->_trace_line( 2, "Removing previous $unpack_to\n" );
    4.46 -		File::Remove::remove( \1, $unpack_to );
    4.47 +		$self->remove_path( $unpack_to );
    4.48  	}
    4.49  	$self->_trace_line( 4, "Unpacking to $unpack_to\n" );
    4.50  	$self->_extract( $path => $self->_get_build_dir() );
     5.1 --- a/lib/Perl/Dist/WiX/Asset/Distribution.pm	Fri May 27 07:03:21 2011 -0600
     5.2 +++ b/lib/Perl/Dist/WiX/Asset/Distribution.pm	Sat Jun 04 21:15:41 2011 -0600
     5.3 @@ -8,7 +8,7 @@
     5.4  
     5.5  =head1 VERSION
     5.6  
     5.7 -This document describes Perl::Dist::WiX::Asset::Distribution version 1.500001.
     5.8 +This document describes Perl::Dist::WiX::Asset::Distribution version 1.500002.
     5.9  
    5.10  =head1 SYNOPSIS
    5.11  
    5.12 @@ -47,17 +47,16 @@
    5.13  
    5.14  =cut
    5.15  
    5.16 +#<<<
    5.17  use 5.010;
    5.18  use Moose;
    5.19 -use MooseX::Types::Moose qw( Str Bool ArrayRef Maybe );
    5.20 -use File::Spec::Functions qw( catdir catfile );
    5.21 -use Params::Util qw( _INSTANCE );
    5.22 +use MooseX::Types::Moose   qw( Str Bool ArrayRef Maybe );
    5.23 +use File::Spec::Functions  qw( catdir catfile );
    5.24 +use Params::Util           qw( _INSTANCE );
    5.25 +use URI                    qw();
    5.26 +#>>>
    5.27  
    5.28 -require File::Remove;
    5.29 -require URI;
    5.30 -
    5.31 -our $VERSION = '1.500001';
    5.32 -$VERSION =~ s/_//ms;
    5.33 +our $VERSION = '1.500002';
    5.34  
    5.35  with 'Perl::Dist::WiX::Role::Asset';
    5.36  extends 'Perl::Dist::WiX::Asset::DistBase';
    5.37 @@ -382,10 +381,13 @@
    5.38  	}
    5.39  
    5.40  	# Download the file
    5.41 -	my $tgz = $self->_mirror_url(
    5.42 -		$self->_abs_uri( $self->_get_cpan() ),
    5.43 -		$self->_get_modules_dir(),
    5.44 -	);
    5.45 +	my $url = $self->_abs_uri( $self->_get_cpan() );
    5.46 +	my $tgz = eval { 
    5.47 +		$self->_mirror_url( $url, $self->_get_modules_dir(), ) 
    5.48 +	} || PDWiX::Caught->throw(
    5.49 +			message => $@, 
    5.50 +			info => 'Error trying to download distribution'
    5.51 +		);
    5.52  
    5.53  	# Does it exist? If not, throw an error here.
    5.54  	if ( not -f $tgz ) {
    5.55 @@ -404,7 +406,7 @@
    5.56  	# Extract the tarball
    5.57  	if ( -d $unpack_to ) {
    5.58  		$self->_trace_line( 2, "Removing previous $unpack_to\n" );
    5.59 -		File::Remove::remove( \1, $unpack_to );
    5.60 +		$self->remove_path( \1, $unpack_to );
    5.61  	}
    5.62  	$self->_extract( $tgz => $build_dir );
    5.63  	if ( not -d $unpack_to ) {
     6.1 --- a/lib/Perl/Dist/WiX/Asset/File.pm	Fri May 27 07:03:21 2011 -0600
     6.2 +++ b/lib/Perl/Dist/WiX/Asset/File.pm	Sat Jun 04 21:15:41 2011 -0600
     6.3 @@ -8,7 +8,7 @@
     6.4  
     6.5  =head1 VERSION
     6.6  
     6.7 -This document describes Perl::Dist::WiX::Asset::File version 1.500.
     6.8 +This document describes Perl::Dist::WiX::Asset::File version 1.500002.
     6.9  
    6.10  =head1 SYNOPSIS
    6.11  
    6.12 @@ -39,11 +39,9 @@
    6.13  use Moose;
    6.14  use MooseX::Types::Moose qw( Str );
    6.15  use File::Spec::Functions qw( catfile );
    6.16 -use File::Remove qw();
    6.17  use File::List::Object qw();
    6.18  
    6.19 -our $VERSION = '1.500';
    6.20 -$VERSION =~ s/_//ms;
    6.21 +our $VERSION = '1.500002';
    6.22  
    6.23  with 'Perl::Dist::WiX::Role::Asset';
    6.24  
    6.25 @@ -110,7 +108,7 @@
    6.26  	$self->_copy( $from => $to );
    6.27  
    6.28  	# Clear the download file
    6.29 -	File::Remove::remove( \1, $file );
    6.30 +	unlink($file);
    6.31  
    6.32  	my $filelist =
    6.33  	  File::List::Object->new()->load_array(@files)
     7.1 --- a/lib/Perl/Dist/WiX/Asset/Library.pm	Fri May 27 07:03:21 2011 -0600
     7.2 +++ b/lib/Perl/Dist/WiX/Asset/Library.pm	Sat Jun 04 21:15:41 2011 -0600
     7.3 @@ -8,7 +8,7 @@
     7.4  
     7.5  =head1 VERSION
     7.6  
     7.7 -This document describes Perl::Dist::WiX::Asset::Library version 1.500.
     7.8 +This document describes Perl::Dist::WiX::Asset::Library version 1.500002.
     7.9  
    7.10  =head1 SYNOPSIS
    7.11  
    7.12 @@ -55,8 +55,7 @@
    7.13  use Moose;
    7.14  use MooseX::Types::Moose qw( Str Maybe HashRef );
    7.15  
    7.16 -our $VERSION = '1.500';
    7.17 -$VERSION =~ s/_//ms;
    7.18 +our $VERSION = '1.500002';
    7.19  
    7.20  with 'Perl::Dist::WiX::Role::Asset';
    7.21  
    7.22 @@ -219,7 +218,7 @@
    7.23  	  catdir( $self->_get_build_dir(), $self->_get_unpack_to() );
    7.24  	if ( -d $unpack_to ) {
    7.25  		$self->_trace_line( 2, "Removing previous $unpack_to\n" );
    7.26 -		File::Remove::remove( \1, $unpack_to );
    7.27 +		$self->remove_path( $unpack_to );
    7.28  	}
    7.29  	@files = $self->_extract( $tgz, $unpack_to );
    7.30  
     8.1 --- a/lib/Perl/Dist/WiX/Asset/Perl.pm	Fri May 27 07:03:21 2011 -0600
     8.2 +++ b/lib/Perl/Dist/WiX/Asset/Perl.pm	Sat Jun 04 21:15:41 2011 -0600
     8.3 @@ -8,7 +8,7 @@
     8.4  
     8.5  =head1 VERSION
     8.6  
     8.7 -This document describes Perl::Dist::WiX::Asset::Perl version 1.500.
     8.8 +This document describes Perl::Dist::WiX::Asset::Perl version 1.500002.
     8.9  
    8.10  =head1 SYNOPSIS
    8.11  
    8.12 @@ -38,17 +38,15 @@
    8.13  
    8.14  =cut
    8.15  
    8.16 -# Perl::Dist asset for the Perl source code itself
    8.17 -
    8.18 +#<<<
    8.19  use 5.010;
    8.20  use Moose;
    8.21 -use MooseX::Types::Moose qw( Str HashRef ArrayRef Bool Maybe );
    8.22 -use File::Spec::Functions qw( catdir splitpath rel2abs catfile );
    8.23 -require File::Remove;
    8.24 -require File::Basename;
    8.25 +use MooseX::Types::Moose   qw( Str HashRef ArrayRef Bool Maybe );
    8.26 +use File::Spec::Functions  qw( catdir splitpath rel2abs catfile );
    8.27 +use File::Basename         qw();
    8.28 +#>>>
    8.29  
    8.30 -our $VERSION = '1.500';
    8.31 -$VERSION =~ s/_//ms;
    8.32 +our $VERSION = '1.500002';
    8.33  
    8.34  with 'Perl::Dist::WiX::Role::Asset';
    8.35  
     9.1 --- a/lib/Perl/Dist/WiX/Mixin/Checkpoint.pm	Fri May 27 07:03:21 2011 -0600
     9.2 +++ b/lib/Perl/Dist/WiX/Mixin/Checkpoint.pm	Sat Jun 04 21:15:41 2011 -0600
     9.3 @@ -8,7 +8,7 @@
     9.4  
     9.5  =head1 VERSION
     9.6  
     9.7 -This document describes Perl::Dist::WiX::Mixin::Checkpoint version 1.500.
     9.8 +This document describes Perl::Dist::WiX::Mixin::Checkpoint version 1.500002.
     9.9  
    9.10  =head1 SYNOPSIS
    9.11  
    9.12 @@ -40,17 +40,17 @@
    9.13  
    9.14  =cut
    9.15  
    9.16 +#<<<
    9.17  use 5.010;
    9.18  use Moose;
    9.19 -use English qw( -no_match_vars );
    9.20 -use List::Util qw( first );
    9.21 -use File::Spec::Functions qw( catdir catfile );
    9.22 -use File::Remove qw();
    9.23 -use Storable qw();
    9.24 -use Clone qw(clone);
    9.25 +use English                qw( -no_match_vars );
    9.26 +use List::Util             qw( first );
    9.27 +use File::Spec::Functions  qw( catdir catfile );
    9.28 +use Storable               qw();
    9.29 +use Clone                  qw(clone);
    9.30 +#>>>
    9.31  
    9.32 -our $VERSION = '1.500';
    9.33 -$VERSION =~ s/_//ms;
    9.34 +our $VERSION = '1.500002';
    9.35  
    9.36  =head2 checkpoint_task
    9.37  
    9.38 @@ -270,7 +270,7 @@
    9.39  	foreach my $dir (qw{ build_dir download_dir image_dir output_dir }) {
    9.40  		my $from = File::Spec->catdir( $self->checkpoint_dir(), $dir );
    9.41  		my $to = $self->$dir();
    9.42 -		File::Remove::remove($to);
    9.43 +		$self->remove_path($to);
    9.44  		$self->copy_file( $from => $to );
    9.45  	}
    9.46  
    10.1 --- a/lib/Perl/Dist/WiX/Mixin/Support.pm	Fri May 27 07:03:21 2011 -0600
    10.2 +++ b/lib/Perl/Dist/WiX/Mixin/Support.pm	Sat Jun 04 21:15:41 2011 -0600
    10.3 @@ -8,7 +8,7 @@
    10.4  
    10.5  =head1 VERSION
    10.6  
    10.7 -This document describes Perl::Dist::WiX::Mixin::Support version 1.500001.
    10.8 +This document describes Perl::Dist::WiX::Mixin::Support version 1.500002.
    10.9  
   10.10  =head1 SYNOPSIS
   10.11  
   10.12 @@ -23,27 +23,27 @@
   10.13  
   10.14  =cut
   10.15  
   10.16 +#<<<
   10.17  use 5.010;
   10.18  use Moose;
   10.19 -use English qw( -no_match_vars );
   10.20 -use Archive::Tar 1.42 qw();
   10.21 -use Archive::Zip qw( AZ_OK );
   10.22 -use Devel::StackTrace qw();
   10.23 -use LWP::UserAgent qw();
   10.24 -use File::Basename qw();
   10.25 -use File::Find::Rule qw();
   10.26 -use File::Path qw();
   10.27 -use File::pushd qw();
   10.28 -use File::Remove qw();
   10.29 -use File::Spec::Functions qw( catdir catfile rel2abs catpath );
   10.30 -use File::Slurp qw(read_file);
   10.31 -use IO::Compress::Bzip2 2.025;
   10.32 -use IO::Compress::Gzip 2.025;
   10.33 +use English                    qw( -no_match_vars );
   10.34 +use Archive::Tar          1.42 qw();
   10.35 +use Archive::Zip               qw( AZ_OK );
   10.36 +use Devel::StackTrace          qw();
   10.37 +use LWP::UserAgent             qw();
   10.38 +use File::Basename             qw();
   10.39 +use File::Find::Rule           qw();
   10.40 +use File::Path            2.08 qw();
   10.41 +use File::pushd                qw();
   10.42 +use File::Spec::Functions      qw( catdir catfile rel2abs catpath );
   10.43 +use File::Slurp                qw(read_file);
   10.44 +use IO::Compress::Bzip2  2.025 qw();
   10.45 +use IO::Compress::Gzip   2.025 qw();
   10.46 +#>>>
   10.47  
   10.48  # IO::Uncompress::Xz is tested for later, as it's an 'optional'.
   10.49  
   10.50 -our $VERSION = '1.500001';
   10.51 -$VERSION =~ s/_//ms;
   10.52 +our $VERSION = '1.500002';
   10.53  
   10.54  
   10.55  
   10.56 @@ -650,14 +650,30 @@
   10.57  sub make_path {
   10.58  	my $class = shift;
   10.59  	my $dir   = rel2abs(shift);
   10.60 -
   10.61 +	my $err;
   10.62  	if ( not -d $dir ) {
   10.63 -		File::Path::mkpath($dir);
   10.64 +		File::Path::make_path("$dir", { error => \$err, });
   10.65 +		if (@{$err}) {
   10.66 +			my $errors = q{};
   10.67 +			for my $diag (@{$err}) {
   10.68 +				my ($file, $message) = %{$diag};
   10.69 +				if ($file eq q{}) {
   10.70 +					$errors .= "General error: $message\n";
   10.71 +				}
   10.72 +				else {
   10.73 +					$errors .= "Problem remaking $file: $message\n";
   10.74 +				}
   10.75 +			}
   10.76 +			PDWiX::Directory->throw(
   10.77 +				dir     => $dir,
   10.78 +				message => "Failed to create directory, errors:\n$errors"
   10.79 +			);	
   10.80 +		}
   10.81  	}
   10.82  	if ( not -d $dir ) {
   10.83  		PDWiX::Directory->throw(
   10.84  			directory => $dir,
   10.85 -			message   => 'Failed to create'
   10.86 +			message   => 'Failed to create directory, no information why'
   10.87  		);
   10.88  	}
   10.89  	return $dir;
   10.90 @@ -680,15 +696,59 @@
   10.91  sub remake_path {
   10.92  	my $class = shift;
   10.93  	my $dir   = rel2abs(shift);
   10.94 -	if ( -d $dir ) {
   10.95 -		File::Remove::remove( \1, $dir );
   10.96 +	my $err;
   10.97 +	if ( -d "$dir" ) {
   10.98 +		File::Path::remove_tree("$dir", {
   10.99 +			keep_root => 1,
  10.100 +			error     => \$err, 
  10.101 +		});
  10.102 +		my $e = $@;
  10.103 +		if ($e) {
  10.104 +			PDWiX::Directory->throw(
  10.105 +				dir     => $dir,
  10.106 +				message => "Failed to remove directory during recreation, critical error:\n$e"
  10.107 +			);	
  10.108 +		}
  10.109 +		if (@{$err}) {
  10.110 +			my $errors = q{};
  10.111 +			for my $diag (@{$err}) {
  10.112 +				my ($file, $message) = %{$diag};
  10.113 +				if ($file eq q{}) {
  10.114 +					$errors .= "General error: $message\n";
  10.115 +				}
  10.116 +				else {
  10.117 +					$errors .= "Problem removing $file: $message\n";
  10.118 +				}
  10.119 +			}
  10.120 +			PDWiX::Directory->throw(
  10.121 +				dir     => $dir,
  10.122 +				message => "Failed to remove directory during recreation, errors:\n$errors"
  10.123 +			);	
  10.124 +		}
  10.125  	}
  10.126 -	File::Path::mkpath($dir);
  10.127 -
  10.128 -	if ( not -d $dir ) {
  10.129 +	if ( not -d "$dir" ) {
  10.130 +		File::Path::make_path("$dir", { error => \$err, });
  10.131 +		if (@{$err}) {
  10.132 +			my $errors = q{};
  10.133 +			for my $diag (@{$err}) {
  10.134 +				my ($file, $message) = %{$diag};
  10.135 +				if ($file eq q{}) {
  10.136 +					$errors .= "General error: $message\n";
  10.137 +				}
  10.138 +				else {
  10.139 +					$errors .= "Problem remaking $file: $message\n";
  10.140 +				}
  10.141 +			}
  10.142 +			PDWiX::Directory->throw(
  10.143 +				dir     => $dir,
  10.144 +				message => "Failed to recreate directory, errors:\n$errors"
  10.145 +			);	
  10.146 +		}
  10.147 +	}
  10.148 +	if ( not -d "$dir" ) {
  10.149  		PDWiX::Directory->throw(
  10.150  			dir     => $dir,
  10.151 -			message => 'Failed to recreate'
  10.152 +			message => "Failed to recreate directory, no information why"
  10.153  		);
  10.154  	}
  10.155  	return $dir;
  10.156 @@ -696,6 +756,55 @@
  10.157  
  10.158  
  10.159  
  10.160 +=head2 remove_path
  10.161 +
  10.162 +	$dist->remove_path('perl\bin');
  10.163 +
  10.164 +Removes a path, removing all the files in it if the path already exists.
  10.165 +
  10.166 +The path passed in is converted to an absolute path using 
  10.167 +L<File::Spec::Functions|File::Spec::Functions>::L<rel2abs()|File::Spec/rel2abs>
  10.168 +before deletion occurs.
  10.169 +
  10.170 +=cut
  10.171 +
  10.172 +sub remove_path {
  10.173 +	my $class = shift;
  10.174 +	my $dir   = rel2abs(shift);
  10.175 +	my $err;
  10.176 +	if ( -d "$dir" ) {
  10.177 +		File::Path::remove_tree("$dir", {
  10.178 +			keep_root => 0,
  10.179 +			error     => \$err, 
  10.180 +		});
  10.181 +		my $e = $@;
  10.182 +		if ($e) {
  10.183 +			PDWiX::Directory->throw(
  10.184 +				dir     => $dir,
  10.185 +				message => "Failed to remove directory, critical error:\n$e"
  10.186 +			);	
  10.187 +		}
  10.188 +		if (@{$err}) {
  10.189 +			my $errors = q{};
  10.190 +			for my $diag (@{$err}) {
  10.191 +				my ($file, $message) = %{$diag};
  10.192 +				if ($file eq q{}) {
  10.193 +					$errors .= "General error: $message\n";
  10.194 +				}
  10.195 +				else {
  10.196 +					$errors .= "Problem removing $file: $message\n";
  10.197 +				}
  10.198 +			}
  10.199 +			PDWiX::Directory->throw(
  10.200 +				dir     => $dir,
  10.201 +				message => "Failed to remove directory, errors:\n$errors"
  10.202 +			);	
  10.203 +		}
  10.204 +	}
  10.205 +}
  10.206 +
  10.207 +
  10.208 +
  10.209  =head2 make_relocation_file
  10.210  
  10.211  	$dist->make_relocation_file('strawberry_merge_module.reloc.txt');
    11.1 --- a/lib/Perl/Dist/WiX/Role/Asset.pm	Fri May 27 07:03:21 2011 -0600
    11.2 +++ b/lib/Perl/Dist/WiX/Role/Asset.pm	Sat Jun 04 21:15:41 2011 -0600
    11.3 @@ -8,7 +8,7 @@
    11.4  
    11.5  =head1 VERSION
    11.6  
    11.7 -This document describes Perl::Dist::WiX::Role::Asset version 1.500.
    11.8 +This document describes Perl::Dist::WiX::Role::Asset version 1.500002.
    11.9  
   11.10  =head1 SYNOPSIS
   11.11  
   11.12 @@ -23,23 +23,23 @@
   11.13  
   11.14  =cut
   11.15  
   11.16 -# Convenience role for Perl::Dist::WiX assets
   11.17 -
   11.18 +#<<<
   11.19  use 5.010;
   11.20  use Moose::Role;
   11.21 -use File::Spec::Functions qw( rel2abs catdir catfile );
   11.22 -use MooseX::Types::Moose qw( Str Maybe );
   11.23 -use Params::Util qw( _INSTANCE );
   11.24 -use English qw( -no_match_vars );
   11.25 -require File::List::Object;
   11.26 -require File::ShareDir;
   11.27 -require File::Spec::Unix;
   11.28 -require Perl::Dist::WiX::Exceptions;
   11.29 -require URI;
   11.30 -require URI::file;
   11.31 +use File::Spec::Functions        qw( rel2abs catdir catfile );
   11.32 +use MooseX::Types::Moose         qw( Str Maybe );
   11.33 +use Params::Util                 qw( _INSTANCE );
   11.34 +use English                      qw( -no_match_vars );
   11.35 +use File::Path              2.08 qw();
   11.36 +use File::List::Object           qw();
   11.37 +use File::ShareDir               qw();
   11.38 +use File::Spec::Unix             qw();
   11.39 +use Perl::Dist::WiX::Exceptions  qw();
   11.40 +use URI                          qw();
   11.41 +use URI::file                    qw();
   11.42 +#>>>
   11.43  
   11.44 -our $VERSION = '1.500';
   11.45 -$VERSION =~ s/_//ms;
   11.46 +our $VERSION = '1.500002';
   11.47  
   11.48  =head1 ATTRIBUTES
   11.49  
   11.50 @@ -363,6 +363,50 @@
   11.51  } ## end sub _search_packlist
   11.52  
   11.53  
   11.54 +=head2 remove_path
   11.55 +
   11.56 +The C<remove_path> method is for the convienence of assets that need it.
   11.57 +
   11.58 +It removes the path specified, and can take any object (e.g., a 
   11.59 +L<Path::Class::Dir>) that stringifies to a name of a directory to remove.
   11.60 +
   11.61 +=cut
   11.62 +
   11.63 +sub remove_path {
   11.64 +	my $class = shift;
   11.65 +	my $dir   = rel2abs(shift);
   11.66 +	my $err;
   11.67 +	if ( -d "$dir" ) {
   11.68 +		File::Path::remove_tree("$dir", {
   11.69 +			keep_root => 0,
   11.70 +			error     => \$err, 
   11.71 +		});
   11.72 +		my $e = $@;
   11.73 +		if ($e) {
   11.74 +			PDWiX::Directory->throw(
   11.75 +				dir     => $dir,
   11.76 +				message => "Failed to remove directory, critical error:\n$e"
   11.77 +			);	
   11.78 +		}
   11.79 +		if (@{$err}) {
   11.80 +			my $errors = q{};
   11.81 +			for my $diag (@{$err}) {
   11.82 +				my ($file, $message) = %{$diag};
   11.83 +				if ($file eq q{}) {
   11.84 +					$errors .= "General error: $message\n";
   11.85 +				}
   11.86 +				else {
   11.87 +					$errors .= "Problem removing $file: $message\n";
   11.88 +				}
   11.89 +			}
   11.90 +			PDWiX::Directory->throw(
   11.91 +				dir     => $dir,
   11.92 +				message => "Failed to remove directory, errors:\n$errors"
   11.93 +			);	
   11.94 +		}
   11.95 +	}
   11.96 +}
   11.97 +
   11.98  1;
   11.99  
  11.100  __END__
    12.1 --- a/lib/Perl/Dist/WiX/Util/Machine.pm	Fri May 27 07:03:21 2011 -0600
    12.2 +++ b/lib/Perl/Dist/WiX/Util/Machine.pm	Sat Jun 04 21:15:41 2011 -0600
    12.3 @@ -8,7 +8,7 @@
    12.4  
    12.5  =head1 VERSION
    12.6  
    12.7 -This document describes Perl::Dist::WiX::Util::Machine version 1.500.
    12.8 +This document describes Perl::Dist::WiX::Util::Machine version 1.500002.
    12.9  
   12.10  =head1 SYNOPSIS
   12.11  
   12.12 @@ -60,23 +60,25 @@
   12.13  
   12.14  =cut
   12.15  
   12.16 +#<<<
   12.17  use 5.010;
   12.18  use Moose 0.90;
   12.19  use Moose::Util::TypeConstraints;
   12.20 -use MooseX::Types::Moose qw( Str ArrayRef HashRef Bool Int );
   12.21 -use Params::Util qw( _IDENTIFIER _HASH0 _DRIVER _CLASSISA );
   12.22 -use English qw( -no_match_vars );
   12.23 -use File::Copy qw();
   12.24 -use File::Copy::Recursive qw();
   12.25 -use File::Spec::Functions qw( catdir );
   12.26 -use File::Remove qw();
   12.27 -use File::HomeDir qw();
   12.28 -use List::MoreUtils qw( none );
   12.29 -use Perl::Dist::WiX::Exceptions;
   12.30 -use WiX3::Traceable qw();
   12.31 +use MooseX::Types::Moose         qw( Str ArrayRef HashRef Bool Int );
   12.32 +use Params::Util                 qw( _IDENTIFIER _HASH0 _DRIVER _CLASSISA );
   12.33 +use English                      qw( -no_match_vars );
   12.34 +use File::Copy                   qw();
   12.35 +use File::Copy::Recursive        qw();
   12.36 +use File::Path              2.08 qw( remove_tree );
   12.37 +use File::Spec::Functions        qw( catdir );
   12.38 +use File::Remove                 qw();
   12.39 +use File::HomeDir                qw();
   12.40 +use List::MoreUtils              qw( none );
   12.41 +use WiX3::Traceable              qw();
   12.42 +use Perl::Dist::WiX::Exceptions  qw();
   12.43 +#>>>
   12.44  
   12.45 -our $VERSION = '1.500';
   12.46 -$VERSION =~ s/_//ms;
   12.47 +our $VERSION = '1.500002';
   12.48  
   12.49  =head1 INTERFACE
   12.50  
   12.51 @@ -566,7 +568,35 @@
   12.52  		print "\n\n\n\n\n";
   12.53  
   12.54  		# Flush out the image dir for the next run
   12.55 -		File::Remove::remove( \1, $dist->image_dir() );
   12.56 +		my $err;
   12.57 +		my $dir = $dist->image_dir();
   12.58 +		remove_tree("$dir", {
   12.59 +			keep_root => 1,
   12.60 +			error     => \$err, 
   12.61 +		});
   12.62 +		my $e = $@;
   12.63 +		if ($e) {
   12.64 +			PDWiX::Directory->throw(
   12.65 +				dir     => $dir,
   12.66 +				message => "Failed to remove directory, critical error:\n$e"
   12.67 +			);	
   12.68 +		}
   12.69 +		if (@{$err}) {
   12.70 +			my $errors = q{};
   12.71 +			for my $diag (@{$err}) {
   12.72 +				my ($file, $message) = %{$diag};
   12.73 +				if ($file eq q{}) {
   12.74 +					$errors .= "General error: $message\n";
   12.75 +				}
   12.76 +				else {
   12.77 +					$errors .= "Problem removing $file: $message\n";
   12.78 +				}
   12.79 +			}
   12.80 +			PDWiX::Directory->throw(
   12.81 +				dir     => $dir,
   12.82 +				message => "Failed to remove directory, errors:\n$errors"
   12.83 +			);	
   12.84 +		}
   12.85  	} ## end while ( my $dist = $self->next...)
   12.86  	return 1;
   12.87  } ## end sub run