[Bps-public-commit] r20239 - in RT-Authen-Bitcard: inc/Module inc/Module/Install

ruz at bestpractical.com ruz at bestpractical.com
Mon Dec 28 16:53:41 EST 2009


Author: ruz
Date: Mon Dec 28 16:53:41 2009
New Revision: 20239

Modified:
   RT-Authen-Bitcard/META.yml
   RT-Authen-Bitcard/inc/Module/Install.pm
   RT-Authen-Bitcard/inc/Module/Install/AutoInstall.pm
   RT-Authen-Bitcard/inc/Module/Install/Base.pm
   RT-Authen-Bitcard/inc/Module/Install/Can.pm
   RT-Authen-Bitcard/inc/Module/Install/Fetch.pm
   RT-Authen-Bitcard/inc/Module/Install/Include.pm
   RT-Authen-Bitcard/inc/Module/Install/Makefile.pm
   RT-Authen-Bitcard/inc/Module/Install/Metadata.pm
   RT-Authen-Bitcard/inc/Module/Install/RTx.pm
   RT-Authen-Bitcard/inc/Module/Install/Win32.pm
   RT-Authen-Bitcard/inc/Module/Install/WriteAll.pm

Log:
update M::I

Modified: RT-Authen-Bitcard/META.yml
==============================================================================
--- RT-Authen-Bitcard/META.yml	(original)
+++ RT-Authen-Bitcard/META.yml	Mon Dec 28 16:53:41 2009
@@ -7,7 +7,7 @@
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 0.89'
+generated_by: 'Module::Install version 0.91'
 license: GPL2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html

Modified: RT-Authen-Bitcard/inc/Module/Install.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install.pm	Mon Dec 28 16:53:41 2009
@@ -28,7 +28,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '0.89';
+	$VERSION = '0.91';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;

Modified: RT-Authen-Bitcard/inc/Module/Install/AutoInstall.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/AutoInstall.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/AutoInstall.pm	Mon Dec 28 16:53:41 2009
@@ -2,13 +2,13 @@
 package Module::Install::AutoInstall;
 
 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.89';
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
 }
 
 sub AutoInstall { $_[0] }

Modified: RT-Authen-Bitcard/inc/Module/Install/Base.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Base.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Base.pm	Mon Dec 28 16:53:41 2009
@@ -4,7 +4,7 @@
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '0.89';
+	$VERSION = '0.91';
 }
 
 # Suspend handler for "redefined" warnings
@@ -13,42 +13,34 @@
 	$SIG{__WARN__} = sub { $w };
 }
 
-### This is the ONLY module that shouldn't have strict on
-# use strict;
-
-#line 45
+#line 42
 
 sub new {
-	my ($class, %args) = @_;
-
-	foreach my $method ( qw(call load) ) {
-		next if defined &{"$class\::$method"};
-		*{"$class\::$method"} = sub {
-			shift()->_top->$method(@_);
-		};
+	my $class = shift;
+	unless ( defined &{"${class}::call"} ) {
+		*{"${class}::call"} = sub { shift->_top->call(@_) };
 	}
-
-	bless( \%args, $class );
+	unless ( defined &{"${class}::load"} ) {
+		*{"${class}::load"} = sub { shift->_top->load(@_) };
+	}
+	bless { @_ }, $class;
 }
 
-#line 66
+#line 61
 
 sub AUTOLOAD {
-	my $self = shift;
 	local $@;
-	my $autoload = eval {
-		$self->_top->autoload
-	} or return;
-	goto &$autoload;
+	my $func = eval { shift->_top->autoload } or return;
+	goto &$func;
 }
 
-#line 83
+#line 75
 
 sub _top {
 	$_[0]->{_top};
 }
 
-#line 98
+#line 90
 
 sub admin {
 	$_[0]->_top->{admin}
@@ -56,7 +48,7 @@
 	Module::Install::Base::FakeAdmin->new;
 }
 
-#line 114
+#line 106
 
 sub is_admin {
 	$_[0]->admin->VERSION;
@@ -83,4 +75,4 @@
 
 1;
 
-#line 162
+#line 154

Modified: RT-Authen-Bitcard/inc/Module/Install/Can.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Can.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Can.pm	Mon Dec 28 16:53:41 2009
@@ -2,16 +2,16 @@
 package Module::Install::Can;
 
 use strict;
-use Module::Install::Base;
-use Config              ();
-use File::Spec          ();
-use ExtUtils::MakeMaker ();
+use Config                ();
+use File::Spec            ();
+use ExtUtils::MakeMaker   ();
+use Module::Install::Base ();
 
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.89';
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
 }
 
 # check if we can load some module

Modified: RT-Authen-Bitcard/inc/Module/Install/Fetch.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Fetch.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Fetch.pm	Mon Dec 28 16:53:41 2009
@@ -2,13 +2,13 @@
 package Module::Install::Fetch;
 
 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.89';
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
 }
 
 sub get_file {

Modified: RT-Authen-Bitcard/inc/Module/Install/Include.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Include.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Include.pm	Mon Dec 28 16:53:41 2009
@@ -2,13 +2,13 @@
 package Module::Install::Include;
 
 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.89';
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
 }
 
 sub include {

Modified: RT-Authen-Bitcard/inc/Module/Install/Makefile.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Makefile.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Makefile.pm	Mon Dec 28 16:53:41 2009
@@ -2,14 +2,14 @@
 package Module::Install::Makefile;
 
 use strict 'vars';
-use Module::Install::Base;
-use ExtUtils::MakeMaker ();
+use ExtUtils::MakeMaker   ();
+use Module::Install::Base ();
 
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.89';
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
-	@ISA     = qw{Module::Install::Base};
 }
 
 sub Makefile { $_[0] }

