Subversion Repositories PEEPS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 - 1
#!/usr/bin/perl
2
 
3
use strict;
4
 
5
use Getopt::Long;
6
 
7
my $everything;
8
my $quiet;
9
 
10
GetOptions ( "all"     => \$everything,
11
             "help"    => \&usage,
12
             "quiet"   => \$quiet,
13
           ) or usage ();
14
 
15
# Source and targets
16
my $svn_repo = "https://svn.gadell.org/svn/PEEPS/trunk/";
17
my %path = (
18
  site => "/var/www/html",
19
  perl => "/usr/local/lib/site_perl",
20
  util => "/root/util"
21
);
22
 
23
# Error checking
24
usage ("No module (or -a) specified.") unless ($everything or scalar @ARGV);
25
usage ("Module and -a specified, unclear what you want to do.") if ($everything and scalar @ARGV);
26
map { usage ("Unknown module: '$_'.") unless defined $path{$_} } @ARGV;
27
 
28
# Do the things.
29
foreach (scalar @ARGV ? @ARGV : keys %path) {
30
  my @command = ("/usr/bin/svn", "export", $svn_repo.$_, $path{$_}, "--force", "--quiet");
31
  pop @command unless $quiet;
32
  print join (" ", @command, "\n") unless $quiet;
33
  system (@command);
34
  print "\n" unless $quiet;
35
}
36
 
37
 
38
 
39
sub usage {
40
  my $problem = shift // "";
41
 
42
  print "$problem\n" unless !$problem;
43
 
44
  print<<usage;
45
 
46
./deploy.pl [-v] [-h] [-a | util | perl | site]
47
 
48
Export latest files from svn.gadell.org.
49
 
50
Optional:
51
 
52
  -q  supress output
53
  -h  This usage output
54
 
55
Required (one of the following):
56
 
57
  -a    Deploy all modules
58
  util  Utility scripts
59
  perl  Perl modules
60
  site  Site files
61
 
62
usage
63
  exit;
64
}