From 0c7e2843ae4ae231b10e0ebda5d06fcc431521be Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Wed, 11 May 2011 22:09:43 -0700 Subject: Inhibit some tweakables from being in the all-tweakables list, and display undefined values better. --- libpiny/lib/Piny/Config.pm | 8 ++++---- pinyadmin/sbin/pinyconfig | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm index d37fa67..3c1ae3f 100644 --- a/libpiny/lib/Piny/Config.pm +++ b/libpiny/lib/Piny/Config.pm @@ -183,7 +183,7 @@ sub all_tweakables { # Tweakable helper sub tweakable { - my ( $attr, $default, $isa ) = @_; + my ( $attr, $default, $isa, $inhibit ) = @_; $attr = lc $attr; @@ -192,7 +192,7 @@ sub tweakable { if ( $attrname =~ /_/ ) { croak "Illegal attribute name $attrname! (use only one underbar)"; }; - push @tweakables, $attr; + push @tweakables, $attr unless defined $inhibit and $inhibit; has $attr => ( is => 'rw' @@ -235,8 +235,8 @@ sub tweakable { # The tweakables # Global tweakables, which only make sense in the global config file. -tweakable "piny_adminemail" => "jrayhawk\@omgwallhack.org", 'Str'; -tweakable "piny_template" => undef, 'Maybe[PathDir]'; +tweakable "piny_adminemail" => "jrayhawk\@omgwallhack.org", 'Str', 'inhibit'; +tweakable "piny_template" => undef, 'Maybe[PathDir]', 'inhibit'; # Repo-specific tweakables, in the repos' .git/config files. tweakable "piny_ikiwiki" => "true", 'GitBool'; diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig index 8496cc7..345e53f 100755 --- a/pinyadmin/sbin/pinyconfig +++ b/pinyadmin/sbin/pinyconfig @@ -24,7 +24,12 @@ if ( not defined $attr ) { my $tweakables = $config->all_tweakables; foreach my $t ( sort keys %$tweakables ) { - print "$t => " . $tweakables->{$t} . "\n"; + my $v = $tweakables->{$t}; + if ( defined $v ) { + print "$t => $v\n"; + } else { + print "$t undefined\n"; + }; }; } else { -- cgit v1.2.3