Modified: RT-Authen-Bitcard/inc/Module/Install/Metadata.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Metadata.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Metadata.pm	Mon Dec 28 16:53:41 2009
@@ -2,18 +2,17 @@
 package Module::Install::Metadata;
 
 use strict 'vars';
-use Module::Install::Base;
+use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.89';
-	@ISA     = qw{Module::Install::Base};
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
 
 my @boolean_keys = qw{
 	sign
-	mymeta
 };
 
 my @scalar_keys = qw{
@@ -506,6 +505,17 @@
 	}
 }
 
+sub test_requires_from {
+	my $self     = shift;
+	my $content  = Module::Install::_readperl($_[0]);
+	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+	while ( @requires ) {
+		my $module  = shift @requires;
+		my $version = shift @requires;
+		$self->test_requires( $module => $version );
+	}
+}
+
 # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
 # numbers (eg, 5.006001 or 5.008009).
 # Also, convert double-part versions (eg, 5.8)
@@ -516,7 +526,8 @@
 	$v =~ s/(\.\d\d\d)000$/$1/;
 	$v =~ s/_.+$//;
 	if ( ref($v) ) {
-		$v = $v + 0; # Numify
+		# Numify
+		$v = $v + 0;
 	}
 	return $v;
 }
@@ -526,23 +537,58 @@
 
 
 ######################################################################
-# MYMETA.yml Support
+# MYMETA Support
 
 sub WriteMyMeta {
 	die "WriteMyMeta has been deprecated";
 }
 
-sub write_mymeta {
+sub write_mymeta_yaml {
 	my $self = shift;
 
-	# If there's no existing META.yml there is nothing we can do
-	return unless -f 'META.yml';
-
 	# We need YAML::Tiny to write the MYMETA.yml file
 	unless ( eval { require YAML::Tiny; 1; } ) {
 		return 1;
 	}
 
+	# Generate the data
+	my $meta = $self->_write_mymeta_data or return 1;
+
+	# Save as the MYMETA.yml file
+	print "Writing MYMETA.yml\n";
+	YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+}
+
+sub write_mymeta_json {
+	my $self = shift;
+
+	# We need JSON to write the MYMETA.json file
+	unless ( eval { require JSON; 1; } ) {
+		return 1;
+	}
+
+	# Generate the data
+	my $meta = $self->_write_mymeta_data or return 1;
+
+	# Save as the MYMETA.yml file
+	print "Writing MYMETA.json\n";
+	Module::Install::_write(
+		'MYMETA.json',
+		JSON->new->pretty(1)->canonical->encode($meta),
+	);
+}
+
+sub _write_mymeta_data {
+	my $self = shift;
+
+	# If there's no existing META.yml there is nothing we can do
+	return undef unless -f 'META.yml';
+
+	# We need Parse::CPAN::Meta to load the file
+	unless ( eval { require Parse::CPAN::Meta; 1; } ) {
+		return undef;
+	}
+
 	# Merge the perl version into the dependencies
 	my $val  = $self->Meta->{values};
 	my $perl = delete $val->{perl_version};
@@ -558,7 +604,7 @@
 	}
 
 	# Load the advisory META.yml file
-	my @yaml = YAML::Tiny::LoadFile('META.yml');
+	my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
 	my $meta = $yaml[0];
 
 	# Overwrite the non-configure dependency hashs
@@ -572,9 +618,7 @@
 		$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
 	}
 
-	# Save as the MYMETA.yml file
-	print "Writing MYMETA.yml\n";
-	YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+	return $meta;
 }
 
 1;

Modified: RT-Authen-Bitcard/inc/Module/Install/RTx.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/RTx.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/RTx.pm	Mon Dec 28 16:53:41 2009
@@ -8,7 +8,7 @@
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.24';
+our $VERSION = '0.25';
 
 use FindBin;
 use File::Glob     ();
@@ -50,7 +50,8 @@
         until ( eval { require RT; $RT::LocalPath } ) {
             warn
                 "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n";
-            $_ = $self->prompt("Path to your RT.pm:") or exit;
+            $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
+            $_ =~ s/\/RT\.pm$//;
             push @INC, $_, "$_/rt3/lib", "$_/lib/rt3", "$_/lib";
         }
     }
@@ -188,4 +189,4 @@
 
 __END__
 
-#line 302
+#line 303

Modified: RT-Authen-Bitcard/inc/Module/Install/Win32.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/Win32.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/Win32.pm	Mon Dec 28 16:53:41 2009
@@ -2,12 +2,12 @@
 package Module::Install::Win32;
 
 use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.89';
-	@ISA     = qw{Module::Install::Base};
+	$VERSION = '0.91';
+	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
 

Modified: RT-Authen-Bitcard/inc/Module/Install/WriteAll.pm
==============================================================================
--- RT-Authen-Bitcard/inc/Module/Install/WriteAll.pm	(original)
+++ RT-Authen-Bitcard/inc/Module/Install/WriteAll.pm	Mon Dec 28 16:53:41 2009
@@ -2,11 +2,11 @@
 package Module::Install::WriteAll;
 
 use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.89';
+	$VERSION = '0.91';;
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }
@@ -41,8 +41,18 @@
 
 	# The Makefile write process adds a couple of dependencies,
 	# so write the META.yml files after the Makefile.
-	$self->Meta->write        if $args{meta};
-	$self->Meta->write_mymeta if $self->mymeta;
+	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;
 }



More information about the Bps-public-commit mailing list