X-Git-Url: http://erislabs.net/gitweb/?p=liburi-template-perl.git;a=blobdiff_plain;f=inc%2FModule%2FInstall%2FWriteAll.pm;h=85d8018c5c9c4f27c6cce49223aa0aefe6369340;hp=e1db381ce217f0ff8032ce8e9179297ab6d71624;hb=409df7817b5227c763dd2fab0d583b6d1a9656e4;hpb=e0de6ab08282e52476e36abb99a35be9eff9ca8e diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm index e1db381..85d8018 100644 --- a/inc/Module/Install/WriteAll.pm +++ b/inc/Module/Install/WriteAll.pm @@ -2,42 +2,62 @@ package Module::Install::WriteAll; use strict; -use Module::Install::Base; +use Module::Install::Base (); -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '1.06'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + # XXX: This still may be a bit over-defensive... + unless ($self->makemaker(6.25)) { + $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; + } + } + + # Until ExtUtils::MakeMaker support MYMETA.yml, make sure + # we clean it up properly ourself. + $self->realclean_files('MYMETA.yml'); + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } + + # The Makefile write process adds a couple of dependencies, + # so write the META.yml files after the Makefile. + if ( $args{meta} ) { + $self->Meta->write; + } + + # Experimental support for MYMETA + if ( $ENV{X_MYMETA} ) { + if ( $ENV{X_MYMETA} eq 'JSON' ) { + $self->Meta->write_mymeta_json; + } else { + $self->Meta->write_mymeta_yaml; + } + } + + return 1; } 1;