Author: ericwilhelm
Date: Mon Sep 29 01:51:31 2008
New Revision: 11902
Added:
Module-Build/trunk/scripts/bundle.pl (contents, props changed)
Modified:
Module-Build/trunk/inc/latest.pm
Log:
scripts/bundle.pl - a first take -- basically to document bundling
inc/latest.pm - we need to leave the dir in @INC for ./Build time
Modified: Module-Build/trunk/inc/latest.pm
==============================================================================
--- Module-Build/trunk/inc/latest.pm (original)
+++ Module-Build/trunk/inc/latest.pm Mon Sep 29 01:51:31 2008
@@ -23,7 +23,7 @@
my $from_inc = $pack->_search_INC($file);
unless ($from_inc) {
# Only bundled is available
- local @INC = ($bundled_dir, @INC);
+ unshift(@INC, $bundled_dir);
return $pack->_load($mod, @args);
}
@@ -33,7 +33,7 @@
}
# Load the bundled copy
- local @INC = ($bundled_dir, @INC);
+ unshift(@INC, $bundled_dir);
return $pack->_load($mod, @args);
}
Added: Module-Build/trunk/scripts/bundle.pl
==============================================================================
--- (empty file)
+++ Module-Build/trunk/scripts/bundle.pl Mon Sep 29 01:51:31 2008
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+# this is just a first crack and it uses File::Fu because I'm lazy.
+
+=head1 using
+
+This installs from a fresh Module::Build to your inc/inc_Module-Build
+directory. Use it from within your dist:
+
+ perl /path/to/Module-Build/scripts/bundle.pl
+
+You still need to manually add the following to your Build.PL
+
+ use lib 'inc';
+ use latest 'Module::Build';
+
+You also need to regen your manifest.
+
+ perl Build.PL
+ ./Build distmeta; >MANIFEST; ./Build manifest; svn diff MANIFEST
+
+=cut
+
+use warnings;
+use strict;
+
+use File::Fu;
+use File::Copy ();
+
+my $inc_dir = shift(@ARGV);
+$inc_dir = File::Fu->dir($inc_dir || 'inc/inc_Module-Build');
+$inc_dir->create unless($inc_dir->e);
+$inc_dir = $inc_dir->absolutely;
+
+
+my $mb_dir = File::Fu->program_dir->dirname;
+
+$mb_dir->chdir_for(sub {
+ my $temp = File::Fu->temp_dir('mb_bundle');
+ local @INC = @INC;
+ unshift(@INC, 'lib', 'inc');
+ require Module::Build;
+ my $builder = Module::Build->new_from_context;
+ $builder->dispatch(install =>
+ install_base => $temp,
+ install_path => {lib => $inc_dir},
+ );
+});
+
+my $latest = $mb_dir/'inc'+'latest.pm';
+File::Copy::copy($latest, 'inc');
+
+# vim:ts=2:sw=2:et:sta