bluto

Release package and announcement generator
Info | Log | Files | Refs | README | LICENSE

commit 3809e8cf56508fd5c86a9d180783a077be785126
parent d439b2691393d00a56dca42ca7480c68c95a4bfd
Author: lash <dev@holbrook.no>
Date:   Mon,  9 Sep 2024 01:22:01 +0100

Apply default template file

Diffstat:
MBluto/Announce.pm | 51++++++++++++++++++++++++++++++++++++++++++++++++---
Mbase.tt | 2--
Mto_std.pl | 2+-
3 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/Bluto/Announce.pm b/Bluto/Announce.pm @@ -47,9 +47,18 @@ sub get_asciidoc { ABSOLUTE => 1, }); - if (!$tt->process($env->{template_path}, $release, \$v)) { - error('error processing template: '. $tt->error()); - $v = undef; + if (defined $env->{template_path}) { + if (!$tt->process($env->{template_path}, $release, \$v)) { + error('error processing template: '. $tt->error()); + $v = undef; + } + } else { + debug("no template specified, using default"); + my $tpl = do { local $/; <Bluto::Announce::DATA> }; + if (!$tt->process(\$tpl, $release, \$v)) { + error('error processing default template (sorry!!): '. $tt->error()); + $v = undef; + } } $v = _adapt_headings($v); @@ -58,3 +67,39 @@ sub get_asciidoc { } 1; + +__DATA__ + +Release announcement: [% name %] +=== + +Version release: [% version %] + +License: [% license %] + +Source bundles +-------------- + +[% FOREACH v IN src %]* [% v %] +[% END %] + +VCS +--- + +[% FOREACH v IN vcs %]* [% v %] +[% END %] + +ONLINE RESOURCES +---------------- + +[% FOREACH v IN url %]* [% v %] +[% END %] + +CHANGELOG +--------- + +[% changelog %] + +----- + +Generated by [% engine %] at [% time %]Z diff --git a/base.tt b/base.tt @@ -31,5 +31,3 @@ CHANGELOG ----- Generated by [% engine %] at [% time %]Z - ------ diff --git a/to_std.pl b/to_std.pl @@ -43,7 +43,7 @@ my %env = ( out_dir => File::Spec->catfile(getcwd, 'bluto_build'), feed_dir => undef, content_dir => getcwd, - template_path => 'base.tt', + template_path => undef, engine => undef, readme => undef, version => undef,