diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-12-15 14:06:16 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 2e852762085122d1b36641a04bcc63d5235139cd (patch) | |
tree | b0f039492688fc0604f98ff4eb588deb266f1e0d /src/sdp/output | |
parent | 0.23.1 use output path specified if any (diff) |
0.23.2 config paths for pod
Diffstat (limited to 'src/sdp/output')
-rw-r--r-- | src/sdp/output/paths_source.d | 87 | ||||
-rw-r--r-- | src/sdp/output/rgx.d | 2 | ||||
-rw-r--r-- | src/sdp/output/source_sisupod.d | 4 |
3 files changed, 68 insertions, 25 deletions
diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d index 0a8b447..4f8eb54 100644 --- a/src/sdp/output/paths_source.d +++ b/src/sdp/output/paths_source.d @@ -117,9 +117,16 @@ template PodMatters() { ) { _output_path = asNormalizedPath(_opt_actions.output_dir_set).array; if (!exists(_output_path)) { - _output_path.mkdirRecurse; + try { + _output_path.mkdirRecurse; + } + catch (Exception ex) { + // Handle error + } } - assert(_output_path.isDir); + assert(_output_path.isDir, + "not a directory: " ~ _output_path); + // TODO always test that is a directory and it is writable } return _output_path; } @@ -144,34 +151,70 @@ template PodMatters() { template ConfigFilePaths() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto ConfigFilePaths(E)( + auto ConfigFilePaths(M,E)( + M _manifest, E _env, ) { struct ConfFilePaths { auto possible_config_path_locations() { /+ FIX clean up conf paths ↓ +/ - string _sisudoc_conf_pwd = chainPath(to!string(_env["pwd"]), "sisudoc/conf").array; - string _sisudoc_conf_pwd_a = chainPath(to!string(_env["pwd"]), "conf").array; - string _sisudoc_conf_pwd_b = chainPath(to!string(_env["pwd"]), "../conf").array; - string _sisudoc_conf_pwd_c = chainPath(to!string(_env["pwd"]), "../../conf").array; - string _sisudoc_conf_pwd_d = chainPath(to!string(_env["pwd"]), "../../../conf").array; + /+ config local site (file system only, not in pod) +/ + string _dot_pwd; + string _underscore_pwd; + string _dot_home; + /+ config document (& or local site) on filesystem +/ + string _sisudoc_conf_pwd; // think about + string _sisudoc_conf_pwd_a; + string _sisudoc_conf_pwd_b; + string _sisudoc_conf_pwd_c; + string _sisudoc_conf_pwd_d; + /+ config document in pod +/ + string _sisudoc_conf_pod; + string _sisudoc_conf_pod_text; + /+ return paths +/ + string[] _possible_config_path_locations; + if (_manifest.is_pod) { + /+ config document in pod +/ + _sisudoc_conf_pod = asNormalizedPath(chainPath( + to!string(_env["pwd"]), + _manifest.pod_manifest_path ~ "/conf" + )).array; + _sisudoc_conf_pod_text = asNormalizedPath(chainPath( + to!string(_env["pwd"]), + _manifest.pod_manifest_path ~ "/media/text/" ~ _manifest.src_lng ~ "/conf" + )).array; + /+ return paths +/ + _possible_config_path_locations = [ + _sisudoc_conf_pod_text, + _sisudoc_conf_pod, + ]; + } else { + /+ config local site (file system only, not in pod) +/ + _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array; + _underscore_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "_sisu")).array; + _dot_home = asNormalizedPath(chainPath(to!string(_env["home"]), ".sisu")).array; + /+ config document (& or local site) on filesystem +/ + _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about + _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array; + _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array; + _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array; + _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array; + /+ return paths +/ + _possible_config_path_locations = [ + _sisudoc_conf_pwd, + _sisudoc_conf_pwd_a, + _sisudoc_conf_pwd_b, + _sisudoc_conf_pwd_c, + _sisudoc_conf_pwd_d, + _dot_pwd, + _underscore_pwd, + _dot_home, + "/etc/sisu" + ]; + } /+ FIX clean up conf paths ↑ (compare pwd to doc path location, and build config path) +/ - string _dot_pwd = chainPath(to!string(_env["pwd"]), ".sisu").array; - string _underscore_pwd = chainPath(to!string(_env["pwd"]), "_sisu").array; - string _dot_home = chainPath(to!string(_env["home"]), ".sisu").array; - string[] _possible_config_path_locations = [ - _sisudoc_conf_pwd, - _sisudoc_conf_pwd_a, - _sisudoc_conf_pwd_b, - _sisudoc_conf_pwd_c, - _sisudoc_conf_pwd_d, - _dot_pwd, - _underscore_pwd, - _dot_home, - "/etc/sisu" - ]; return _possible_config_path_locations; } } diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d index 9daaa3b..3e03620 100644 --- a/src/sdp/output/rgx.d +++ b/src/sdp/output/rgx.d @@ -15,7 +15,7 @@ static template SiSUoutputRgxInit() { static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); static nbsp_and_space = ctRegex!(` [ ]`, "mg"); static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); - static src_pth = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`); + static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])$`); static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+)/sisupod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?P<path>media/text/[a-z]{2}/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d index 20eaf39..0d529b6 100644 --- a/src/sdp/output/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -190,7 +190,7 @@ template SiSUpod() { catch (ZipException ex) { // Handle errors } - if (doc_matters.source_filename == "sisudoc/text/en/the_wealth_of_networks.yochai_benkler.sst") { + if (doc_matters.source_filename == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") { assert( ((data).sha256Of).toHexString == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E", @@ -200,7 +200,7 @@ template SiSUpod() { ~ ((data).sha256Of).toHexString ); } - if (doc_matters.source_filename == "sisudoc/text/en/sisu_markup_stress_test.sst") { + if (doc_matters.source_filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") { assert( ((data).sha256Of).toHexString == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91", |