Subversion Repositories PEEPS

Rev

Blame | Last modification | View Log | RSS feed

#!/usr/bin/perl

use strict;

use Getopt::Long;

my $everything;
my $quiet;

GetOptions ( "all"     => \$everything,
             "help"    => \&usage,
             "quiet"   => \$quiet,
           ) or usage ();

# Source and targets
my $svn_repo = "https://svn.gadell.org/svn/PEEPS/trunk/";
my %path = (
  site => "/var/www/html",
  perl => "/usr/local/lib/site_perl",
  util => "/root/util"
);

# Error checking
usage ("No module (or -a) specified.") unless ($everything or scalar @ARGV);
usage ("Module and -a specified, unclear what you want to do.") if ($everything and scalar @ARGV);
map { usage ("Unknown module: '$_'.") unless defined $path{$_} } @ARGV;

# Do the things.
foreach (scalar @ARGV ? @ARGV : keys %path) {
  my @command = ("/usr/bin/svn", "export", $svn_repo.$_, $path{$_}, "--force", "--quiet");
  pop @command unless $quiet;
  print join (" ", @command, "\n") unless $quiet;
  system (@command);
  print "\n" unless $quiet;
}



sub usage {
  my $problem = shift // "";
  
  print "$problem\n" unless !$problem;
  
  print<<usage;
  
./deploy.pl [-v] [-h] [-a | util | perl | site]

Export latest files from svn.gadell.org.

Optional:

  -q  supress output
  -h  This usage output

Required (one of the following):

  -a    Deploy all modules
  util  Utility scripts
  perl  Perl modules
  site  Site files

usage
  exit;
}