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