[PATCH 1/2] Make config prepopulateable
From: Joachim Breitner <mail@joachim-breitner.de>
To be able to write unit tests for wanna-build, make sure that we can
fill out config variables before running the script.
---
bin/wanna-build | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/wanna-build b/bin/wanna-build
index 2f3cfd6..74770b5 100755
--- a/bin/wanna-build
+++ b/bin/wanna-build
@@ -21,10 +21,10 @@
package conf;
# defaults
-$basedir = "/var/lib/debbuild";
-$dbbase = "build-db";
-$transactlog = "transactions.log";
-$mailprog = "/usr/sbin/sendmail";
+$basedir ||= "/var/lib/debbuild";
+$dbbase ||= "build-db";
+$transactlog ||= "transactions.log";
+$mailprog ||= "/usr/sbin/sendmail";
require "/etc/wanna-build.conf";
die "$conf::basedir is not a directory\n" if ! -d $conf::basedir;
die "dbbase is empty\n" if ! $dbbase;
--
1.6.3.3
Reply to: