[Bps-public-commit] r14168 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Wed Jul 16 14:21:11 EDT 2008
Author: sartak
Date: Wed Jul 16 14:20:59 2008
New Revision: 14168
Added:
Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm
Modified:
Prophet/trunk/ (props changed)
Log:
r64434 at onn: sartak | 2008-07-16 14:20:30 -0400
First stab at the publish command. It currently uses File::Rsync because that was easiest. It vaguely works :)
Added: Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm
==============================================================================
--- (empty file)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Publish.pm Wed Jul 16 14:20:59 2008
@@ -0,0 +1,39 @@
+package Prophet::CLI::Command::Publish;
+use Moose;
+extends 'Prophet::CLI::Command::Export';
+
+use File::Temp 'tempdir';
+use File::Rsync;
+
+before run => sub {
+ my $self = shift;
+ die "Please specify a --to.\n" unless $self->has_arg('to');
+};
+
+before run => sub {
+ my $self = shift;
+ my $dir = tempdir(CLEANUP => 1);
+ $self->set_arg(path => $dir);
+};
+
+after run => sub {
+ my $self = shift;
+ my $from = $self->arg('path');
+ my $to = $self->arg('to');
+
+ my $rsync = File::Rsync->new;
+ $rsync->exec({
+ src => $from,
+ dst => $to,
+ recursive => 1,
+ });
+
+ warn $_ for $rsync->err;
+ print $_ for $rsync->out;
+};
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
More information about the Bps-public-commit
mailing list