aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_read_source_files.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-12-16 16:06:29 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit8577facf7e0f06580d289ed5bf8cbded3ad2a9f1 (patch)
treedcb62b94a7ef1af2c099ea8c70ee5f1283e30db3 /org/meta_read_source_files.org
parent0.23.2 config paths for pod (diff)
target different type of config file locations
- config files for - local site configuration (not in pod) - document make (included in pod)
Diffstat (limited to 'org/meta_read_source_files.org')
-rw-r--r--org/meta_read_source_files.org65
1 files changed, 57 insertions, 8 deletions
diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org
index b4b4d69..69d70d7 100644
--- a/org/meta_read_source_files.org
+++ b/org/meta_read_source_files.org
@@ -45,10 +45,45 @@ module sdp.meta.read_config_files;
#+name: meta_config_file_in
#+BEGIN_SRC d
-static template configIn() {
+static template configInSite() {
<<imports_std>>
- final string configIn(M,E,C)(M manifest, E env, C conf_sdl) {
- auto possible_config_path_locations = ConfigFilePaths!()(manifest, env).possible_config_path_locations;
+ final string configInSite(M,E,C)(M manifest, E env, C conf_sdl) {
+ auto possible_config_path_locations = ConfigFilePaths!()(manifest, env).possible_config_path_locations_local_site;
+ string config_file_str;
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = format(
+ "%s/%s",
+ pth,
+ conf_sdl,
+ );
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ debug(configfile) {
+ writeln(conf_file);
+ }
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ catch (ErrnoException ex) {
+ }
+ catch (FileException ex) {
+ }
+ }
+ return config_file_str;
+ }
+}
+#+END_SRC
+
+#+name: meta_config_file_in
+#+BEGIN_SRC d
+static template configInDoc() {
+ <<imports_std>>
+ final string configInDoc(M,E,C)(M manifest, E env, C conf_sdl) {
+ auto possible_config_path_locations = ConfigFilePaths!()(manifest, env).possible_config_path_locations_document;
string config_file_str;
foreach(pth; possible_config_path_locations) {
auto conf_file = format(
@@ -116,10 +151,15 @@ auto ConfigSDLang(string configuration, string conf_sdl_filename) {
#+BEGIN_SRC d
/+
+/
-static template configRead() {
+static template configReadSite() {
<<imports_std>>
<<meta_config_file_import_sdlang>>
- <<meta_config_file_sdlang_hub>>
+ <<meta_config_file_sdlang_hub_site>>
+}
+static template configReadDoc() {
+ <<imports_std>>
+ <<meta_config_file_import_sdlang>>
+ <<meta_config_file_sdlang_hub_doc>>
}
#+END_SRC
@@ -133,10 +173,19 @@ import sdlang;
Read in sdl config file name given, and return sdl root
-#+name: meta_config_file_sdlang_hub
+#+name: meta_config_file_sdlang_hub_site
+#+BEGIN_SRC d
+final auto configReadSite(M,E,C)(M manifest, E env, C conf_sdl) {
+ auto configuration = configInSite!()(manifest, env, conf_sdl);
+ auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
+ return sdl_root;
+}
+#+END_SRC
+
+#+name: meta_config_file_sdlang_hub_doc
#+BEGIN_SRC d
-final auto configRead(M,E,C)(M manifest, E env, C conf_sdl) {
- auto configuration = configIn!()(manifest, env, conf_sdl);
+final auto configReadDoc(M,E,C)(M manifest, E env, C conf_sdl) {
+ auto configuration = configInDoc!()(manifest, env, conf_sdl);
auto sdl_root = ConfigSDLang!()(configuration, conf_sdl);
return sdl_root;
}