New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
fcm-add-trac-env in vendors/fcm/current/examples/sbin – NEMO

source: vendors/fcm/current/examples/sbin/fcm-add-trac-env @ 1980

Last change on this file since 1980 was 1980, checked in by flavoni, 14 years ago

importing fcm vendor

File size: 2.7 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# (C) Crown copyright Met Office. All rights reserved.
4# For further details please refer to the file COPYRIGHT.txt
5# which you should have received as part of this distribution.
6# ------------------------------------------------------------------------------
7
8use strict;
9use warnings;
10
11use FindBin;
12use lib "$FindBin::Bin/../lib";
13use FCM::Admin::System qw{add_trac_environment};
14use FCM::Admin::Util qw{option2config};
15use Getopt::Long qw{GetOptions};
16use Pod::Usage qw{pod2usage};
17
18main();
19
20sub main {
21    my %option;
22    my $result = GetOptions(
23        \%option,
24        q{admin-user|u=s@},
25        q{authorised|a},
26        q{help|usage|h},
27        q{svn-live-dir=s},
28        q{svn-project-suffix=s},
29        q{trac-live-dir=s},
30    );
31    if (!$result) {
32        pod2usage(1);
33    }
34    if (exists($option{help})) {
35        pod2usage(q{-verbose} => 1);
36    }
37    if (exists($option{'admin-user'})) {
38        $option{'admin-user'} = [
39            split(q{,}, join(q{,}, @{$option{'admin-user'}})),
40        ];
41    }
42    option2config(\%option);
43    if (@ARGV != 1) {
44        my $message = sprintf(
45            qq{Expected exactly 1 argument, %d given.}, scalar(@ARGV),
46        );
47        pod2usage({q{-exitval} => 1, q{-message} => $message});
48    }
49    my ($project_name) = @ARGV;
50    add_trac_environment(
51        $project_name,
52        (exists($option{'admin-user'}) ? $option{'admin-user'} : []),
53        exists($option{'authorised'}),
54    );
55}
56
57__END__
58=head1 NAME
59
60fcm-add-trac-env
61
62=head1 SYNOPSIS
63
64    fcm-add-trac-env [OPTIONS] PROJECT
65
66=head1 OPTIONS
67
68=over 4
69
70=item --admin-user=LIST, -uLIST
71
72Specifies one or more admin users, in a comma separated list.
73
74=item --authorised, -a
75
76Adds an "authorised" permission. Only those users granted this permission
77will have "_CREATE" and "_MODIFY" access. The default is to grant all
78authenticated users "_CREATE" and "_MODIFY" access.
79
80=item --help, -h, --usage
81
82Prints help and exits.
83
84=item --svn-live-dir=DIR
85
86Specifies the root location of the live directory of Subversion repositories.
87See L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
88
89=item --svn-project-suffix=NAME
90
91Specifies the suffix added to the project name for Subversion repositories. The
92default is "_svn".
93
94=item --trac-live-dir=DIR
95
96Specifies the root location of the live directory of Trac environments. See
97L<FCM::Admin::Config|FCM::Admin::Config> for the current default.
98
99=back
100
101=head1 ARGUMENTS
102
103=over 4
104
105=item PROJECT
106
107Specifies the name of the project to add.
108
109=back
110
111=head1 DESCRIPTION
112
113This program adds a new Trac environment to the live directory.
114
115=head1 COPYRIGHT
116
117E<169> Crown copyright Met Office. All rights reserved.
118
119=cut
Note: See TracBrowser for help on using the repository browser.