r50842 - in /branches/upstream/libfile-sharedir-install-perl: ./ current/ current/lib/ current/lib/File/ current/lib/File/ShareDir/ current/t/ current/t/module/ current/t/module/deeper/ current/t/share/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Jan 13 04:30:23 UTC 2010
Author: jawnsy-guest
Date: Wed Jan 13 04:30:16 2010
New Revision: 50842
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50842
Log:
[svn-inject] Installing original source of libfile-sharedir-install-perl
Added:
branches/upstream/libfile-sharedir-install-perl/
branches/upstream/libfile-sharedir-install-perl/current/
branches/upstream/libfile-sharedir-install-perl/current/Changes
branches/upstream/libfile-sharedir-install-perl/current/MANIFEST
branches/upstream/libfile-sharedir-install-perl/current/META.yml
branches/upstream/libfile-sharedir-install-perl/current/Makefile.PL
branches/upstream/libfile-sharedir-install-perl/current/README
branches/upstream/libfile-sharedir-install-perl/current/lib/
branches/upstream/libfile-sharedir-install-perl/current/lib/File/
branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/
branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/Install.pm
branches/upstream/libfile-sharedir-install-perl/current/t/
branches/upstream/libfile-sharedir-install-perl/current/t/00_compile.t
branches/upstream/libfile-sharedir-install-perl/current/t/01_pod.t
branches/upstream/libfile-sharedir-install-perl/current/t/02_pod_coverage.t
branches/upstream/libfile-sharedir-install-perl/current/t/10_makefile.t
branches/upstream/libfile-sharedir-install-perl/current/t/module/
branches/upstream/libfile-sharedir-install-perl/current/t/module/again
branches/upstream/libfile-sharedir-install-perl/current/t/module/bonk
branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/
branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/bonk
branches/upstream/libfile-sharedir-install-perl/current/t/share/
branches/upstream/libfile-sharedir-install-perl/current/t/share/honk
Added: branches/upstream/libfile-sharedir-install-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/Changes?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/Changes (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/Changes Wed Jan 13 04:30:16 2010
@@ -1,0 +1,12 @@
+Revision history for Perl extension File::ShareDir::Install.
+
+0.03 Tue Sep 9 2009
+ - Drop PERL_MM_OPT in test so that it passes with local::lib
+ Thank you Peter Makholm
+
+0.02 Thu Jul 2
+ - Renamed to File::ShareDir::Install
+ - Tweak the doco
+
+0.01 Wed Jul 1
+ - Initial release to the CPAN
Added: branches/upstream/libfile-sharedir-install-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/MANIFEST?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/MANIFEST (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/MANIFEST Wed Jan 13 04:30:16 2010
@@ -1,0 +1,14 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+lib/File/ShareDir/Install.pm
+t/module/again
+t/module/deeper/bonk
+t/module/bonk
+t/share/honk
+t/00_compile.t
+t/01_pod.t
+t/02_pod_coverage.t
+t/10_makefile.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libfile-sharedir-install-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/META.yml?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/META.yml (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/META.yml Wed Jan 13 04:30:16 2010
@@ -1,0 +1,24 @@
+--- #YAML:1.0
+name: File-ShareDir-Install
+version: 0.03
+abstract: Install shared files
+author:
+ - Philip Gwyn <gwyn-at-cpan.org>
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ ExtUtils::MakeMaker: 6.11
+ File::Spec: 0
+ IO::Dir: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.50
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Added: branches/upstream/libfile-sharedir-install-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/Makefile.PL?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/Makefile.PL (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/Makefile.PL Wed Jan 13 04:30:16 2010
@@ -1,0 +1,21 @@
+use 5.008;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ NAME => 'File::ShareDir::Install',
+ VERSION_FROM => 'lib/File/ShareDir/Install.pm', # finds $VERSION
+ LICENSE => 'perl',
+ dist=>{COMPRESS=>'gzip -9f', EXT=>'gz'},
+
+ PREREQ_PM => {
+ # Module::Install::Share requires this also...
+ # (known-bad on RHEL 3, with 5.8.0)
+ 'ExtUtils::MakeMaker' => '6.11',
+ 'IO::Dir' => 0,
+ 'File::Spec' => 0,
+ },
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (ABSTRACT_FROM => 'lib/File/ShareDir/Install.pm', # retrieve abstract from module
+ AUTHOR => 'Philip Gwyn <gwyn-at-cpan.org>') : ()),
+);
Added: branches/upstream/libfile-sharedir-install-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/README?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/README (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/README Wed Jan 13 04:30:16 2010
@@ -1,0 +1,27 @@
+File-ShareDir-Install version 0.01
+==================================
+
+File::ShareDir::Install allows you to install read-only data files from a
+distribution. It is a companion module to L<File::ShareDir>, which
+allows you to locate these files after installation.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+COPYRIGHT AND LICENCE
+
+Put the correct copyright and licence information here.
+
+Copyright (C) 2009 by Philip Gwyn
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.8 or,
+at your option, any later version of Perl 5 you may have available.
+
+
Added: branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/Install.pm?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/Install.pm (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/lib/File/ShareDir/Install.pm Wed Jan 13 04:30:16 2010
@@ -1,0 +1,226 @@
+package File::ShareDir::Install;
+
+use 5.008;
+use strict;
+use warnings;
+
+use Carp;
+
+use File::Spec;
+use IO::Dir;
+
+our $VERSION = '0.03';
+
+our @DIRS;
+our %TYPES;
+
+require Exporter;
+
+our @ISA = qw( Exporter);
+our @EXPORT = qw( install_share );
+our @EXPORT_OK = qw( postamble install_share );
+
+#####################################################################
+sub install_share
+{
+ my $dir = @_ ? pop : 'share';
+ my $type = @_ ? shift : 'dist';
+ unless ( defined $type and $type eq 'module' or $type eq 'dist' ) {
+ confess "Illegal or invalid share dir type '$type'";
+ }
+ unless ( defined $dir and -d $dir ) {
+ confess "Illegal or missing directory '$dir'";
+ }
+
+ if( $type eq 'dist' and @_ ) {
+ confess "Too many parameters to share_dir";
+ }
+
+ push @DIRS, $dir;
+ $TYPES{$dir} = [ $type ];
+ if( $type eq 'module' ) {
+ my $module = _CLASS( $_[0] );
+ unless ( defined $module ) {
+ confess "Missing or invalid module name '$_[0]'";
+ }
+ push @{ $TYPES{$dir} }, $module;
+ }
+
+}
+
+#####################################################################
+sub postamble
+{
+ my $self = shift;
+
+ my @ret; # = $self->SUPER::postamble( @_ );
+ foreach my $dir ( @DIRS ) {
+ push @ret, __postamble_share_dir( $self, $dir, @{ $TYPES{ $dir } } );
+ }
+ return join "\n", @ret;
+}
+
+#####################################################################
+sub __postamble_share_dir
+{
+ my( $self, $dir, $type, $mod ) = @_;
+
+ my( $idir );
+ if ( $type eq 'dist' ) {
+ $idir = File::Spec->catdir( '$(INST_LIB)',
+ qw( auto share dist ),
+ '$(DISTNAME)'
+ );
+ } else {
+ my $module = $mod;
+ $module =~ s/::/-/g;
+ $idir = File::Spec->catdir( '$(INST_LIB)',
+ qw( auto share module ),
+ $module
+ );
+ }
+
+ my $files = {};
+ _scan_share_dir( $files, $idir, $dir );
+
+ my $autodir = '$(INST_LIB)';
+ my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']);
+pm_to_blib({\@ARGV}, '$autodir')
+CODE
+
+ my @cmds = $self->split_command( $pm_to_blib, %$files );
+
+ my $r = join '', map { "\t\$(NOECHO) $_\n" } @cmds;
+
+# use Data::Dumper;
+# die Dumper $files;
+ # Set up the install
+ return "config::\n$r";
+}
+
+
+sub _scan_share_dir
+{
+ my( $files, $idir, $dir ) = @_;
+ my $dh = IO::Dir->new( $dir ) or die "Unable to read $dir: $!";
+ my $entry;
+ while( defined( $entry = $dh->read ) ) {
+ next if $entry =~ /^\./ or $entry =~ /(~|,v)$/;
+ my $full = File::Spec->catfile( $dir, $entry );
+ if( -f $full ) {
+ $files->{ $full } = File::Spec->catfile( $idir, $entry );
+ }
+ elsif( -d $full ) {
+ _scan_share_dir( $files, File::Spec->catdir( $idir, $entry ), $full );
+ }
+ }
+}
+
+
+#####################################################################
+# Cloned from Params::Util::_CLASS
+sub _CLASS ($) {
+ (
+ defined $_[0]
+ and
+ ! ref $_[0]
+ and
+ $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
+ ) ? $_[0] : undef;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+File::ShareDir::Install - Install shared files
+
+=head1 SYNOPSIS
+
+ use ExtUtils::MakeMaker;
+ use File::ShareDir::Install;
+
+ install_share 'share';
+ install_share dist => 'dist-share';
+ install_share module => 'My::Module' => 'other-share';
+
+ WriteMakefile( ... ); # As you normaly would
+
+ package MY;
+ use File::ShareDir::Install qw(postamble);
+
+=head1 DESCRIPTION
+
+File::ShareDir::Install allows you to install read-only data files from a
+distribution. It is a companion module to L<File::ShareDir>, which
+allows you to locate these files after installation.
+
+It is a port L<Module::Install::Share> to L<ExtUtils::MakeMaker> with the
+improvement of only installing the files you want; C<.svn> and
+other source-control junk will be ignored.
+
+=head1 EXPORT
+
+=head2 install_share
+
+ install_share $dir;
+ install_share dist => $dir;
+ install_share module => $module, $dir;
+
+Causes all the files in C<$dir> and its sub-directories. to be installed
+into a per-dist or per-module share directory. Must be called before
+L<WriteMakefile>.
+
+The first 2 forms are equivalent.
+
+The files will be installed when you run C<make install>.
+
+To locate the files after installation so they can be used inside your
+module, see L<File::ShareDir>.
+
+ my $dir = File::ShareDir::module_dir( $module );
+
+Note that if you make multiple calls to C<install_share> on different
+directories that contain the same filenames, the last of these calls takes
+precedence. In other words, if you do:
+
+ install_share 'share1';
+ install_share 'share2';
+
+And both C<share1> and C<share2> contain a fill called C<info>, the file
+C<share2/info> will be installed into your C<dist_dir()>.
+
+=head2 postamble
+
+Exported into the MY package. Only documented here if you need to write your
+own postable.
+
+ package MY;
+ use File::ShareDir::Install;
+
+ sub postamble {
+ my $self = shift;
+ my @ret = File::ShareDir::Install::postamble( $self );
+ # ... add more things to @ret;
+ return join "\n", @ret;
+ }
+
+=head1 SEE ALSO
+
+L<File::ShareDir>, L<Module::Install>.
+
+=head1 AUTHOR
+
+Philip Gwyn, E<lt>gwyn-AT-cpan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2009 by Philip Gwyn
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.8 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut
Added: branches/upstream/libfile-sharedir-install-perl/current/t/00_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/00_compile.t?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/00_compile.t (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/00_compile.t Wed Jan 13 04:30:16 2010
@@ -1,0 +1,8 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+BEGIN { use_ok('File::ShareDir::Install') };
+
Added: branches/upstream/libfile-sharedir-install-perl/current/t/01_pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/01_pod.t?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/01_pod.t (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/01_pod.t Wed Jan 13 04:30:16 2010
@@ -1,0 +1,10 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
Added: branches/upstream/libfile-sharedir-install-perl/current/t/02_pod_coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/02_pod_coverage.t?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/02_pod_coverage.t (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/02_pod_coverage.t Wed Jan 13 04:30:16 2010
@@ -1,0 +1,19 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+
+plan tests => 1;
+pod_coverage_ok(
+ "File::ShareDir::Install",
+ { also_private => [
+# qr/^(OH|SE)_.+$/,
+# qr/^(handler_for|instantiate|set_objectre)$/
+ ],
+ },
+ "File::ShareDir::Install, ignoring private functions",
+);
Added: branches/upstream/libfile-sharedir-install-perl/current/t/10_makefile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/10_makefile.t?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/10_makefile.t (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/10_makefile.t Wed Jan 13 04:30:16 2010
@@ -1,0 +1,100 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Config;
+
+use File::Path qw( rmtree );
+use Test::More ( tests => 15 );
+
+use ExtUtils::MakeMaker;
+
+my $FILE = 'test-Makefile';
+rmtree( [ qw( tlib troot ) ], 0, 0 );
+END {
+ $FILE and -f $FILE and unlink $FILE;
+ rmtree( [ qw( tlib troot ) ], 0, 0 );
+}
+
+use File::ShareDir::Install;
+
+install_share 't/share';
+install_share module => 'My::Test' => 't/module';
+
+
+delete $ENV{PERL_MM_OPT}; # local::lib + PREFIX below will FAIL
+# XXX maybe we should just remove INSTALL_BASE=[^ ]+ from PERL_MM_OPT?
+
+WriteMakefile(
+ NAME => 'File::ShareDir::Install',
+ VERSION_FROM => 'lib/File/ShareDir/Install.pm',
+ INST_LIB => 'tlib/lib',
+ PREFIX => 'troot',
+ MAKEFILE => $FILE,
+ PREREQ_PM => {},
+ ($] >= 5.005 ?
+ (ABSTRACT_FROM => 'lib/File/ShareDir/Install.pm',
+ AUTHOR => 'Philip Gwyn <fil at localdomain>') : ()),
+);
+
+sub slurp
+{
+ local @ARGV = @_;
+ local $/;
+ local $.;
+ <>;
+};
+
+
+#####
+ok( -f $FILE, "Created $FILE" );
+my $content = slurp $FILE;
+ok( $content =~ m(t.share.honk.+share.dist...DISTNAME..honk), "Shared by dist" );
+ok( $content =~ m(t.module.bonk.+share.module.My-Test.bonk), "Shared by module" );
+ok( $content =~ m(t.module.again.+share.module.My-Test.again), "Shared by module again" );
+ok( $content =~ m(t.module.deeper.bonk.+share.module.My-Test.deeper.bonk), "Shared by module in subdirectory" );
+
+#####
+mysystem( $Config{make}, '-f', $FILE );
+my $TOP = "tlib/lib/auto/share";
+ok( -f "$TOP/dist/File-ShareDir-Install/honk", "Copied to blib for dist" );
+ok( -f "$TOP/module/My-Test/bonk", "Copied to blib for module" );
+ok( -f "$TOP/module/My-Test/again", "Copied to blib for module again" );
+ok( -f "$TOP/module/My-Test/deeper/bonk", "Copied to blib for module, in subdir" );
+
+my $c = slurp "$TOP/module/My-Test/bonk";
+is( $c, "bonk\n", "Same names" );
+$c = slurp "$TOP/module/My-Test/deeper/bonk";
+is( $c, "deeper\n", " ... not mixed up" );
+
+#####
+mysystem( $Config{make}, '-f', $FILE, 'install' );
+unless( $content =~ m(INSTALLSITELIB = (.+)) ) {
+ SKIP: {
+ skip "Can't find INSTALLSITELIB in test-Makefile", 4;
+ }
+}
+else {
+ $TOP = "$1/auto/share";
+ $TOP =~ s/\$\(SITEPREFIX\)/troot/;
+ ok( -f "$TOP/dist/File-ShareDir-Install/honk", "Copied to blib for dist" );
+ ok( -f "$TOP/module/My-Test/bonk", "Copied to blib for module" );
+ ok( -f "$TOP/module/My-Test/again", "Copied to blib for module again" );
+ ok( -f "$TOP/module/My-Test/deeper/bonk", "Copied to blib for module, in subdir" );
+}
+
+#####################################
+sub mysystem
+{
+ my $cmd = join ' ', @_;
+ my $ret = qx($cmd 2>&1);
+ return unless $?;
+ die $ret;
+}
+
+###########################################################################
+package MY;
+
+use File::ShareDir::Install qw(postamble);
+
Added: branches/upstream/libfile-sharedir-install-perl/current/t/module/again
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/module/again?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/module/again (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/module/again Wed Jan 13 04:30:16 2010
@@ -1,0 +1,1 @@
+again
Added: branches/upstream/libfile-sharedir-install-perl/current/t/module/bonk
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/module/bonk?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/module/bonk (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/module/bonk Wed Jan 13 04:30:16 2010
@@ -1,0 +1,1 @@
+bonk
Added: branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/bonk
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/bonk?rev=50842&op=file
==============================================================================
--- branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/bonk (added)
+++ branches/upstream/libfile-sharedir-install-perl/current/t/module/deeper/bonk Wed Jan 13 04:30:16 2010
@@ -1,0 +1,1 @@
+deeper
Added: branches/upstream/libfile-sharedir-install-perl/current/t/share/honk
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libfile-sharedir-install-perl/current/t/share/honk?rev=50842&op=file
==============================================================================
(empty)
More information about the Pkg-perl-cvs-commits
mailing list