diff options
| author | Ralph Amissah <ralph@amissah.com> | 2017-12-16 17:18:01 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 | 
| commit | 51fd56020424dcca50c4b8cfb3877640a6a9656b (patch) | |
| tree | 052b45cb065e2edc6fdf470d2c09b84c21eb9937 | |
| parent | target different type of config file locations (diff) | |
target config file locations, refine
| -rw-r--r-- | org/default_paths.org | 14 | ||||
| -rw-r--r-- | org/meta_read_source_files.org | 36 | ||||
| -rw-r--r-- | org/sdp.org | 15 | ||||
| -rw-r--r-- | src/sdp/meta/metadoc.d | 6 | ||||
| -rw-r--r-- | src/sdp/meta/read_config_files.d | 36 | ||||
| -rw-r--r-- | src/sdp/output/paths_source.d | 14 | ||||
| -rwxr-xr-x | src/sdp/sdp.d | 9 | 
7 files changed, 78 insertions, 52 deletions
| 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() {    <<imports_std>> -  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() {    <<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; +  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) { diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d index eed9f55..44807b2 100644 --- a/src/sdp/meta/metadoc.d +++ b/src/sdp/meta/metadoc.d @@ -36,8 +36,8 @@ template SiSUabstraction() {      O _opt_action,      M _manifest,    ){ -    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);      /+ ↓ read file (filename with path) +/      /+ ↓ file tuple of header and content +/ @@ -47,7 +47,7 @@ template SiSUabstraction() {        );      }      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) { diff --git a/src/sdp/meta/read_config_files.d b/src/sdp/meta/read_config_files.d index d816619..57aba7f 100644 --- a/src/sdp/meta/read_config_files.d +++ b/src/sdp/meta/read_config_files.d @@ -10,15 +10,13 @@ static template configInSite() {      sdp.output.paths_source,      std.file,      std.path; -  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;        } @@ -45,15 +43,13 @@ static template configInDoc() {      sdp.output.paths_source,      std.file,      std.path; -  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;        } @@ -105,8 +101,10 @@ static template configReadSite() {      std.file,      std.path; -  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;    } @@ -118,8 +116,10 @@ static template configReadDoc() {      std.file,      std.path; -  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/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index b81448c..1330606 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -98,12 +98,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"; @@ -156,6 +160,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) +/ @@ -199,6 +206,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/src/sdp/sdp.d b/src/sdp/sdp.d index 418eb1f..8434841 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -309,9 +309,10 @@ void main(string[] args) {      _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; @@ -357,6 +358,8 @@ void main(string[] args) {            _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 | 
