/
pgxn_maint
executable file
·129 lines (81 loc) · 3.47 KB
/
pgxn_maint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/local/bin/perl -w
use 5.10.0;
use utf8;
use lib 'lib';
use PGXN::Manager::Maint;
PGXN::Manager::Maint->go;
=head1 Name
pgxn_maint - Sync the PGXN API server to a PGXN mirror
=head1 Usage
pgxn_maint [OPTIONS] TASK
=head1 Description
This program handles various maintenance tasks that periodically come up, such
as a need to regenerate stats files or to reindex a distribution. To use it,
just specify the name of the task to execute and any required arguments.
=head1 Options
-E --env ENV Specify the environment in which to run.
-V --verbose Incremental verbosity to STDOUT.
-h --help Print a usage statement and exit.
-m --man Print the complete documentation and exit.
-v --version Print the version number and exit.
=head1 Maintenance Tasks
=head3 C<update-stats>
pgxn_maint update-stats
Updates all the system-wide stats files from the database. The stats files are
JSON and their location is defined by the C<stats> URI template in the PGXN
Manager configuration file. Currently, they include:
=over
=item F<dist.json>
=item F<extension.json>
=item F<user.json>
=item F<tag.json>
=item F<summary.json>
=back
=head3 C<update-users>
pgxn_maint update-users;
Updates the JSON files for all users in the database. The location of the
files is defined by the C<users> URI template in the PGXN Manager
configuration file.
=head3 C<reindex>
pgxn_maint reindex pair 0.1.1
Reindexes one or more releases of distributions. Specify distribution name and
version pairs. Most useful if you need to reindex a specific version of a
distribution or three, like so:
pgxn_maint reindex pair 0.1.1 pair 0.1.2 pgTAP 0.25.0
If you need to reindex all versions of a given distribution, or all
distributions (yikes!), use C<reindex-all>, instead.
=head3 C<reindex-all>
pgxn_maint reindex-all pair pgTAP
pgxn_maint reindex-all
Reindexes all releases of the named distributions. If no arguments are
specified, it reindexes every distribution in the system. That's not to be
undertaken lightly if you have a lot of distributions. If you need to update
only a few, pass their names. If you need to reindex only specific versions of
a distribution, use C<reindex> instead.
=head1 To-Do
=over
=item *
Add `update-mirrors` task.
=item *
Add `init-mirror` task.
=back
=head1 Author
David E. Wheeler <david.wheeler@pgexperts.com>
=head1 Copyright and License
Copyright (c) 2011 David E. Wheeler.
This module is free software; you can redistribute it and/or modify it under
the L<PostgreSQL License|http://www.opensource.org/licenses/postgresql>.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
hereby granted, provided that the above copyright notice and this paragraph
and the following two paragraphs appear in all copies.
In no event shall David E. Wheeler be liable to any party for direct,
indirect, special, incidental, or consequential damages, including lost
profits, arising out of the use of this software and its documentation, even
if David E. Wheeler has been advised of the possibility of such damage.
David E. Wheeler specifically disclaims any warranties, including, but not
limited to, the implied warranties of merchantability and fitness for a
particular purpose. The software provided hereunder is on an "as is" basis,
and David E. Wheeler has no obligations to provide maintenance, support,
updates, enhancements, or modifications.
=cut