mediawiki merging, row identification, tests
[scpubgit/System-Introspector-Report.git] / bin / system-introspector-report
1 #!/usr/bin/env perl
2 use strictures;
3 use Getopt::Long;
4 use Pod::Usage;
5 use System::Introspector::Report::Source;
6 use System::Introspector::Report::Config;
7
8 GetOptions(
9   's|storage=s' => \my $storage_dir,
10   'c|config=s'  => \my $config_file,
11   'r|report=s'  => \my @report_types,
12   'p|publish=s' => \my @publish_types,
13   'a|all'       => \my $all_reports,
14   'h|help'      => sub { pod2usage(0) },
15 ) or pod2usage(2);
16
17 die "$0 requires --storage (-s) to be specified\n"
18   unless defined $storage_dir;
19
20 die "$0 requires --config (-c) to be specified\n"
21   unless defined $storage_dir;
22
23 my $config = System::Introspector::Report::Config
24   ->new(config_file => $config_file);
25
26 my $source = System::Introspector::Report::Source
27   ->new_from_root($storage_dir);
28
29 my @types = $all_reports
30   ? $config->report_types
31   : map [$_, {}], @report_types;
32 my @reports = $source->generate(@types);
33
34 for my $publisher ($config->publishers(@publish_types)) {
35   $publisher->publish(\@reports);
36 }
37
38 __END__
39
40 =head1 NAME
41
42 system-introspector-report - Generate System::Introspector reports
43
44 =cut