[augeas-devel] [PATCH] Use sep.aug in httpd.aug Modify Sep.opt_space to make it fit the definition in httpd.aug (it's only used here) Allow directives without arguments in httpd.aug Adjust test_httpd.aug to test argument-less directives

Raphael Pinson raphink at gmail.com
Wed Jan 26 10:48:03 UTC 2011


From: Raphaël Pinson <raphink at gmail.com>

---
 lenses/httpd.aug            |    6 +++---
 lenses/sep.aug              |    2 +-
 lenses/tests/test_httpd.aug |    4 ++++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lenses/httpd.aug b/lenses/httpd.aug
index 5054373..cee85da 100644
--- a/lenses/httpd.aug
+++ b/lenses/httpd.aug
@@ -43,8 +43,8 @@ autoload xfm
  *                           Utilities lens
  *****************************************************************)
 let dels (s:string)     = del s s
-let sep_spc             = del /[ \t]+/ " "
-let sep_osp             = del /[ \t]*/ ""
+let sep_spc             = Sep.space
+let sep_osp             = Sep.opt_space
 let sep_eq              = del /[ \t]*=[ \t]*/ "="
 
 let nmtoken             = /[a-zA-Z:_][a-zA-Z0-9:_\.-]*/
@@ -70,7 +70,7 @@ let arg_sec = [ label "arg" . store (char_arg_sec+|dquot) ]
 let argv (l:lens) = l . (sep_spc . l)*
 
 let directive = [ indent . label "directive" . store word .
-                  sep_spc . argv arg_dir . eol ]
+                  (sep_spc . argv arg_dir)? . eol ]
 
 let section (body:lens) =
     let h = (sep_spc . argv arg_sec)? . sep_osp .
diff --git a/lenses/sep.aug b/lenses/sep.aug
index c49927e..d6fa4f9 100644
--- a/lenses/sep.aug
+++ b/lenses/sep.aug
@@ -15,6 +15,6 @@ let colon = Util.del_str ":"
 let comma = Util.del_str ","
 let space = del Rx.space " "
 let tab   = del Rx.space "\t"
-let opt_space = del Rx.opt_space " "
+let opt_space = del Rx.opt_space ""
 let opt_tab   = del Rx.opt_space "\t"
 
diff --git a/lenses/tests/test_httpd.aug b/lenses/tests/test_httpd.aug
index 577264e..682e368 100644
--- a/lenses/tests/test_httpd.aug
+++ b/lenses/tests/test_httpd.aug
@@ -208,6 +208,8 @@ let conf2 = "<VirtualHost *:80>
 
     CustomLog /var/log/apache2/access.log combined
 
+    SSLRequireSSL
+
     Alias /doc/ \"/usr/share/doc/\"
     <Directory \"/usr/share/doc/\">
         Options Indexes MultiViews FollowSymLinks
@@ -296,6 +298,8 @@ test Httpd.lns get conf2 =
       { "arg" = "combined" }
     }
     {  }
+    { "directive" = "SSLRequireSSL" }
+    {  }
     { "directive" = "Alias"
       { "arg" = "/doc/" }
       { "arg" = "\"/usr/share/doc/\"" }
-- 
1.7.0.4




More information about the augeas-devel mailing list