summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjrayhawk+piny.be@omgwallhack.org <jrayhawk+piny.be@omgwallhack.org>2012-08-30 20:55:19 -0700
committerjrayhawk+piny.be@omgwallhack.org <jrayhawk+piny.be@omgwallhack.org>2012-08-30 20:55:19 -0700
commit6bd82e8bb3aded8fa697b8ffe30bcf7ec3ab39c4 (patch)
tree8b0e4750fb37784ad837423e416f90a0a86df288
parente35898e00cfa137189d760e14eaf4b5d052f7090 (diff)
downloadpiny-code-6bd82e8bb3aded8fa697b8ffe30bcf7ec3ab39c4.tar.gz
piny-code-6bd82e8bb3aded8fa697b8ffe30bcf7ec3ab39c4.zip
Migrate Config::Simple over to Config::GitLike
Fixes problems parsing complex option statements, particularly url.<base>.pushInsteadOf
-rw-r--r--docs/install_notes.txt2
-rw-r--r--libpiny/debian/control2
-rw-r--r--libpiny/lib/Piny/Config.pm57
3 files changed, 21 insertions, 40 deletions
diff --git a/docs/install_notes.txt b/docs/install_notes.txt
index f09edc5..ccac508 100644
--- a/docs/install_notes.txt
+++ b/docs/install_notes.txt
@@ -1,4 +1,4 @@
-List of runtime dependencies: apache2 libconfig-simple-perl libcrypt-blowfish-perl libcrypt-cbc-perl libdigest-hmac-perl libdigest-sha-perl libemail-valid-loose-perl libgetopt-tabular-perl libjson-perl libmath-gmp-perl libmime-base32-perl libmoose-perl libmoosex-singleton-perl libmoosex-strictconstructor-perl moreutils ssl-cert libapache2-mod-auth-pam libapache2-mod-auth-sys-group git libsearch-xapian-perl libcgi-session-perl libcgi-formbuilder-perl libxml-simple-perl perlmagick libfile-chdir-perl libtext-markdown-discount-perl libtext-csv-perl graphviz texlive dvipng libsort-naturally-perl gcc sudo
+List of runtime dependencies: apache2 libconfig-gitlike-perl libcrypt-blowfish-perl libcrypt-cbc-perl libdigest-hmac-perl libdigest-sha-perl libemail-valid-loose-perl libgetopt-tabular-perl libjson-perl libmath-gmp-perl libmime-base32-perl libmoose-perl libmoosex-singleton-perl libmoosex-strictconstructor-perl moreutils ssl-cert libapache2-mod-auth-pam libapache2-mod-auth-sys-group git libsearch-xapian-perl libcgi-session-perl libcgi-formbuilder-perl libxml-simple-perl perlmagick libfile-chdir-perl libtext-markdown-discount-perl libtext-csv-perl graphviz texlive dvipng libsort-naturally-perl gcc sudo
List of source dependencies: dpkg-dev debhelper devscripts fakeroot texlive-extra-utils wdg-html-validator po4a cdbs zlib1g-dev libssl-dev libcurl4-openssl-dev build-essential libhtml-template-perl libhtml-scrubber-perl libyaml-libyaml-perl python-support
# wheezy is best-tested at this point
diff --git a/libpiny/debian/control b/libpiny/debian/control
index 4328fc3..16f606a 100644
--- a/libpiny/debian/control
+++ b/libpiny/debian/control
@@ -8,7 +8,7 @@ Standards-version: 3.9.1
Package: libpiny-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libconfig-simple-perl, libdigest-hmac-perl, libdigest-sha1-perl | libdigest-sha-perl, libemail-valid-loose-perl, libmath-gmp-perl, libmoose-perl, libmoosex-singleton-perl, libmoosex-strictconstructor-perl
+Depends: ${perl:Depends}, ${misc:Depends}, libconfig-gitlike-perl, libdigest-hmac-perl, libdigest-sha1-perl | libdigest-sha-perl, libemail-valid-loose-perl, libmath-gmp-perl, libmoose-perl, libmoosex-singleton-perl, libmoosex-strictconstructor-perl
Description: Perl interface for the piny infrastructure
This is a set of modules for accomplishing administrative tasks in the piny.be
infrastructure.
diff --git a/libpiny/lib/Piny/Config.pm b/libpiny/lib/Piny/Config.pm
index f179d98..bb72536 100644
--- a/libpiny/lib/Piny/Config.pm
+++ b/libpiny/lib/Piny/Config.pm
@@ -11,7 +11,7 @@ use Moose::Util::TypeConstraints;
use MooseX::StrictConstructor;
use Carp;
-use Config::Simple qw( -lc );
+use Config::GitLike;
use Piny::Environment;
@@ -87,13 +87,8 @@ sub _build__conf {
my $conf;
- if ( $s->has_confpath and -e $s->confpath ) {
- $conf = Config::Simple->new( $s->confpath );
- if ( defined $conf ) {
- $conf = $conf->vars;
- } else {
- $conf = { };
- };
+ if ( $s->has_confpath and -s $s->confpath ) {
+ $conf = Config::GitLike->load_file( $s->confpath );
} else {
$conf = { };
};
@@ -102,15 +97,11 @@ sub _build__conf {
if ( -s $home ) {
- my $userconf = Config::Simple->new( $home );
+ my $userconf = Config::GitLike->load_file( $home );
- if ( defined $userconf ) {
- $userconf = $userconf->vars;
-
- foreach my $key ( keys %$userconf ) {
- if ( not exists $conf->{$key} ) {
- $conf->{$key} = $userconf->{$key};
- };
+ foreach my $key ( keys %$userconf ) {
+ if ( not exists $conf->{$key} ) {
+ $conf->{$key} = $userconf->{$key};
};
};
@@ -118,15 +109,11 @@ sub _build__conf {
if ( -s "/etc/piny-default.conf" ) {
- my $default = Config::Simple->new( "/etc/piny-default.conf" );
-
- if ( defined $default ) {
- $default = $default->vars;
+ my $default = Config::GitLike->load_file( "/etc/piny-default.conf" );
- foreach my $key ( keys %$default ) {
- if ( not exists $conf->{$key} ) {
- $conf->{$key} = $default->{$key};
- };
+ foreach my $key ( keys %$default ) {
+ if ( not exists $conf->{$key} ) {
+ $conf->{$key} = $default->{$key};
};
};
@@ -134,14 +121,10 @@ sub _build__conf {
if ( -s "/etc/piny-override.conf" ) {
- my $override = Config::Simple->new( "/etc/piny-override.conf" );
+ my $override = Config::GitLike->load_file( "/etc/piny-override.conf" );
- if ( defined $override ) {
- $override = $override->vars;
-
- foreach my $key ( keys %$override ) {
- $conf->{$key} = $override->{$key};
- };
+ foreach my $key ( keys %$override ) {
+ $conf->{$key} = $override->{$key};
};
};
@@ -165,17 +148,17 @@ sub save {
my ( $override, $userconf, $default ) = ( {}, {}, {} );
if ( -s "/etc/piny-override.conf" ) {
- $override = Config::Simple->new( "/etc/piny-override.conf" )->vars;
+ $override = Config::GitLike->load_file( "/etc/piny-override.conf" );
};
my $home = Piny::Environment->instance->user->home . "/.gitconfig";
if ( $s->confpath ne $home and -s $home ) {
- $userconf = Config::Simple->new( $home )->vars;
+ $userconf = Config::GitLike->load_file( $home );
};
if ( -s "/etc/piny-default.conf" ) {
- $default = Config::Simple->new( "/etc/piny-default.conf" )->vars;
+ $default = Config::GitLike->load_file( "/etc/piny-default.conf" );
};
foreach my $key ( keys %{$s->_conf} ) {
@@ -189,14 +172,12 @@ sub save {
};
};
- my $cs = Config::Simple->new( syntax => "ini" );
+ my $cs = Config::GitLike->new( confname => 'blank' );
foreach my $key ( keys %{$s->_conf} ) {
- $cs->param( $key, $s->_conf->{$key} );
+ $cs->set( key => $key, value => $s->_conf->{$key}, filename => $s->confpath );
};
- $cs->write( $s->confpath );
-
$s->clear_conf;
};