[5129] | 1 | #!/usr/bin/perl |
---|
| 2 | # ------------------------------------------------------------------------------ |
---|
| 3 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 4 | # |
---|
| 5 | # This file is part of FCM, tools for managing and building source code. |
---|
| 6 | # |
---|
| 7 | # FCM is free software: you can redistribute it and/or modify |
---|
| 8 | # it under the terms of the GNU General Public License as published by |
---|
| 9 | # the Free Software Foundation, either version 3 of the License, or |
---|
| 10 | # (at your option) any later version. |
---|
| 11 | # |
---|
| 12 | # FCM is distributed in the hope that it will be useful, |
---|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | # GNU General Public License for more details. |
---|
| 16 | # |
---|
| 17 | # You should have received a copy of the GNU General Public License |
---|
| 18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | # ------------------------------------------------------------------------------ |
---|
| 20 | |
---|
| 21 | use strict; |
---|
| 22 | use warnings; |
---|
| 23 | |
---|
| 24 | use FindBin; |
---|
| 25 | use lib "$FindBin::Bin/../lib"; |
---|
| 26 | use FCM::Admin::System qw{add_svn_repository add_trac_environment}; |
---|
| 27 | use FCM::Admin::Util qw{option2config}; |
---|
| 28 | use Getopt::Long qw{GetOptions}; |
---|
| 29 | use Pod::Usage qw{pod2usage}; |
---|
| 30 | |
---|
| 31 | main(); |
---|
| 32 | |
---|
| 33 | sub main { |
---|
| 34 | my %option; |
---|
| 35 | my $result = GetOptions( |
---|
| 36 | \%option, |
---|
| 37 | q{help|usage|h}, |
---|
| 38 | q{svn-live-dir=s}, |
---|
| 39 | q{svn-project-suffix=s}, |
---|
| 40 | q{trac-host-id=s}, |
---|
| 41 | q{trac-live-dir=s}, |
---|
| 42 | ); |
---|
| 43 | if (!$result) { |
---|
| 44 | pod2usage(1); |
---|
| 45 | } |
---|
| 46 | if (exists($option{help})) { |
---|
| 47 | pod2usage(q{-verbose} => 1); |
---|
| 48 | } |
---|
| 49 | option2config(\%option); |
---|
| 50 | if (@ARGV != 1) { |
---|
| 51 | my $message = sprintf( |
---|
| 52 | qq{Expected exactly 1 argument, %d given.}, scalar(@ARGV), |
---|
| 53 | ); |
---|
| 54 | pod2usage({q{-exitval} => 1, q{-message} => $message}); |
---|
| 55 | } |
---|
| 56 | my ($project_name) = @ARGV; |
---|
| 57 | add_svn_repository($project_name); |
---|
| 58 | add_trac_environment($project_name); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | __END__ |
---|
| 62 | =head1 NAME |
---|
| 63 | |
---|
| 64 | fcm-add-trac-env |
---|
| 65 | |
---|
| 66 | =head1 SYNOPSIS |
---|
| 67 | |
---|
| 68 | fcm-add-svn-repos-and-trac-env [OPTIONS] PROJECT |
---|
| 69 | |
---|
| 70 | =head1 OPTIONS |
---|
| 71 | |
---|
| 72 | =over 4 |
---|
| 73 | |
---|
| 74 | =item --help, -h, --usage |
---|
| 75 | |
---|
| 76 | Prints help and exits. |
---|
| 77 | |
---|
| 78 | =item --svn-live-dir=DIR |
---|
| 79 | |
---|
| 80 | Specifies the root location of the live directory of Subversion repositories. |
---|
| 81 | See L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 82 | |
---|
| 83 | =item --svn-project-suffix=NAME |
---|
| 84 | |
---|
| 85 | Specifies the suffix added to the project name for Subversion repositories. The |
---|
| 86 | default is "_svn". |
---|
| 87 | |
---|
| 88 | =item --trac-host-id=HOST |
---|
| 89 | |
---|
| 90 | Specifies the host ID of the Trac server for the new Trac environment. See |
---|
| 91 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 92 | |
---|
| 93 | =item --trac-live-dir=DIR |
---|
| 94 | |
---|
| 95 | Specifies the root location of the live directory of Trac environments. See |
---|
| 96 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
| 97 | |
---|
| 98 | =back |
---|
| 99 | |
---|
| 100 | =head1 ARGUMENTS |
---|
| 101 | |
---|
| 102 | =over 4 |
---|
| 103 | |
---|
| 104 | =item PROJECT |
---|
| 105 | |
---|
| 106 | Specifies the name of the project to add. |
---|
| 107 | |
---|
| 108 | =back |
---|
| 109 | |
---|
| 110 | =head1 DESCRIPTION |
---|
| 111 | |
---|
| 112 | This program adds a new Subversion repository with an associated Trac |
---|
| 113 | environment to their live directories. |
---|
| 114 | |
---|
| 115 | =head1 COPYRIGHT |
---|
| 116 | |
---|
| 117 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
| 118 | |
---|
| 119 | =cut |
---|