From e4b8e832194949b228db4fd00eab558dfc8b7d27 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Tue, 28 May 2019 21:10:02 +0000 Subject: Refactor creation of logscript Instead of using interpolation and here-strings, write function that renders mustache template. This approach makes code cleaner and more scalable. * data/logscript: add mustach template of 'log/run' script, that is installed when "logscript" option in effect. * Makefile: set DH_RUNIT_DATADIR variable in "check" target. This way, templates from ./data/ directory are used, not from system location. * debian/control: add dependency on Text::Hogan library -- implementation of "mustache" templating standard. * dh_runit(template_from_data_directory): new function * dh_runit: install 'log/run' with "template_from_data_directory" function. * t/928935.t: check that "logscript" option correctly creates 'log/run' script, with correct permissions. --- t/928935.t | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/928935.t b/t/928935.t index 52774ed..5d2fea1 100644 --- a/t/928935.t +++ b/t/928935.t @@ -1,10 +1,13 @@ #!/usr/bin/perl use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 4; use T; -system_ok('dh_runit', 'debian/test.runscript', 'name=test,noreplace'); +system_ok('dh_runit', 'debian/test.runscript', 'name=test,noreplace,logscript'); my $noreplace = 'debian/dh-runit-test/usr/share/runit/meta/test/noreplace'; ok(-f $noreplace, 'noreplace file correctly created'); +my $logscript = 'debian/dh-runit-test/etc/sv/test/log/run'; +ok(-f $logscript, 'logscript correctly created'); +ok(-x $logscript, 'logscript is executable'); -- cgit v1.2.3