Permalink
Browse files

Add -t/--template option (use custom template)

  • Loading branch information...
1 parent fe11841 commit c25db466e77b115b6a7fc23624a05bfe536a96b5 @derf committed Jun 8, 2011
Showing with 27 additions and 7 deletions.
  1. +8 −2 bin/slackeria
  2. +19 −5 lib/App/Slackeria/Out/XHTML.pm
View
@@ -14,7 +14,8 @@ use Getopt::Long qw(:config no_ignore_case);
my $conf = App::Slackeria::Config->new();
my $project;
-my $plugin = App::Slackeria::Plugin->new();
+my $plugin = App::Slackeria::Plugin->new();
+my $template;
my $verbose = 0;
my ( @plugins, @projects );
@@ -23,6 +24,7 @@ our $VERSION = '0.1';
GetOptions(
'P|projects=s@' => sub { push( @projects, split( qr{,}, $_[1] ) ) },
'p|plugins=s@' => sub { push( @plugins, split( qr{,}, $_[1] ) ) },
+ 't|template=s' => \$template,
'v|verbose' => \$verbose,
'V|version' => sub { say "slackeria version ${VERSION}"; exit 0 },
);
@@ -57,7 +59,11 @@ for my $p ( keys %{$project} ) {
}
}
-App::Slackeria::Out::XHTML->write_out( $filename, $project );
+App::Slackeria::Out::XHTML->write_out(
+ data => $project,
+ filename => $filename,
+ template => $template,
+);
__END__
@@ -38,14 +38,28 @@ sub format_check {
}
sub write_out {
- my ( $self, $filename, $project ) = @_;
+ my ( $self, %opt ) = @_;
my @project_lines;
my @headers;
- my $tmpl = HTML::Template->new(
- filehandle => *DATA,
- title => 'Software version matrix',
- );
+ my $filename = $opt{filename};
+ my $project = $opt{data};
+
+ my $tmpl;
+
+ if ( $opt{template} ) {
+ $tmpl = HTML::Template->new(
+ filename => $opt{template},
+ title => 'Software version matrix',
+ );
+ }
+ else {
+ $tmpl = HTML::Template->new(
+ filehandle => *DATA,
+ title => 'Software version matrix',
+ );
+ }
+
for my $p ( sort keys %{$project} ) {

0 comments on commit c25db46

Please sign in to comment.