[Bps-public-commit] SD - A distributed issue tracker branch, master, updated. 722e63fa42896925dfe5b3dfc8e5f28d1a9dc06c

spang at bestpractical.com spang at bestpractical.com
Mon Feb 16 15:04:49 EST 2009


The branch, master has been updated
       via  722e63fa42896925dfe5b3dfc8e5f28d1a9dc06c (commit)
      from  bdb4f9b9a55fd0d293aadf85b13f7408215c270d (commit)

Summary of changes:
 Makefile.PL                 |    3 +-
 inc/Module/Install/Share.pm |  125 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 127 insertions(+), 1 deletions(-)
 create mode 100644 inc/Module/Install/Share.pm

- Log -----------------------------------------------------------------
commit 722e63fa42896925dfe5b3dfc8e5f28d1a9dc06c
Author: Christine Spang <spang at bestpractical.com>
Date:   Mon Feb 16 15:04:39 2009 -0500

    actually install share/

diff --git a/Makefile.PL b/Makefile.PL
index 4d033bd..8785915 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,5 +1,5 @@
 use inc::Module::Install;
-name('SD');
+name('App-SD');
 author('Jesse Vincent and Chia-Liang Kao');
 copyright('2008 Best Practical Solutions, LLC');
 license('MIT');
@@ -27,6 +27,7 @@ feature    'Hiveminder sync' =>
 
 install_script('bin/sd');
 install_script('bin/git-sd');
+install_share('share');
 
 # Include subdirectory tests too.
 tests("t/*.t t/*/*.t");
diff --git a/inc/Module/Install/Share.pm b/inc/Module/Install/Share.pm
new file mode 100644
index 0000000..b32ad2c
--- /dev/null
+++ b/inc/Module/Install/Share.pm
@@ -0,0 +1,125 @@
+package Module::Install::Share;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+	$VERSION = '0.79';
+	$ISCORE  = 1;
+	@ISA     = qw{Module::Install::Base};
+}
+
+sub install_share {
+	my $self = shift;
+	my $dir  = @_ ? pop   : 'share';
+	my $type = @_ ? shift : 'dist';
+	unless ( defined $type and $type eq 'module' or $type eq 'dist' ) {
+		die "Illegal or invalid share dir type '$type'";
+	}
+	unless ( defined $dir and -d $dir ) {
+		die "Illegal or missing directory install_share param";
+	}
+
+	# Split by type
+	my $S = ($^O eq 'MSWin32') ? "\\" : "\/";
+	if ( $type eq 'dist' ) {
+		die "Too many parameters to install_share" if @_;
+
+		# Set up the install
+		$self->postamble(<<"END_MAKEFILE");
+config ::
+\t\$(NOECHO) \$(MOD_INSTALL) \\
+\t\t"$dir" \$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)
+
+END_MAKEFILE
+	} else {
+		my $module = Module::Install::_CLASS($_[0]);
+		unless ( defined $module ) {
+			die "Missing or invalid module name '$_[0]'";
+		}
+		$module =~ s/::/-/g;
+
+		# Set up the install
+		$self->postamble(<<"END_MAKEFILE");
+config ::
+\t\$(NOECHO) \$(MOD_INSTALL) \\
+\t\t"$dir" \$(INST_LIB)${S}auto${S}share${S}module${S}$module
+
+END_MAKEFILE
+	}
+
+	# The above appears to behave incorrectly when used with old versions
+	# of ExtUtils::Install (known-bad on RHEL 3, with 5.8.0)
+	# So when we need to install a share directory, make sure we add a
+	# dependency on a moderately new version of ExtUtils::MakeMaker.
+	$self->build_requires( 'ExtUtils::MakeMaker' => '6.11' );
+
+	# 99% of the time we don't want to index a shared dir
+	$self->no_index( directory => $dir );
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Module::Install::Share - Install non-code files for use during run-time
+
+=head1 SYNOPSIS
+
+    # Put everything inside ./share/ into the distribution 'auto' path
+    install_share 'share';
+
+    # Same thing as above using the default directory name
+    install_share;
+
+=head1 DESCRIPTION
+
+As well as Perl modules and Perl binary applications, some distributions
+need to install read-only data files to a location on the file system
+for use at run-time.
+
+XML Schemas, L<YAML> data files, and L<SQLite> databases are examples of
+the sort of things distributions might typically need to have available
+after installation.
+
+C<Module::Install::Share> is a L<Module::Install> extension that provides
+commands to allow these files to be installed to the applicable location
+on disk.
+
+To locate the files after installation so they can be used inside your
+module, see this extension's companion module L<File::ShareDir>.
+
+=head1 TO DO
+
+Currently C<install_share> installs not only the files you want, but
+if called by the author will also copy F<.svn> and other source-control
+directories, and other junk.
+
+Enhance this to copy only files under F<share> that are in the
+F<MANIFEST>, or possibly those not in F<MANIFEST.SKIP>.
+
+=head1 AUTHORS
+
+Audrey Tang E<lt>autrijus at autrijus.orgE<gt>
+
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+L<Module::Install>, L<File::ShareDir>
+
+=head1 COPYRIGHT
+
+Copyright 2006 Audrey Tang, Adam Kennedy.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list