[augeas-devel] [PATCH] Php: some small fixes
David Lutterkort
dlutter at redhat.com
Wed Aug 13 22:41:46 UTC 2008
3 files changed, 20 insertions(+), 3 deletions(-)
lenses/inifile.aug | 2 +-
lenses/php.aug | 6 ++++--
lenses/tests/test_php.aug | 15 +++++++++++++++
# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1218667288 25200
# Node ID 0318a38c20a5ee61391b75bd194e7d1b34d7da98
# Parent 495c005f666b22c0bcd550e1733077908053d7d4
Php: some small fixes
- accept empty comments starting with ';'
- allow upper case letters in keys
- also look for PHP inifiles in the places used by RHEL/Fedora
diff -r 495c005f666b -r 0318a38c20a5 lenses/inifile.aug
--- a/lenses/inifile.aug Wed Aug 13 18:53:43 2008 +0200
+++ b/lenses/inifile.aug Wed Aug 13 15:41:28 2008 -0700
@@ -32,7 +32,7 @@
let comment = comment_generic /[#;]/ ";"
let comment_nosharp = comment_generic ";" ";"
-let empty = Util.empty
+let empty = [ del /[ \t]*[#;]?[ \t]*\n/ "" ]
(************************************************************************
diff -r 495c005f666b -r 0318a38c20a5 lenses/php.aug
--- a/lenses/php.aug Wed Aug 13 18:53:43 2008 +0200
+++ b/lenses/php.aug Wed Aug 13 15:41:28 2008 -0700
@@ -7,13 +7,15 @@
(* PHP is a standard INI file *)
-let entry = IniFile.entry /[a-z][a-z0-9\._-]+/
+let entry = IniFile.entry /[a-zA-Z][a-zA-Z0-9\._-]+/
let record = IniFile.record "section" entry
let lns = IniFile.lns record
let filter = (incl "/etc/php*/*/php.ini")
- . Util.stdexcl
+ . (incl "/etc/php.d/*.ini")
+ . (incl "/etc/php.ini")
+ . Util.stdexcl
let xfm = transform lns filter
diff -r 495c005f666b -r 0318a38c20a5 lenses/tests/test_php.aug
--- a/lenses/tests/test_php.aug Wed Aug 13 18:53:43 2008 +0200
+++ b/lenses/tests/test_php.aug Wed Aug 13 15:41:28 2008 -0700
@@ -26,3 +26,18 @@
{} }
{ "section" = "sqlite"
{ "sqlite.assoc_case" = "0" } }
+
+ test PHP.lns get ";\n" = {}
+
+ (* Section titles can have spaces *)
+ test PHP.lns get "[mail function]\n" =
+ { "section" = "mail function" }
+
+ (* Keys can be lower and upper case *)
+ test PHP.lns get "[fake]
+SMTP = localhost
+mixed_KEY = 25
+" =
+ { "section" = "fake"
+ { "SMTP" = "localhost" }
+ { "mixed_KEY" = "25" } }
More information about the augeas-devel
mailing list