[Bps-public-commit] plient branch, master, updated. 08a90a84371adc9f5241200803b17c6e69e5e706

? sunnavy sunnavy at bestpractical.com
Tue Apr 27 15:19:39 EDT 2010


The branch, master has been updated
       via  08a90a84371adc9f5241200803b17c6e69e5e706 (commit)
      from  b93ab90f170f927ea090a31781832e2f3f8c8fed (commit)

Summary of changes:
 bin/plient-make-bundle |   54 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100755 bin/plient-make-bundle

- Log -----------------------------------------------------------------
commit 08a90a84371adc9f5241200803b17c6e69e5e706
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 28 03:19:40 2010 +0800

    add plient-make-bundle

diff --git a/bin/plient-make-bundle b/bin/plient-make-bundle
new file mode 100755
index 0000000..ed726af
--- /dev/null
+++ b/bin/plient-make-bundle
@@ -0,0 +1,54 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Getopt::Long;
+use File::Find;
+use Plient;
+use Plient::Util 'which';
+
+my %args;
+GetOptions( \%args, 'help|h', ) or die 'unknown option';
+
+my $USAGE =<<EOF;
+USAGE: plient-make-bundle FILE
+EXAMPLES:
+    plient-make-bundle /tmp/plient-bundle.pl
+EOF
+
+if ( $args{help} || !$ARGV[0] ) {
+    print $USAGE;
+    exit;
+}
+
+open my $fh, '>', $ARGV[0] or die $!;
+print $fh '#! /usr/bin/env perl', "\n";
+print $fh '$ENV{PLIENT_BUNDLE_MODE} = 1;', "\n";
+
+my $plient_dir = $INC{'Plient.pm'};
+$plient_dir =~ s/\.pm$//;
+
+find(
+    sub {
+        return unless -f && /\.pm/;
+        return if /Test\.pm/;
+        append_files( $fh, $_ );
+    },
+    $INC{'Plient.pm'},
+    $plient_dir,
+);
+
+append_files( $fh, which('plient') );
+
+sub append_files {
+    my $to = shift;
+    for my $file (@_) {
+        open my $fh, '<', $file or die $!;
+        print $to "{\n";
+        for ( <$fh> ) {
+            last if /^__END__/;
+            print $to $_;
+        };
+        print $to "}\n\n";
+    }
+}

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



More information about the Bps-public-commit mailing list