From 1c73ddf3894085c646b55d63e61a2483e03a3b4d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 9 Feb 2018 22:03:10 -0500 Subject: 0.24.0 toml or sdlang for configuration --- src/sdp/output/paths_source.d | 49 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'src/sdp/output/paths_source.d') diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index 731fff3..3292e6f 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -29,9 +29,15 @@ template PodManifest() { && (_pth.chainPath(pod_manifest_filename).array).isFile)) { _manifest_path = _pth; } else if (_pth.match(rgx.src_pth_contents) - && exists(_pth)!=0 && _pth.isDir && (_pth.isFile)) { + && exists(_pth)!=0 && _pth.isDir) { _manifest_path = dirName(_pth); + } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm) + && exists(_pth)!=0 && (_pth.isFile)) { + if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) { + _manifest_path = m.captures["podpath"]; + } } else { + writeln("WARNING, issue with manifest_path: ", _pth); _manifest_path = _pth; // _manifest_path = null; } return _manifest_path; @@ -94,6 +100,15 @@ template PathMatters() { auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false; return _src_is_pod; } + auto collection_root() { + auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array; + if (auto m = (_collection_root).match(rgx.src_pth_pod_root)) { + // consider testing for last dir in path name being sisupod, and giving warning if not + } else { + writeln("WARNING, collection_root not named \"sisupod\""); + } + return _collection_root; + } auto manifest_filename() { return _manifest.pod_manifest_filename; } @@ -103,7 +118,11 @@ template PathMatters() { auto manifest_file_with_path() { return _manifest.pod_manifest_file_with_path; } - auto config_dirs() { // TODO + auto config_sisu_document_make_dirs() { // TODO sisu_document_make + string[] _config_dirs; + return _config_dirs; + } + auto config_local_site_dirs() { // TODO sisu_document_make string[] _config_dirs; return _config_dirs; } @@ -292,12 +311,21 @@ template ConfigFilePaths() { E _env, ) { struct ConfFilePaths { - auto config_filename_document() { - return "config_document"; + auto config_filename_document_sdl() { + return "sisu_document_make.sdl"; + } + auto config_filename_site_sdl() { + return "config_local_site.sdl"; + } + auto config_filename_document_toml() { + return "sisu_document_make.toml"; + } + auto config_filename_site_toml() { + return "config_local_site.toml"; } auto possible_config_path_locations() { struct _ConfFilePaths { - auto document() { + auto sisu_document_make() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ /+ return paths +/ @@ -340,10 +368,7 @@ template ConfigFilePaths() { +/ return _possible_config_path_locations; } - auto config_filename_site() { - return "config_local_site"; - } - auto local_site() { + auto config_local_site() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array; @@ -352,11 +377,15 @@ template ConfigFilePaths() { /+ return paths +/ string[] _possible_config_path_locations; if (_manifest.src.is_pod) { + string _collection_root_a = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), ".sisu")).array; + string _collection_root_b = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), "_sisu")).array; _possible_config_path_locations = [ _dot_pwd, _underscore_pwd, _dot_home, - "/etc/sisu" + "/etc/sisu", + _collection_root_a, // set priority higher? + _collection_root_b // set priority higher? ]; } else { /+ config document (& or local site) on filesystem +/ -- cgit v1.2.3