[Bps-public-commit] r13622 - in Shipwright/trunk: lib/Shipwright/Script
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Jun 26 18:21:31 EDT 2008
Author: sunnavy
Date: Thu Jun 26 18:21:30 2008
New Revision: 13622
Added:
Shipwright/trunk/lib/Shipwright/Script/Relocate.pm
Modified:
Shipwright/trunk/ (props changed)
Log:
r13849 at sunnavys-mb: sunnavy | 2008-06-27 05:39:17 +0800
added relocate cmd
Added: Shipwright/trunk/lib/Shipwright/Script/Relocate.pm
==============================================================================
--- (empty file)
+++ Shipwright/trunk/lib/Shipwright/Script/Relocate.pm Thu Jun 26 18:21:30 2008
@@ -0,0 +1,58 @@
+package Shipwright::Script::Relocate;
+
+use strict;
+use warnings;
+use Carp;
+
+use base qw/App::CLI::Command Shipwright::Script/;
+
+use Shipwright;
+
+sub run {
+ my $self = shift;
+ my ( $name, $new_source ) = @_;
+
+ die 'need name arg' unless $name;
+ die 'need source arg' unless $new_source;
+
+ my $shipwright = Shipwright->new(
+ repository => $self->repository,
+ source => $new_source,
+ );
+
+ my $source = $shipwright->backend->source;
+ if ( exists $source->{$name} ) {
+ if ( $source->{$name} eq $new_source ) {
+ print "the new source is the same as old source, won't update\n";
+ }
+ else {
+ $source->{$name} = $new_source;
+ $shipwright->backend->source($source);
+ print "relocated $name to $new_source with success\n";
+ }
+ }
+ else {
+ print "haven't found $name in source.yml, won't relocate\n";
+ }
+
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Shipwright::Script::Relocate - Relocate source of a dist(not cpan)
+
+=head1 SYNOPSIS
+
+ relocate NAME SOURCE
+
+=head1 OPTIONS
+ -r [--repository] REPOSITORY : specify the repository of our project
+ -l [--log-level] LOGLEVEL : specify the log level
+ --log-file FILENAME : specify the log file
+ (info, debug, warn, error, or fatal)
+ NAME : sepecify the dist name
+ SOURCE : specify the new source
More information about the Bps-public-commit
mailing list