summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--_oasis7
-rw-r--r--_tags14
-rw-r--r--setup.ml16
-rw-r--r--src/util.ml5
-rw-r--r--src/util.mli2
-rw-r--r--src/value_checker.ml2
-rw-r--r--src/vyconf_config.ml2
-rw-r--r--src/vyconfd.ml2
9 files changed, 30 insertions, 22 deletions
diff --git a/README.md b/README.md
index a146242..5241665 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ the build dependencies:
```
opam switch 4.03.0
opam install oasis
-opam install fileutils lwt ocplib-endian ounit pcre ppx_deriving_yojson sha toml xml-light
+opam install fileutils lwt ocplib-endian ounit pcre ppx_deriving_yojson sha toml xml-light batteries
```
To build the project, run the setup script, then `make`:
diff --git a/_oasis b/_oasis
index 55a8575..e3266e3 100644
--- a/_oasis
+++ b/_oasis
@@ -15,13 +15,14 @@ Library "vyconf"
Path: src
Modules: Config_tree, Reference_tree, Curly_parser, Curly_lexer, Value_checker, Vytree
InternalModules: Util, Vylist
- BuildDepends: fileutils, pcre, ppx_deriving.show, ppx_deriving_yojson, xml-light
+ BuildDepends: fileutils, pcre, ppx_deriving.show, ppx_deriving_yojson, xml-light, batteries
Library "vyconf-config"
Path: src
Modules: Vyconf_config
+ InternalModules: Message
FindlibParent: vyconf
- BuildDepends: toml, fileutils, ppx_deriving.show
+ BuildDepends: toml, fileutils, ppx_deriving.show, batteries
Library "vyconf-client"
Path: src
@@ -34,7 +35,7 @@ Executable "vyconfd"
Path: src
MainIs: vyconfd.ml
CompiledObject: best
- BuildDepends: lwt, lwt.unix, lwt.ppx, ocaml-protoc, ocplib-endian, sha, vyconf, vyconf.vyconf-config
+ BuildDepends: lwt, lwt.unix, lwt.ppx, ocaml-protoc, ocplib-endian, sha, batteries, vyconf, vyconf.vyconf-config
Executable "vytree_test"
Path: test
diff --git a/_tags b/_tags
index 7558d80..d553ae2 100644
--- a/_tags
+++ b/_tags
@@ -1,5 +1,5 @@
# OASIS_START
-# DO NOT EDIT (digest: 1ac48d02bada81ba62837630375a7522)
+# DO NOT EDIT (digest: 4f1983ffc92b04ffaba30b6e019eb870)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
@@ -21,6 +21,7 @@ true: annot, bin_annot
# Library vyconf-client
"src/vyconf-client.cmxs": use_vyconf-client
# Executable vyconfd
+<src/vyconfd.{native,byte}>: pkg_batteries
<src/vyconfd.{native,byte}>: pkg_fileutils
<src/vyconfd.{native,byte}>: pkg_lwt
<src/vyconfd.{native,byte}>: pkg_lwt.ppx
@@ -35,6 +36,7 @@ true: annot, bin_annot
<src/vyconfd.{native,byte}>: pkg_xml-light
<src/vyconfd.{native,byte}>: use_vyconf
<src/vyconfd.{native,byte}>: use_vyconf-config
+<src/*.ml{,i,y}>: pkg_batteries
<src/*.ml{,i,y}>: pkg_fileutils
<src/*.ml{,i,y}>: pkg_lwt
<src/*.ml{,i,y}>: pkg_lwt.ppx
@@ -50,6 +52,7 @@ true: annot, bin_annot
<src/*.ml{,i,y}>: use_vyconf
<src/*.ml{,i,y}>: use_vyconf-config
# Executable vytree_test
+<test/vytree_test.{native,byte}>: pkg_batteries
<test/vytree_test.{native,byte}>: pkg_fileutils
<test/vytree_test.{native,byte}>: pkg_oUnit
<test/vytree_test.{native,byte}>: pkg_pcre
@@ -58,6 +61,7 @@ true: annot, bin_annot
<test/vytree_test.{native,byte}>: pkg_xml-light
<test/vytree_test.{native,byte}>: use_vyconf
# Executable reference_tree_test
+<test/reference_tree_test.{native,byte}>: pkg_batteries
<test/reference_tree_test.{native,byte}>: pkg_fileutils
<test/reference_tree_test.{native,byte}>: pkg_oUnit
<test/reference_tree_test.{native,byte}>: pkg_pcre
@@ -66,6 +70,7 @@ true: annot, bin_annot
<test/reference_tree_test.{native,byte}>: pkg_xml-light
<test/reference_tree_test.{native,byte}>: use_vyconf
# Executable config_tree_test
+<test/config_tree_test.{native,byte}>: pkg_batteries
<test/config_tree_test.{native,byte}>: pkg_fileutils
<test/config_tree_test.{native,byte}>: pkg_oUnit
<test/config_tree_test.{native,byte}>: pkg_pcre
@@ -76,6 +81,7 @@ true: annot, bin_annot
# Executable vylist_test
<test/vylist_test.{native,byte}>: pkg_oUnit
# Executable value_checker_test
+<test/value_checker_test.{native,byte}>: pkg_batteries
<test/value_checker_test.{native,byte}>: pkg_fileutils
<test/value_checker_test.{native,byte}>: pkg_oUnit
<test/value_checker_test.{native,byte}>: pkg_pcre
@@ -84,6 +90,7 @@ true: annot, bin_annot
<test/value_checker_test.{native,byte}>: pkg_xml-light
<test/value_checker_test.{native,byte}>: use_vyconf
# Executable util_test
+<test/util_test.{native,byte}>: pkg_batteries
<test/util_test.{native,byte}>: pkg_fileutils
<test/util_test.{native,byte}>: pkg_oUnit
<test/util_test.{native,byte}>: pkg_pcre
@@ -92,12 +99,14 @@ true: annot, bin_annot
<test/util_test.{native,byte}>: pkg_xml-light
<test/util_test.{native,byte}>: use_vyconf
# Executable vyconf_config_test
+<test/vyconf_config_test.{native,byte}>: pkg_batteries
<test/vyconf_config_test.{native,byte}>: pkg_fileutils
<test/vyconf_config_test.{native,byte}>: pkg_oUnit
<test/vyconf_config_test.{native,byte}>: pkg_ppx_deriving.show
<test/vyconf_config_test.{native,byte}>: pkg_toml
<test/vyconf_config_test.{native,byte}>: use_vyconf-config
# Executable curly_parser_test
+<test/curly_parser_test.{native,byte}>: pkg_batteries
<test/curly_parser_test.{native,byte}>: pkg_fileutils
<test/curly_parser_test.{native,byte}>: pkg_oUnit
<test/curly_parser_test.{native,byte}>: pkg_pcre
@@ -106,6 +115,7 @@ true: annot, bin_annot
<test/curly_parser_test.{native,byte}>: pkg_xml-light
<test/curly_parser_test.{native,byte}>: use_vyconf
# Executable session_test
+<test/session_test.{native,byte}>: pkg_batteries
<test/session_test.{native,byte}>: pkg_fileutils
<test/session_test.{native,byte}>: pkg_oUnit
<test/session_test.{native,byte}>: pkg_pcre
@@ -119,12 +129,14 @@ true: annot, bin_annot
<test/*.ml{,i,y}>: pkg_toml
<test/*.ml{,i,y}>: use_vyconf-config
# Executable vytree_load_test
+<test/vytree_load_test.{native,byte}>: pkg_batteries
<test/vytree_load_test.{native,byte}>: pkg_fileutils
<test/vytree_load_test.{native,byte}>: pkg_pcre
<test/vytree_load_test.{native,byte}>: pkg_ppx_deriving.show
<test/vytree_load_test.{native,byte}>: pkg_ppx_deriving_yojson
<test/vytree_load_test.{native,byte}>: pkg_xml-light
<test/vytree_load_test.{native,byte}>: use_vyconf
+<test/*.ml{,i,y}>: pkg_batteries
<test/*.ml{,i,y}>: pkg_fileutils
<test/*.ml{,i,y}>: pkg_pcre
<test/*.ml{,i,y}>: pkg_ppx_deriving.show
diff --git a/setup.ml b/setup.ml
index f9d2b3f..a832bcb 100644
--- a/setup.ml
+++ b/setup.ml
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.4.8 *)
(* OASIS_START *)
-(* DO NOT EDIT (digest: f5962643246946021e9baa5b49e05727) *)
+(* DO NOT EDIT (digest: 215668cf326d58316175f4faa1fcff43) *)
(*
Regenerated by OASIS v0.4.8
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -7262,7 +7262,8 @@ let setup_t =
FindlibPackage ("pcre", None);
FindlibPackage ("ppx_deriving.show", None);
FindlibPackage ("ppx_deriving_yojson", None);
- FindlibPackage ("xml-light", None)
+ FindlibPackage ("xml-light", None);
+ FindlibPackage ("batteries", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_interface_patterns =
@@ -7417,7 +7418,8 @@ let setup_t =
[
FindlibPackage ("toml", None);
FindlibPackage ("fileutils", None);
- FindlibPackage ("ppx_deriving.show", None)
+ FindlibPackage ("ppx_deriving.show", None);
+ FindlibPackage ("batteries", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_interface_patterns =
@@ -7543,7 +7545,7 @@ let setup_t =
{
lib_modules = ["Vyconf_config"];
lib_pack = false;
- lib_internal_modules = [];
+ lib_internal_modules = ["Message"];
lib_findlib_parent = Some "vyconf";
lib_findlib_name = None;
lib_findlib_directory = None;
@@ -7714,6 +7716,7 @@ let setup_t =
FindlibPackage ("ocaml-protoc", None);
FindlibPackage ("ocplib-endian", None);
FindlibPackage ("sha", None);
+ FindlibPackage ("batteries", None);
InternalLibrary "vyconf";
InternalLibrary "vyconf-config"
];
@@ -9588,8 +9591,7 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.8";
- oasis_digest =
- Some "\151\2510\223\204\141\167\020,\213\233\221p\208\207\198";
+ oasis_digest = Some "0\199!)\168N\000\030\"\168\1519\196\179\144\001";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
@@ -9597,7 +9599,7 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;;
-# 9601 "setup.ml"
+# 9603 "setup.ml"
let setup_t = BaseCompat.Compat_0_4.adapt_setup_t setup_t
open BaseCompat.Compat_0_4
(* OASIS_STOP *)
diff --git a/src/util.ml b/src/util.ml
index afa0ef3..7f0d681 100644
--- a/src/util.ml
+++ b/src/util.ml
@@ -21,10 +21,5 @@ let string_of_path path =
| [] -> ""
| x :: xs -> Printf.sprintf "%s%s" x (aux xs "")
-let substitute_default o d =
- match o with
- | None -> d
- | Some v -> v
-
let absolute_path relative_path =
FilePath.make_absolute (Sys.getcwd ()) relative_path
diff --git a/src/util.mli b/src/util.mli
index 46fac71..9f6c3db 100644
--- a/src/util.mli
+++ b/src/util.mli
@@ -2,6 +2,4 @@ val find_xml_child : string -> Xml.xml -> Xml.xml option
val string_of_path : string list -> string
-val substitute_default : 'a option -> 'a -> 'a
-
val absolute_path : FilePath.filename -> FilePath.filename
diff --git a/src/value_checker.ml b/src/value_checker.ml
index dad4596..e7bec15 100644
--- a/src/value_checker.ml
+++ b/src/value_checker.ml
@@ -16,7 +16,7 @@ let validate_value dir value_constraint value =
We should do something about it.
*)
let validator = F.concat dir v in
- let arg = Util.substitute_default c "" in
+ let arg = BatOption.default "" c in
let result = Unix.system (Printf.sprintf "%s %s %s" validator arg value) in
match result with
| Unix.WEXITED 0 -> true
diff --git a/src/vyconf_config.ml b/src/vyconf_config.ml
index 6c24ffb..7a87c1a 100644
--- a/src/vyconf_config.ml
+++ b/src/vyconf_config.ml
@@ -47,7 +47,7 @@ let mandatory_field conf table field =
let optional_field default conf table field =
let value = get_field conf table field in
- Util.substitute_default value default
+ BatOption.default default value
let load filename =
try
diff --git a/src/vyconfd.ml b/src/vyconfd.ml
index c07b1b3..d8fa7c5 100644
--- a/src/vyconfd.ml
+++ b/src/vyconfd.ml
@@ -40,7 +40,7 @@ let make_session_token () =
let setup_session world req =
let token = make_session_token () in
let user = "unknown user" in
- let client_app = Util.substitute_default req.client_application "unknown client" in
+ let client_app = BatOption.default "unknown client" req.client_application in
let () = Hashtbl.add sessions token (Session.make world client_app user) in
{response_tmpl with output=(Some token)}