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{ |
---|
27 | filter_projects |
---|
28 | get_projects_from_svn_live |
---|
29 | housekeep_svn_hook_logs |
---|
30 | install_svn_hook |
---|
31 | }; |
---|
32 | use FCM::Admin::Util qw{option2config}; |
---|
33 | use Getopt::Long qw{GetOptions}; |
---|
34 | use Pod::Usage qw{pod2usage}; |
---|
35 | |
---|
36 | main(); |
---|
37 | |
---|
38 | sub main { |
---|
39 | my %option; |
---|
40 | my $result = GetOptions( |
---|
41 | \%option, |
---|
42 | q{clean}, |
---|
43 | q{help|usage|h}, |
---|
44 | q{svn-live-dir=s}, |
---|
45 | q{svn-project-suffix=s}, |
---|
46 | ); |
---|
47 | if (!$result) { |
---|
48 | pod2usage(1); |
---|
49 | } |
---|
50 | if (exists($option{help})) { |
---|
51 | pod2usage(q{-verbose} => 1); |
---|
52 | } |
---|
53 | option2config(\%option); |
---|
54 | my @projects = filter_projects([get_projects_from_svn_live()], \@ARGV); |
---|
55 | for my $project (sort {$a->get_name() cmp $b->get_name()} @projects) { |
---|
56 | install_svn_hook($project, $option{clean}); |
---|
57 | housekeep_svn_hook_logs($project); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | __END__ |
---|
62 | |
---|
63 | =head1 NAME |
---|
64 | |
---|
65 | fcm-install-svn-hook |
---|
66 | |
---|
67 | =head1 SYNOPSIS |
---|
68 | |
---|
69 | fcm-install-svn-hook [OPTIONS] [PROJECT ...] |
---|
70 | |
---|
71 | =head1 OPTIONS |
---|
72 | |
---|
73 | =over 4 |
---|
74 | |
---|
75 | =item --clean |
---|
76 | |
---|
77 | Removes items (except logs) that are not in the install sources. |
---|
78 | |
---|
79 | =item --help, -h, --usage |
---|
80 | |
---|
81 | Prints help and exits. |
---|
82 | |
---|
83 | =item --svn-live-dir=DIR |
---|
84 | |
---|
85 | Specifies the root location of the live directory. See |
---|
86 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
87 | |
---|
88 | =item --svn-project-suffix=NAME |
---|
89 | |
---|
90 | Specifies the suffix added to the project name. The default is "_svn". |
---|
91 | |
---|
92 | =back |
---|
93 | |
---|
94 | =head1 ARGUMENTS |
---|
95 | |
---|
96 | =over 4 |
---|
97 | |
---|
98 | =item PROJECT |
---|
99 | |
---|
100 | Specifies one or more project requiring hooks scripts to be installed. If no |
---|
101 | project is specified, the program install the hook scripts to all projects in |
---|
102 | the live directory. |
---|
103 | |
---|
104 | =back |
---|
105 | |
---|
106 | =head1 DESCRIPTION |
---|
107 | |
---|
108 | This program install hook scripts for Subversion repositories in the live |
---|
109 | directory, and install/housekeep the log files for the hook scripts. |
---|
110 | |
---|
111 | =head1 COPYRIGHT |
---|
112 | |
---|
113 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
114 | |
---|
115 | =cut |
---|