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 --- org/default_paths.org | 71 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 13 deletions(-) (limited to 'org/default_paths.org') diff --git a/org/default_paths.org b/org/default_paths.org index 5334a78..914703c 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -60,9 +60,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; @@ -86,7 +92,23 @@ template PodManifest() { } #+END_SRC -** _manifest and source files_ :manifest: +** _path matters (pod, manifest and source files)_ :manifest: + +tree sisupod +sisupod +└─ [sisudoc filename] + ├── conf + │   └── sisu_document_make + ├── media + │   ├── audio + │   ├── image + │   ├── text + │   │ └── en + │   │ ... + │  │  ├── [conf] + │   │ └── [image] + │   └── video + └── sisupod.manifest #+name: template_paths_src #+BEGIN_SRC d @@ -131,6 +153,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; } @@ -140,7 +171,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; } @@ -323,7 +358,7 @@ template PathMatters() { } #+END_SRC -** _config_ :config: +** _config_ (sisu_document_make & config_local_site) :config: #+name: template_paths_src #+BEGIN_SRC d @@ -335,12 +370,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 +/ @@ -383,10 +427,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; @@ -395,11 +436,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 +/ @@ -1004,7 +1049,7 @@ template SiSUpathsSQLiteDiscrete() { return fn_src.baseName.stripExtension; } string base() { - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; } string seg(string fn_src) { return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; -- cgit v1.2.3