diff --git a/Cargo.lock b/Cargo.lock index c94fb73..b2106f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,526 +2,14 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - [[package]] name = "char" version = "0.1.0" -dependencies = [ - "clap", - "color-eyre", - "eyre", - "serde", - "toml", -] [[package]] -name = "clap" -version = "4.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec7a4128863c188deefe750ac1d1dfe66c236909f845af04beed823638dc1b2" -dependencies = [ - "bitflags", - "clap_lex", - "is-terminal", - "strsim", - "termcolor", -] - -[[package]] -name = "clap_lex" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" -dependencies = [ - "os_str_bytes", -] - -[[package]] -name = "color-eyre" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" -dependencies = [ - "backtrace", - "color-spantrace", - "eyre", - "indenter", - "once_cell", - "owo-colors", - "tracing-error", -] - -[[package]] -name = "color-spantrace" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" -dependencies = [ - "once_cell", - "owo-colors", - "tracing-core", - "tracing-error", -] - -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "eyre" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" -dependencies = [ - "indenter", - "once_cell", -] - -[[package]] -name = "gimli" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "is-terminal" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "object" -version = "0.30.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c786513eb403643f2a88c244c2aaa270ef2153f55094587d0c48a3cf22a83" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "os_str_bytes" -version = "6.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" - -[[package]] -name = "owo-colors" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "proc-macro2" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustix" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "indexmap", - "serde", -] - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-error" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" -dependencies = [ - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" -dependencies = [ - "sharded-slab", - "thread_local", - "tracing-core", -] - -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "valuable" +name = "char_cli" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +name = "char_sdk" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 4bf12b8..1fa2744 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,7 @@ -[package] -name = "char" -version = "0.1.0" -edition = "2021" +[workspace] +members = ["examples/service/char", "crates/char_cli", "crates/char_sdk"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -clap = "4.1.1" -color-eyre = "0.6.2" -eyre = "0.6.8" -serde = { version = "1.0.152", features = ["derive"] } -toml = { version = "0.5.11", features = ["preserve_order"] } +[workspace.dependencies] +eyre = "*" +color-eyre = "*" +tokio = { version = "*", features = "full" } diff --git a/examples/service/char/actions/Cargo.toml b/crates/char_cli/Cargo.toml similarity index 89% rename from examples/service/char/actions/Cargo.toml rename to crates/char_cli/Cargo.toml index c490469..fca88ff 100644 --- a/examples/service/char/actions/Cargo.toml +++ b/crates/char_cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "actions" +name = "char_cli" version = "0.1.0" edition = "2021" diff --git a/examples/service/char/actions/src/main.rs b/crates/char_cli/src/main.rs similarity index 100% rename from examples/service/char/actions/src/main.rs rename to crates/char_cli/src/main.rs diff --git a/crates/char_sdk/Cargo.toml b/crates/char_sdk/Cargo.toml new file mode 100644 index 0000000..6440b16 --- /dev/null +++ b/crates/char_sdk/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "char_sdk" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/char_sdk/src/lib.rs b/crates/char_sdk/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/char_sdk/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/examples/service/char.toml b/examples/service/char.toml index caa8599..b5fac91 100644 --- a/examples/service/char.toml +++ b/examples/service/char.toml @@ -1,2 +1,8 @@ [char] plan = "plans/base/" + +[config.docker] +something = "something" + +[config.k8s] +something = "else" diff --git a/examples/service/char/overrides/org/Cargo.lock b/examples/service/char/Cargo.lock similarity index 90% rename from examples/service/char/overrides/org/Cargo.lock rename to examples/service/char/Cargo.lock index 1a122d3..34a89a8 100644 --- a/examples/service/char/overrides/org/Cargo.lock +++ b/examples/service/char/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "org" +name = "char" version = "0.1.0" diff --git a/examples/service/char/overrides/org/Cargo.toml b/examples/service/char/Cargo.toml similarity index 91% rename from examples/service/char/overrides/org/Cargo.toml rename to examples/service/char/Cargo.toml index 30ccb78..dbd975c 100644 --- a/examples/service/char/overrides/org/Cargo.toml +++ b/examples/service/char/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "org" +name = "char" version = "0.1.0" edition = "2021" diff --git a/examples/service/char/actions/Cargo.lock b/examples/service/char/actions/Cargo.lock deleted file mode 100644 index 24e654c..0000000 --- a/examples/service/char/actions/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "actions" -version = "0.1.0" diff --git a/examples/service/char/config/k8s/overrides/deployment.labels.yaml b/examples/service/char/config/k8s/overrides/deployment.labels.yaml deleted file mode 100644 index e69de29..0000000 diff --git a/examples/service/char/overrides/org/char.toml b/examples/service/char/overrides/org/char.toml deleted file mode 100644 index e69de29..0000000 diff --git a/examples/service/char/overrides/org/src/main.rs b/examples/service/char/overrides/org/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/examples/service/char/overrides/org/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/examples/service/char/overrides/org/target/.rustc_info.json b/examples/service/char/overrides/org/target/.rustc_info.json deleted file mode 100644 index 4201b96..0000000 --- a/examples/service/char/overrides/org/target/.rustc_info.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc_fingerprint":7678195607898329254,"outputs":{"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/kah/.rustup/toolchains/nightly-aarch64-apple-darwin\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"llvm14-builtins-abi\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"v8.1a\"\ntarget_feature=\"v8.2a\"\ntarget_feature=\"v8.3a\"\ntarget_feature=\"v8.4a\"\ntarget_feature=\"vh\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.69.0-nightly (1e225413a 2023-01-28)\nbinary: rustc\ncommit-hash: 1e225413a21fa69570bd3fefea9eb05e33f8b917\ncommit-date: 2023-01-28\nhost: aarch64-apple-darwin\nrelease: 1.69.0-nightly\nLLVM version: 15.0.7\n","stderr":""},"15697416045686424142":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/examples/service/char/overrides/org/target/CACHEDIR.TAG b/examples/service/char/overrides/org/target/CACHEDIR.TAG deleted file mode 100644 index 20d7c31..0000000 --- a/examples/service/char/overrides/org/target/CACHEDIR.TAG +++ /dev/null @@ -1,3 +0,0 @@ -Signature: 8a477f597d28d172789f06886806bc55 -# This file is a cache directory tag created by cargo. -# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/examples/service/char/overrides/org/target/debug/.cargo-lock b/examples/service/char/overrides/org/target/debug/.cargo-lock deleted file mode 100644 index e69de29..0000000 diff --git a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org b/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org deleted file mode 100644 index de7eb56..0000000 --- a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org +++ /dev/null @@ -1 +0,0 @@ -baa57697ce65b314 \ No newline at end of file diff --git a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org.json b/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org.json deleted file mode 100644 index 20db5fd..0000000 --- a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/bin-org.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":15520539443732555526,"features":"[]","target":10808372008975436347,"profile":11736316127369858332,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/org-2413d5d1cd4f3ae1/dep-bin-org"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/dep-bin-org b/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/dep-bin-org deleted file mode 100644 index 5fdf103..0000000 Binary files a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/dep-bin-org and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/invoked.timestamp b/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/invoked.timestamp deleted file mode 100644 index e00328d..0000000 --- a/examples/service/char/overrides/org/target/debug/.fingerprint/org-2413d5d1cd4f3ae1/invoked.timestamp +++ /dev/null @@ -1 +0,0 @@ -This file has an mtime of when this was started. \ No newline at end of file diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1 b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1 deleted file mode 100755 index e7e0bf5..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1 and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.1w2z6si1c78oik0a.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.1w2z6si1c78oik0a.rcgu.o deleted file mode 100644 index 06e3fd5..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.1w2z6si1c78oik0a.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.2u6b3bnzksywvoky.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.2u6b3bnzksywvoky.rcgu.o deleted file mode 100644 index fd77fcb..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.2u6b3bnzksywvoky.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4del500vgawfjj37.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4del500vgawfjj37.rcgu.o deleted file mode 100644 index 93d6f9b..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4del500vgawfjj37.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4lq6r8x3cp8dva9q.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4lq6r8x3cp8dva9q.rcgu.o deleted file mode 100644 index 85bd94c..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.4lq6r8x3cp8dva9q.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.58wq04ql52udmnzm.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.58wq04ql52udmnzm.rcgu.o deleted file mode 100644 index 3d13512..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.58wq04ql52udmnzm.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.8z2yuh0zif7dcra.rcgu.o b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.8z2yuh0zif7dcra.rcgu.o deleted file mode 100644 index 6c2fab3..0000000 Binary files a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.8z2yuh0zif7dcra.rcgu.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.d b/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.d deleted file mode 100644 index e9c7504..0000000 --- a/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.d +++ /dev/null @@ -1,5 +0,0 @@ -/Users/kah/git/git.front.kjuulh.io/kjuulh/char/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1: src/main.rs - -/Users/kah/git/git.front.kjuulh.io/kjuulh/char/examples/service/char/overrides/org/target/debug/deps/org-2413d5d1cd4f3ae1.d: src/main.rs - -src/main.rs: diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/1w2z6si1c78oik0a.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/1w2z6si1c78oik0a.o deleted file mode 100644 index 06e3fd5..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/1w2z6si1c78oik0a.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/2u6b3bnzksywvoky.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/2u6b3bnzksywvoky.o deleted file mode 100644 index fd77fcb..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/2u6b3bnzksywvoky.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4del500vgawfjj37.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4del500vgawfjj37.o deleted file mode 100644 index 93d6f9b..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4del500vgawfjj37.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4lq6r8x3cp8dva9q.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4lq6r8x3cp8dva9q.o deleted file mode 100644 index 85bd94c..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/4lq6r8x3cp8dva9q.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/58wq04ql52udmnzm.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/58wq04ql52udmnzm.o deleted file mode 100644 index 3d13512..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/58wq04ql52udmnzm.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/8z2yuh0zif7dcra.o b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/8z2yuh0zif7dcra.o deleted file mode 100644 index 6c2fab3..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/8z2yuh0zif7dcra.o and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/dep-graph.bin b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/dep-graph.bin deleted file mode 100644 index 0d8df4d..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/dep-graph.bin and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/query-cache.bin b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/query-cache.bin deleted file mode 100644 index 36ea7f1..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/query-cache.bin and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/work-products.bin b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/work-products.bin deleted file mode 100644 index 89ee29a..0000000 Binary files a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg-3oj91h4eqnbes/work-products.bin and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg.lock b/examples/service/char/overrides/org/target/debug/incremental/org-1npv43fgy6vrd/s-ghi74jqbm5-9w5ssg.lock deleted file mode 100755 index e69de29..0000000 diff --git a/examples/service/char/overrides/org/target/debug/org b/examples/service/char/overrides/org/target/debug/org deleted file mode 100755 index e7e0bf5..0000000 Binary files a/examples/service/char/overrides/org/target/debug/org and /dev/null differ diff --git a/examples/service/char/overrides/org/target/debug/org.d b/examples/service/char/overrides/org/target/debug/org.d deleted file mode 100644 index 66f41cb..0000000 --- a/examples/service/char/overrides/org/target/debug/org.d +++ /dev/null @@ -1 +0,0 @@ -/Users/kah/git/git.front.kjuulh.io/kjuulh/char/examples/service/char/overrides/org/target/debug/org: /Users/kah/git/git.front.kjuulh.io/kjuulh/char/examples/service/char/overrides/org/src/main.rs diff --git a/examples/service/char/src/main.rs b/examples/service/char/src/main.rs new file mode 100644 index 0000000..d72f146 --- /dev/null +++ b/examples/service/char/src/main.rs @@ -0,0 +1,14 @@ +struct Run; +impl char::Action for Run {} + +struct Build; +impl char::Action for Build {} + +fn main() { + char::new() + .add_context(char::dagger::Context::default()) + .add_action(Run {}) + .add_action(Build {}) + .add_plugin(char::std::k8s::Context::default()) + .execute(); +} diff --git a/src/cli.rs b/src/cli.rs deleted file mode 100644 index 0b8dc70..0000000 --- a/src/cli.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::path::PathBuf; - -use crate::{ - deps, - resolvers::{install, Resolver}, -}; - -pub struct Cli { - deps: deps::Deps, - install: Box, -} - -impl Cli { - pub fn new(deps: deps::Deps) -> eyre::Result { - Ok(Self { - deps: deps.clone(), - install: install::Install::new(deps), - }) - } - - pub fn matches(self, args: &[&str]) -> eyre::Result<()> { - let mut cli = clap::Command::new("char") - .arg(clap::Arg::new("path").long("path").short('p')) - .subcommand(self.install.cmd()?); - - let matches = cli.clone().get_matches_from(args); - - let path = matches.get_one::("path"); - if let Some(p) = path { - let path = PathBuf::from(p); - if !path.exists() { - eyre::bail!("no char.toml exists at --path") - } - self.deps.parser.set_path(path); - } - - match matches.subcommand() { - Some(("install", args)) => self.install.matches(args)?, - _ => cli.print_help()?, - } - - Ok(()) - } -} diff --git a/src/context/mod.rs b/src/context/mod.rs deleted file mode 100644 index d057c6d..0000000 --- a/src/context/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::models::Char; - -pub struct Context {} - -impl Context { - pub fn new(chars: Vec) -> Self { - Self {} - } -} - -pub struct ContextBuilder { - chars: Vec, -} - -impl ContextBuilder { - pub fn new() -> Self { - Self { chars: vec![] } - } - - pub fn add_char(mut self, char: &Char) -> Self { - self.chars.push(char.clone()); - - self - } - - pub fn build(self) -> Context { - Context::new(self.chars) - } -} diff --git a/src/deps.rs b/src/deps.rs deleted file mode 100644 index 2633d27..0000000 --- a/src/deps.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::{ops::Deref, sync::Arc}; - -use crate::{parser::Parser, services::downloader::Downloader}; - -#[derive(Debug, Clone)] -pub struct Deps { - inner: Arc, -} - -#[derive(Debug, Clone)] -pub struct InnerDeps { - pub parser: Parser, - pub downloader: Downloader, -} - -impl Default for Deps { - fn default() -> Self { - let parser = Parser::default(); - let downloader = Downloader::new(parser.clone()); - - Self { - inner: Arc::new(InnerDeps { parser, downloader }), - } - } -} - -impl Deref for Deps { - type Target = Arc; - - fn deref(&self) -> &Self::Target { - &self.inner - } -} diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 53a5fbc..0000000 --- a/src/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -pub mod cli; -mod context; -mod deps; -mod models; -mod parser; -mod resolvers; -mod services; - -fn main() -> eyre::Result<()> { - color_eyre::install()?; - - let args = std::env::args(); - - let deps = deps::Deps::default(); - - let c = cli::Cli::new(deps)?; - c.matches( - args.collect::>() - .iter() - .map(|s| s.as_str()) - .collect::>() - .as_slice(), - )?; - - let p = std::path::PathBuf::from("examples/service/char.toml"); - - let char = std::fs::read_to_string(p)?.parse::()?; - - dbg!(char); - - Ok(()) -} diff --git a/src/models.rs b/src/models.rs deleted file mode 100644 index bb2b041..0000000 --- a/src/models.rs +++ /dev/null @@ -1,48 +0,0 @@ -use std::collections::BTreeMap; - -use serde::{Deserialize, Serialize}; - -type Overrides = BTreeMap; -type Dependencies = Vec; - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct Conf { - pub plan: String, - pub dependencies: Option, - pub overrides: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct Application { - name: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct Plan { - name: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(untagged)] -pub enum Char { - Application { - char: Option, - application: Application, - config: BTreeMap, - }, - Plan { - char: Option, - plan: Plan, - config: BTreeMap, - }, -} - -impl std::str::FromStr for Char { - type Err = eyre::Error; - - fn from_str(s: &str) -> Result { - let t: Char = toml::from_str(s)?; - - Ok(t) - } -} diff --git a/src/parser.rs b/src/parser.rs deleted file mode 100644 index e5c2799..0000000 --- a/src/parser.rs +++ /dev/null @@ -1,62 +0,0 @@ -use std::{ - path::PathBuf, - sync::{Arc, RwLock}, -}; - -use eyre::Context; - -use crate::models::{self, Char}; - -#[derive(Debug, Clone)] -pub struct Parser { - path: Arc>>, -} - -impl Parser { - pub fn new(path: PathBuf) -> Self { - Self { - path: Arc::new(RwLock::new(Some(path))), - } - } - - pub fn set_path(&self, path: PathBuf) { - let mut writer = self.path.write().unwrap(); - *writer = Some(path); - } - - pub fn get_path(&self) -> eyre::Result { - let read_path = self.path.read().unwrap(); - let path = match read_path.clone() { - Some(p) => p, - None => todo!(), // find using git later on - }; - - Ok(path) - } - - pub fn parse(&self) -> eyre::Result { - let mut path = self.get_path()?; - if !path.ends_with("char.toml") { - path.push("char.toml") - } - let contents = - std::fs::read_to_string(&path).context("char.toml doesn't exist at that path")?; - - contents.parse::() - } - - pub fn parse_from(&self, path: &PathBuf) -> eyre::Result { - let contents = - std::fs::read_to_string(path).context("char.toml doesn't exist at that path")?; - - contents.parse::() - } -} - -impl Default for Parser { - fn default() -> Self { - Self { - path: Arc::new(RwLock::new(None)), - } - } -} diff --git a/src/resolvers/install.rs b/src/resolvers/install.rs deleted file mode 100644 index 88c512b..0000000 --- a/src/resolvers/install.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::deps; - -use super::{DynResolver, Resolver}; - -#[allow(dead_code)] -#[derive(Debug, Clone)] -pub struct Install { - deps: deps::Deps, -} - -impl Install { - pub fn new(deps: deps::Deps) -> DynResolver { - Box::new(Self { deps }) - } -} - -impl Resolver for Install { - fn cmd(&self) -> eyre::Result { - let install = clap::Command::new("install"); - - Ok(install) - } - - fn matches(&self, _args: &clap::ArgMatches) -> eyre::Result<()> { - self.deps.downloader.download()?; - - Ok(()) - } -} diff --git a/src/resolvers/mod.rs b/src/resolvers/mod.rs deleted file mode 100644 index d339f67..0000000 --- a/src/resolvers/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub(crate) mod install; - -pub trait Resolver { - fn cmd(&self) -> eyre::Result; - fn matches(&self, args: &clap::ArgMatches) -> eyre::Result<()>; -} - -pub type DynResolver = Box; diff --git a/src/services/downloader.rs b/src/services/downloader.rs deleted file mode 100644 index 6a84500..0000000 --- a/src/services/downloader.rs +++ /dev/null @@ -1,96 +0,0 @@ -use std::{fs::canonicalize, path::PathBuf}; - -use crate::{ - context::{Context, ContextBuilder}, - models::{Char, Conf}, - parser::Parser, -}; - -#[derive(Debug, Clone)] -pub struct Downloader { - parser: Parser, -} -#[allow(dead_code)] -impl Downloader { - pub fn new(parser: Parser) -> Self { - Self { parser } - } - - /// Unfolds char - /// 1. Download path - /// 2. Parse char in downloaded path - /// 3. Repeat from 1. until there are no more parents - pub fn download(&self) -> eyre::Result { - let mut context_builder = ContextBuilder::new(); - - let char = self.parser.parse()?; - context_builder = context_builder.add_char(&char); - let first_char_path = self.parser.get_path()?; - - let mut root = std::env::current_dir()?; - root = root.join(&first_char_path); - root.push(".char"); - let output = self.create_output_dir(&root)?; - - let mut parent_char = char; - let path = first_char_path; - loop { - parent_char = match &parent_char { - Char::Application { - char, - application: _, - config: _, - } => match char { - Some(c) => self.download_plan(c, &path, &output)?, - None => { - break; - } - }, - Char::Plan { - char, - plan: _, - config: _, - } => match char { - Some(_c) => todo!(), - None => { - break; - } - }, - } - } - - Ok(context_builder.build()) - } - - fn download_plan( - &self, - conf: &Conf, - path: &PathBuf, - output_path: &PathBuf, - ) -> eyre::Result { - let plan = &conf.plan; - - // TODO: decide whether it is a file or a git repo - // TODO: Starting with files only, as such implement git repo later - - let path_buf = std::path::PathBuf::from(plan); - let path = path.join(path_buf); - if !path.exists() { - eyre::bail!("path doesn't exist: {}", path.to_string_lossy()) - } - let path = canonicalize(path)?; - - dbg!(path); - dbg!(output_path); - - todo!() - } - - fn create_output_dir(&self, root: &PathBuf) -> eyre::Result { - let mut output = root.clone(); - output.push("plans"); - std::fs::create_dir_all(&output)?; - - Ok(output) - } -} diff --git a/src/services/mod.rs b/src/services/mod.rs deleted file mode 100644 index acb5733..0000000 --- a/src/services/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod downloader;