summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2010-10-12 22:14:30 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2010-10-12 22:14:30 -0700
commitea40b04f0ff65bd56eead8bcaee007db7d39359f (patch)
tree14d8ea272c62c92fcfb4faaca5716a31e2462a95 /usr
parent349f1bba495a8a390b6a5338ea3e222c80e1b7ac (diff)
downloadpiny-code-ea40b04f0ff65bd56eead8bcaee007db7d39359f.tar.gz
piny-code-ea40b04f0ff65bd56eead8bcaee007db7d39359f.zip
Handle git booleans with a more correct constraint.
Diffstat (limited to 'usr')
-rw-r--r--usr/src/libpiny/lib/Piny/Config.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr/src/libpiny/lib/Piny/Config.pm b/usr/src/libpiny/lib/Piny/Config.pm
index 00e4902..a162e2a 100644
--- a/usr/src/libpiny/lib/Piny/Config.pm
+++ b/usr/src/libpiny/lib/Piny/Config.pm
@@ -7,11 +7,20 @@ use warnings;
package Piny::Config;
use Moose;
+use Moose::Util::TypeConstraints;
use MooseX::StrictConstructor;
use Carp;
use Config::Simple qw( );
+# Types
+
+subtype 'GitBool'
+ => as 'Str'
+ => where { $_ =~ /^(1|0|true|false)$/i }
+ => message { 'Not correct format for a git-compatible boolean.' }
+ ;
+
# Attributes
has 'confpath' =>
@@ -174,7 +183,7 @@ tweakable "piny_ikiwikisrcdir" => "/srv/ikiwiki/", 'Str';
tweakable "piny_ikiwikiurl" => "http://piny.be/", 'Str';
tweakable "piny_ikiwikisecureurl" => "https://secure.piny.be/", 'Str';
tweakable "piny_ikiwikisecurepath" => "/srv/www/secure.piny.be/", 'Str';
-tweakable "receive_denyNonFastforwards" => "true", 'Bool';
+tweakable "receive_denyNonFastforwards" => "true", 'GitBool';
# Moose boilerplate