aboutsummaryrefslogtreecommitdiffstats
path: root/bin/update-all-reports
blob: 02f9fda7895895cd5a0011a08a6ccb4fbdc4a981 (plain)
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
#!/usr/bin/env perl

# update-all-reports:
# Generate the data for the /reports page
#
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org

use strict;
use warnings;

BEGIN {
    use File::Basename qw(dirname);
    use File::Spec;
    my $d = dirname(File::Spec->rel2abs($0));
    require "$d/../setenv.pl";
}

use FixMyStreet::Script::UpdateAllReports;
use Getopt::Long::Descriptive;

my ($opt, $usage) = describe_options(
    '%c %o',
    [ 'dashboard', "Output JSON for new dashboard-style page." ],
    [ 'help', "print usage message and exit", { shortcircuit => 1 } ],
);
print($usage->text), exit if $opt->help;

if ($opt->dashboard) {
    FixMyStreet::Script::UpdateAllReports::generate_dashboard();
} else {
    FixMyStreet::Script::UpdateAllReports::generate();
}