[Bps-public-commit] Shipwright branch, master, updated. ddfa733192e7f692913072c3b9e1bbf65cc7ebd1

? sunnavy sunnavy at bestpractical.com
Fri Jun 4 00:10:53 EDT 2010


The branch, master has been updated
       via  ddfa733192e7f692913072c3b9e1bbf65cc7ebd1 (commit)
       via  cb09da2049a14b336c710882081aa7af8af7bbbc (commit)
       via  44c7539fef6ba70c00cd816563271c9dd0ef7971 (commit)
      from  9a99efa9b6963f3028236515eff353a9c6ecce22 (commit)

Summary of changes:
 Makefile.PL             |    1 +
 bin/shipwright-generate |   83 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100755 bin/shipwright-generate

- Log -----------------------------------------------------------------
commit 44c7539fef6ba70c00cd816563271c9dd0ef7971
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 4 12:06:44 2010 +0800

    add shipwright-generate

diff --git a/bin/shipwright-generate b/bin/shipwright-generate
new file mode 100755
index 0000000..f196ae2
--- /dev/null
+++ b/bin/shipwright-generate
@@ -0,0 +1,78 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Cwd;
+use File::Temp 'tempdir';
+use File::Spec::Functions 'catdir';
+use IPC::Run3;
+use File::Which 'which';
+my $cwd = getcwd;
+
+my $USAGE = <<'END'
+run: shipwright-generate
+
+this script actually does 3 things, i.e.
+`shipwright create`, `shipwright import` and `shipwright-utility --generate-tar-file ...`
+
+If you don't want to keep a repo and just want the tarball, this script is for you!
+
+Arguments are the same as `shipwright import` without --log... and --repository
+
+Examples:
+
+to install Jifty to current perl without all its recommendations:
+    $ shipwright-generate cpan:Jifty --skip-all-recommends | perl - --no-install-base --skip-test
+
+END
+;
+
+if ( !@ARGV || grep { /-?-h(?:elp)?/ } @ARGV ) {
+    print $USAGE;
+    exit 0;
+}
+
+my $tarfile = '-';
+
+my $found_tarfile;
+my @argv;
+for my $arg ( @ARGV ) {
+    if ( $arg =~ /-?-o(?:utput)?/ ) {
+        $found_tarfile = 1;
+        next;
+    }
+    elsif ( $found_tarfile ) {
+        $tarfile = $arg;
+        undef $found_tarfile;
+        next;
+    }
+    else {
+        push @argv, $arg;
+    }
+}
+
+my $parent_dir = tempdir( CLEANUP => 1, TEMPDIR => 1 );
+my $dir = catdir( $parent_dir, 'fs' );
+$ENV{SHIPWRIGHT_REPOSITORY} = "fs:$dir";
+my ( $out, $err );
+
+my $shipwright = which('shipwright')
+  or die "didn't find full path of shipwright cmd";
+run3([$^X, $shipwright, 'create'], undef, \$out, \$err );
+if ( $? ) {
+    print $out;
+    die "failed to create shipwright repo: $err";
+}
+
+run3([$^X, $shipwright, 'import', @argv], undef, \$out, \$err);
+if ( $? ) {
+    print $out;
+    die "failed to import shipwright repo: $err";
+}
+
+chdir $dir;
+$tarfile =~ s/'/\\'/g;
+system("$^X bin/shipwright-utility --generate-tar-file '$tarfile'")
+  && die "failed to generate tar file: $!";
+chdir $cwd;
+

commit cb09da2049a14b336c710882081aa7af8af7bbbc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 4 12:07:16 2010 +0800

    add shipwright-generate to package

diff --git a/Makefile.PL b/Makefile.PL
index 56bdb55..babc325 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -40,6 +40,7 @@ no_index( directory => 't' );
 no_index( directory => 'xt' );
 
 install_script('bin/shipwright');
+install_script('bin/shipwright-generate');
 install_share;
 auto_install;
 

commit ddfa733192e7f692913072c3b9e1bbf65cc7ebd1
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 4 12:11:33 2010 +0800

    more usage

diff --git a/bin/shipwright-generate b/bin/shipwright-generate
index f196ae2..4f3b198 100755
--- a/bin/shipwright-generate
+++ b/bin/shipwright-generate
@@ -17,10 +17,15 @@ this script actually does 3 things, i.e.
 
 If you don't want to keep a repo and just want the tarball, this script is for you!
 
-Arguments are the same as `shipwright import` without --log... and --repository
+Arguments are the same as `shipwright import` without --log... and --repository.
+It also has two extra options: --help(-h) and --output(-o) outputfile.
+-h is to show this usage, -o is to specify the file to write to.
 
 Examples:
 
+to generate an install file for Plack and all its dependencies to /tmp/plack.pl:
+    $ shipwright-generate cpan:Plack -o /tmp/plack.pl
+
 to install Jifty to current perl without all its recommendations:
     $ shipwright-generate cpan:Jifty --skip-all-recommends | perl - --no-install-base --skip-test
 

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



More information about the Bps-public-commit mailing list