[augeas-devel] [PATCH] Add soma lens and test

free at 64studio.com free at 64studio.com
Sat Dec 27 18:18:46 UTC 2008


commit ca642e3cd096d8e9de30b457981eb6fb5a0d59a0
Author: Free Ekanayaka <free at 64studio.com>
Date:   Sat Dec 27 18:17:56 2008 +0000

    Add soma lens and test

diff --git a/lenses/soma.aug b/lenses/soma.aug
new file mode 100644
index 0000000..45aa1a8
--- /dev/null
+++ b/lenses/soma.aug
@@ -0,0 +1,45 @@
+(* Soma module for Augeas
+ Author: Free Ekanayaka <free at 64studio.com>
+
+ Reference: man 5 soma.cfg
+
+*)
+
+module Soma =
+
+   autoload xfm
+
+(************************************************************************
+ *                           USEFUL PRIMITIVES
+ *************************************************************************)
+
+let eol        = Util.eol
+let comment    = Util.comment
+let empty      = Util.empty
+
+let sep_eq     = del /[ \t]*=[ \t]*/ " = "
+
+let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
+
+let word       = /[A-Za-z0-9_.-]+/
+
+(************************************************************************
+ *                               ENTRIES
+ *************************************************************************)
+
+let entry     = [ key word
+                . sep_eq
+                . sto_to_eol
+                . eol ]
+
+(************************************************************************
+ *                                LENS
+ *************************************************************************)
+
+let lns        = (comment|empty|entry) *
+
+let filter
+               = incl "/etc/somad/soma.cfg"
+               . Util.stdexcl
+
+let xfm        = transform lns filter
diff --git a/lenses/tests/test_soma.aug b/lenses/tests/test_soma.aug
new file mode 100644
index 0000000..5346af6
--- /dev/null
+++ b/lenses/tests/test_soma.aug
@@ -0,0 +1,15 @@
+module Test_soma =
+
+let conf = "# comment
+User = soma
+
+OptionsItem = \"-msglevel avsync=5 -ao jack -af volnorm -novideo -noconsolecontrols -nojoystick -nolirc -nomouseinput\"
+Debug = 3
+"
+
+test Soma.lns get conf =
+   { "#comment" = "comment" }
+   { "User" = "soma" }
+   {}
+   { "OptionsItem" = "\"-msglevel avsync=5 -ao jack -af volnorm -novideo -noconsolecontrols -nojoystick -nolirc -nomouseinput\"" }
+   { "Debug" = "3" }




More information about the augeas-devel mailing list