From 51fd56020424dcca50c4b8cfb3877640a6a9656b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 16 Dec 2017 17:18:01 -0500 Subject: target config file locations, refine --- org/default_paths.org | 14 ++++++++++++-- org/meta_read_source_files.org | 36 ++++++++++++++++++------------------ org/sdp.org | 15 +++++++++------ 3 files changed, 39 insertions(+), 26 deletions(-) (limited to 'org') diff --git a/org/default_paths.org b/org/default_paths.org index 93711dc..dfaf362 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -135,12 +135,16 @@ template PodMatters() { string[] _image_dirs; return _image_dirs; } - auto src_fn() { + auto src_path_and_fn() { return _fns; } + auto src_fn() { + auto _fn = (src_path_and_fn).match(rgx.src_pth_sst_or_ssm).captures["filename"]; + return _fn; + } auto src_lng() { string _k; - if (auto m = (src_fn).match(rgx.language_code_and_filename)) { + if (auto m = (src_path_and_fn).match(rgx.language_code_and_filename)) { _k = m.captures[1]; } else { _k = "en"; @@ -199,6 +203,9 @@ template ConfigFilePaths() { E _env, ) { struct ConfFilePaths { + auto config_filename_document() { + return "config_document"; + } auto possible_config_path_locations_document() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ @@ -242,6 +249,9 @@ template ConfigFilePaths() { +/ return _possible_config_path_locations; } + auto config_filename_site() { + return "config_local_site"; + } auto possible_config_path_locations_local_site() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org index 69d70d7..3c92560 100644 --- a/org/meta_read_source_files.org +++ b/org/meta_read_source_files.org @@ -47,15 +47,13 @@ module sdp.meta.read_config_files; #+BEGIN_SRC d static template configInSite() { <> - 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; + final string configInSite(M,E)(M manifest, E env) { + auto conf_file_details = ConfigFilePaths!()(manifest, env); + string conf_sdl = conf_file_details.config_filename_site; + auto possible_config_path_locations = conf_file_details.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, - ); + auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; if (config_file_str.length > 0) { break; } @@ -82,15 +80,13 @@ static template configInSite() { #+BEGIN_SRC d static template configInDoc() { <> - 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; + final string configInDoc(M,E)(M manifest, E env) { + auto conf_file_details = ConfigFilePaths!()(manifest, env); + string conf_sdl = conf_file_details.config_filename_document; + auto possible_config_path_locations = conf_file_details.possible_config_path_locations_document; string config_file_str; foreach(pth; possible_config_path_locations) { - auto conf_file = format( - "%s/%s", - pth, - conf_sdl, - ); + auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; if (config_file_str.length > 0) { break; } @@ -175,8 +171,10 @@ Read in sdl config file name given, and return sdl root #+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); +final auto configReadSite(M,E)(M manifest, E env) { + auto configuration = configInSite!()(manifest, env); + auto conf_file_details = ConfigFilePaths!()(manifest, env); + string conf_sdl = conf_file_details.config_filename_site; auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); return sdl_root; } @@ -184,8 +182,10 @@ final auto configReadSite(M,E,C)(M manifest, E env, C conf_sdl) { #+name: meta_config_file_sdlang_hub_doc #+BEGIN_SRC d -final auto configReadDoc(M,E,C)(M manifest, E env, C conf_sdl) { - auto configuration = configInDoc!()(manifest, env, conf_sdl); +final auto configReadDoc(M,E)(M manifest, E env) { + auto configuration = configInDoc!()(manifest, env); + auto conf_file_details = ConfigFilePaths!()(manifest, env); + string conf_sdl = conf_file_details.config_filename_document; auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); return sdl_root; } diff --git a/org/sdp.org b/org/sdp.org index 011fd85..d874489 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -492,9 +492,10 @@ foreach(arg; args[1..$]) { _manifest_start = PodManifest!()(arg); if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt - } else if (arg.match(rgx.src_pth_sst_or_ssm)) { - _manifests ~= PodMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing - } else if (_manifest_start.pod_manifest_file_with_path) { + } else if ( + !(arg.match(rgx.src_pth_sst_or_ssm)) + && _manifest_start.pod_manifest_file_with_path + ) { string contents_location_raw_; string contents_location_; string sisudoc_txt_ = _manifest_start.pod_manifest_file_with_path; @@ -540,6 +541,8 @@ foreach(arg; args[1..$]) { _manifests ~= _manifest_matter; // TODO how to capture? } } + } else if (arg.match(rgx.src_pth_sst_or_ssm)) { + _manifests ~= PodMatters!()(_opt_action, _env, arg, arg); // gather input markup source file names for processing } else if (arg.match(rgx.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused @@ -552,8 +555,8 @@ foreach(arg; args[1..$]) { #+NAME: sdp_conf_files #+BEGIN_SRC d -auto sdl_root_config_document = configReadDoc!()(_manifest, _env, "config_document"); // document config file -auto sdl_root_config_local_site = configReadSite!()(_manifest, _env, "config_local_site"); // local site config +auto sdl_root_config_document = configReadDoc!()(_manifest, _env); // document config file +auto sdl_root_config_local_site = configReadSite!()(_manifest, _env); // local site config auto conf_files_composite_make = confFilesSDLtoStruct!()(sdl_root_config_document, sdl_root_config_local_site); #+END_SRC @@ -733,7 +736,7 @@ debug(steps) { ); } auto _header_body_insertfilelist_imagelist = - SiSUrawMarkupContent!()(_opt_action, _manifest.src_fn); + SiSUrawMarkupContent!()(_opt_action, _manifest.src_path_and_fn); static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); static assert(_header_body_insertfilelist_imagelist.length==4); debug(steps) { -- cgit v1.2.3