summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@debian.org>2019-05-28 21:10:02 +0000
committerDmitry Bogatov <KAction@debian.org>2019-05-28 21:30:40 +0000
commite4b8e832194949b228db4fd00eab558dfc8b7d27 (patch)
treea3a3dccdf1ba568686411f769857758372c33165 /t
parent8eddb040f95b7e6a2ebb4700c4518e76b7c5b294 (diff)
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.
Diffstat (limited to 't')
-rw-r--r--t/928935.t7
1 files changed, 5 insertions, 2 deletions
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 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2use strict; 2use strict;
3use warnings; 3use warnings;
4use Test::More tests => 2; 4use Test::More tests => 4;
5use T; 5use T;
6 6
7system_ok('dh_runit', 'debian/test.runscript', 'name=test,noreplace'); 7system_ok('dh_runit', 'debian/test.runscript', 'name=test,noreplace,logscript');
8 8
9my $noreplace = 'debian/dh-runit-test/usr/share/runit/meta/test/noreplace'; 9my $noreplace = 'debian/dh-runit-test/usr/share/runit/meta/test/noreplace';
10ok(-f $noreplace, 'noreplace file correctly created'); 10ok(-f $noreplace, 'noreplace file correctly created');
11my $logscript = 'debian/dh-runit-test/etc/sv/test/log/run';
12ok(-f $logscript, 'logscript correctly created');
13ok(-x $logscript, 'logscript is executable');