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 | |
---|
8 | use strict; |
---|
9 | use warnings; |
---|
10 | |
---|
11 | use FindBin; |
---|
12 | use lib "$FindBin::Bin/../lib"; |
---|
13 | use FCM::Admin::System qw{ |
---|
14 | filter_projects |
---|
15 | get_projects_from_svn_live |
---|
16 | install_svn_hook |
---|
17 | }; |
---|
18 | use FCM::Admin::Util qw{option2config}; |
---|
19 | use Getopt::Long qw{GetOptions}; |
---|
20 | use Pod::Usage qw{pod2usage}; |
---|
21 | |
---|
22 | main(); |
---|
23 | |
---|
24 | sub main { |
---|
25 | my %option; |
---|
26 | my $result = GetOptions( |
---|
27 | \%option, |
---|
28 | q{help|usage|h}, |
---|
29 | q{svn-hook-dir=s}, |
---|
30 | q{svn-live-dir=s}, |
---|
31 | q{svn-project-suffix=s}, |
---|
32 | ); |
---|
33 | if (!$result) { |
---|
34 | pod2usage(1); |
---|
35 | } |
---|
36 | if (exists($option{help})) { |
---|
37 | pod2usage(q{-verbose} => 1); |
---|
38 | } |
---|
39 | option2config(\%option); |
---|
40 | my @projects = filter_projects([get_projects_from_svn_live()], \@ARGV); |
---|
41 | for my $project (@projects) { |
---|
42 | install_svn_hook($project); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | __END__ |
---|
47 | |
---|
48 | =head1 NAME |
---|
49 | |
---|
50 | fcm-install-svn-hook |
---|
51 | |
---|
52 | =head1 SYNOPSIS |
---|
53 | |
---|
54 | fcm-install-svn-hook [OPTIONS] [PROJECT ...] |
---|
55 | |
---|
56 | =head1 OPTIONS |
---|
57 | |
---|
58 | =over 4 |
---|
59 | |
---|
60 | =item --help, -h, --usage |
---|
61 | |
---|
62 | Prints help and exits. |
---|
63 | |
---|
64 | =item --svn-hook-dir=DIR |
---|
65 | |
---|
66 | Specifies the root location of the directory containing the source files of the |
---|
67 | hook scripts. See L<FCM::Admin::Config|FCM::Admin::Config> for the current |
---|
68 | default. |
---|
69 | |
---|
70 | =item --svn-live-dir=DIR |
---|
71 | |
---|
72 | Specifies the root location of the live directory. See |
---|
73 | L<FCM::Admin::Config|FCM::Admin::Config> for the current default. |
---|
74 | |
---|
75 | =item --svn-project-suffix=NAME |
---|
76 | |
---|
77 | Specifies the suffix added to the project name. The default is "_svn". |
---|
78 | |
---|
79 | =back |
---|
80 | |
---|
81 | =head1 ARGUMENTS |
---|
82 | |
---|
83 | =over 4 |
---|
84 | |
---|
85 | =item PROJECT |
---|
86 | |
---|
87 | Specifies one or more project requiring hooks scripts to be installed. If no |
---|
88 | project is specified, the program install the hook scripts to all projects in |
---|
89 | the live directory. |
---|
90 | |
---|
91 | =back |
---|
92 | |
---|
93 | =head1 DESCRIPTION |
---|
94 | |
---|
95 | This program install hook scripts for Subversion repositories in the live |
---|
96 | directory. |
---|
97 | |
---|
98 | =head1 COPYRIGHT |
---|
99 | |
---|
100 | E<169> Crown copyright Met Office. All rights reserved. |
---|
101 | |
---|
102 | =cut |
---|