From a4213ea61ff532bdf4917f5af642d1b85a624925 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Fri, 23 Aug 2024 21:51:42 +0200 Subject: [PATCH] feat: add bare Signed-off-by: kjuulh --- .drone.yml | 56 +- .env.ci | 2 - .gitignore | 3 +- Cargo.lock | 2505 +++++++---------- Cargo.toml | 16 +- LICENSE | 7 - README.md | 71 +- ci/Cargo.toml | 11 - ci/src/main.rs | 112 - crates/cuddle/.gitignore | 1 + crates/cuddle/Cargo.toml | 19 + crates/cuddle/src/main.rs | 29 + cuddle.yaml | 21 +- cuddle/Cargo.toml | 51 - cuddle/src/actions/mod.rs | 366 --- cuddle/src/actions/shell.rs | 62 - cuddle/src/cli/mod.rs | 413 --- cuddle/src/cli/subcommands/folder.rs | 169 -- cuddle/src/cli/subcommands/init.rs | 227 -- cuddle/src/cli/subcommands/kustomize.rs | 91 - cuddle/src/cli/subcommands/mod.rs | 7 - cuddle/src/cli/subcommands/render.rs | 34 - .../src/cli/subcommands/render_kustomize.rs | 70 - cuddle/src/cli/subcommands/render_template.rs | 153 - cuddle/src/cli/subcommands/x.rs | 89 - cuddle/src/config.rs | 28 - cuddle/src/context.rs | 211 -- cuddle/src/main.rs | 31 - cuddle/src/model.rs | 236 -- cuddle/src/util/git.rs | 33 - cuddle/src/util/mod.rs | 1 - examples/base/Cargo.toml | 8 - examples/base/cuddle.yaml | 8 - examples/base/scripts/build.sh | 3 - examples/base/src/main.rs | 3 - examples/templates/cuddle.yaml | 14 - .../templates/scripts/test_render_template.sh | 6 - examples/templates/templates/input.txt.tmpl | 3 - schemas/base.json | 135 - scripts/build_cuddle_image.sh | 16 - scripts/install.sh | 5 - templates/build_cuddle_image.Dockerfile | 38 - ...build_cuddle_image.Dockerfile.dockerignore | 3 - templates/docker-compose.yaml | 15 + 44 files changed, 1047 insertions(+), 4335 deletions(-) delete mode 100644 .env.ci delete mode 100644 LICENSE delete mode 100644 ci/Cargo.toml delete mode 100644 ci/src/main.rs create mode 100644 crates/cuddle/.gitignore create mode 100644 crates/cuddle/Cargo.toml create mode 100644 crates/cuddle/src/main.rs delete mode 100644 cuddle/Cargo.toml delete mode 100644 cuddle/src/actions/mod.rs delete mode 100644 cuddle/src/actions/shell.rs delete mode 100644 cuddle/src/cli/mod.rs delete mode 100644 cuddle/src/cli/subcommands/folder.rs delete mode 100644 cuddle/src/cli/subcommands/init.rs delete mode 100644 cuddle/src/cli/subcommands/kustomize.rs delete mode 100644 cuddle/src/cli/subcommands/mod.rs delete mode 100644 cuddle/src/cli/subcommands/render.rs delete mode 100644 cuddle/src/cli/subcommands/render_kustomize.rs delete mode 100644 cuddle/src/cli/subcommands/render_template.rs delete mode 100644 cuddle/src/cli/subcommands/x.rs delete mode 100644 cuddle/src/config.rs delete mode 100644 cuddle/src/context.rs delete mode 100644 cuddle/src/main.rs delete mode 100644 cuddle/src/model.rs delete mode 100644 cuddle/src/util/git.rs delete mode 100644 cuddle/src/util/mod.rs delete mode 100644 examples/base/Cargo.toml delete mode 100644 examples/base/cuddle.yaml delete mode 100755 examples/base/scripts/build.sh delete mode 100644 examples/base/src/main.rs delete mode 100644 examples/templates/cuddle.yaml delete mode 100755 examples/templates/scripts/test_render_template.sh delete mode 100644 examples/templates/templates/input.txt.tmpl delete mode 100644 schemas/base.json delete mode 100755 scripts/build_cuddle_image.sh delete mode 100755 scripts/install.sh delete mode 100644 templates/build_cuddle_image.Dockerfile delete mode 100644 templates/build_cuddle_image.Dockerfile.dockerignore create mode 100644 templates/docker-compose.yaml diff --git a/.drone.yml b/.drone.yml index 4d1e489..77bff5c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,54 +1,2 @@ -kind: pipeline -name: default -type: docker - -steps: - - name: load_secret - image: debian:buster-slim - volumes: - - name: ssh - path: /root/.ssh/ - environment: - SSH_KEY: - from_secret: gitea_id_ed25519 - commands: - - mkdir -p $HOME/.ssh/ - - echo "$SSH_KEY" | base64 -d > $HOME/.ssh/id_ed25519 - - - name: build - image: kasperhermansen/cuddle:latest - pull: always - volumes: - - name: ssh - path: /root/.ssh/ - - name: dockersock - path: /var/run - commands: - - eval `ssh-agent` - - chmod -R 600 ~/.ssh - - ssh-add - - cuddle x build_cuddle_image - environment: - DOCKER_BUILDKIT: 1 - CUDDLE_SECRETS_PROVIDER: 1password - CUDDLE_ONE_PASSWORD_DOT_ENV: ".env.ci" - CUDDLE_SSH_AGENT: "true" - OP_SERVICE_ACCOUNT_TOKEN: - from_secret: op_service_account_token - - depends_on: - - "load_secret" - -services: -- name: docker - image: docker:dind - privileged: true - volumes: - - name: dockersock - path: /var/run - -volumes: - - name: ssh - temp: {} - - name: dockersock - temp: {} +kind: template +load: cuddle-rust-cli-plan.yaml diff --git a/.env.ci b/.env.ci deleted file mode 100644 index 9e8a520..0000000 --- a/.env.ci +++ /dev/null @@ -1,2 +0,0 @@ -DOCKER_USERNAME={{ op://application/docker_hub_credentials/username }} -DOCKER_PASSWORD={{ op://application/docker_hub_credentials/password }} diff --git a/.gitignore b/.gitignore index 18bb73e..9c4c004 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -/target +target/ .cuddle/ -.env diff --git a/Cargo.lock b/Cargo.lock index f35b116..575afd5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,133 +3,84 @@ version = 3 [[package]] -name = "addr2line" -version = "0.21.0" +name = "ahash" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ - "gimli", + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", ] [[package]] -name = "adler" -version = "1.0.2" +name = "allocator-api2" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "anstream" -version = "0.6.11" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" -dependencies = [ - "backtrace", -] - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "ascii" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", @@ -137,14 +88,22 @@ dependencies = [ ] [[package]] -name = "atty" -version = "0.2.14" +name = "atoi" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "num-traits", +] + +[[package]] +name = "atomic-write-file" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" +dependencies = [ + "nix", + "rand", ] [[package]] @@ -154,23 +113,59 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "backtrace" -version = "0.3.69" +name = "axum" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", ] [[package]] -name = "base" -version = "0.1.0" +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] [[package]] name = "base64" @@ -178,6 +173,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bitflags" version = "1.3.2" @@ -189,18 +190,8 @@ name = "bitflags" version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" - -[[package]] -name = "blake3" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", + "serde", ] [[package]] @@ -212,22 +203,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bstr" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - [[package]] name = "byteorder" version = "1.5.0" @@ -236,19 +211,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -256,90 +227,47 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "windows-targets 0.52.0", -] - -[[package]] -name = "chrono-tz" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d7b79e99bfaa0d47da0687c43aa3b7381938a62ad3a6498599039321f660b7" -dependencies = [ - "chrono", - "chrono-tz-build", - "phf", -] - -[[package]] -name = "chrono-tz-build" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" -dependencies = [ - "parse-zoneinfo", - "phf", - "phf_codegen", -] - -[[package]] -name = "ci" -version = "0.1.0" -dependencies = [ - "dagger-sdk", - "eyre", - "tokio", -] - [[package]] name = "clap" -version = "2.34.0" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" -dependencies = [ - "ansi_term", - "atty", - "bitflags 1.3.2", - "strsim 0.8.0", - "textwrap", - "unicode-width", - "vec_map", -] - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" dependencies = [ "clap_builder", + "clap_derive", + "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" dependencies = [ "anstream", "anstyle", + "bitflags 1.3.2", "clap_lex", - "strsim 0.10.0", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" @@ -348,52 +276,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] -name = "combine" -version = "3.8.1" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" -dependencies = [ - "ascii", - "byteorder", - "either", - "memchr", - "unreachable", -] - -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cpufeatures" @@ -405,29 +291,25 @@ dependencies = [ ] [[package]] -name = "crc32fast" -version = "1.3.2" +name = "crc" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" dependencies = [ - "cfg-if", + "crc-catalog", ] [[package]] -name = "crossbeam-deque" -version = "0.8.5" +name = "crc-catalog" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "crossbeam-queue" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ "crossbeam-utils", ] @@ -438,31 +320,6 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -474,137 +331,25 @@ dependencies = [ ] [[package]] -name = "cuddle" -version = "0.2.0" +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ - "anyhow", - "blake3", - "clap 4.4.18", - "dirs", - "dotenv", - "envconfig", - "fs_extra", - "futures-util", - "git2", - "inquire", - "libz-sys", - "log", - "openssl", - "reqwest", - "rlua", - "rlua-searcher", - "serde", - "serde_json", - "serde_yaml", - "tempfile", - "tera", - "tokio", - "tracing", - "tracing-subscriber", - "walkdir", + "const-oid", + "pem-rfc7468", + "zeroize", ] [[package]] -name = "dagger-sdk" -version = "0.9.8" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bc59868e62ea1451f158aeb8fbb36c5dd2fb098f31bf408dbd165251674edf" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "async-trait", - "base64", - "derive_builder", - "dirs", - "eyre", - "flate2", - "futures", - "graphql_client", - "hex", - "hex-literal", - "platform-info", - "reqwest", - "serde", - "serde_json", - "sha2", - "tar", - "tempfile", - "thiserror", - "tokio", - "tracing", - "tracing-subscriber", + "powerfmt", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_macro" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" -dependencies = [ - "derive_builder_core", - "syn 1.0.109", -] - -[[package]] -name = "deunicode" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae2a35373c5c74340b79ae6780b498b2b183915ec5dacf263aac5a099bf485a" - [[package]] name = "digest" version = "0.10.7" @@ -612,28 +357,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", -] - -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", + "subtle", ] [[package]] @@ -641,55 +367,20 @@ name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" -dependencies = [ - "clap 2.34.0", -] [[package]] -name = "dyn-clone" -version = "1.0.16" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if", -] - -[[package]] -name = "envconfig" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea81cc7e21f55a9d9b1efb6816904978d0bfbe31a50347cb24b2e75564bcac9b" -dependencies = [ - "envconfig_derive", -] - -[[package]] -name = "envconfig_derive" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfca278e5f84b45519acaaff758ebfa01f18e96998bc24b8f1b722dd804b9bf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "serde", ] [[package]] @@ -709,15 +400,22 @@ dependencies = [ ] [[package]] -name = "eyre" -version = "0.6.12" +name = "etcetera" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" dependencies = [ - "indenter", - "once_cell", + "cfg-if", + "home", + "windows-sys 0.48.0", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "2.0.1" @@ -725,25 +423,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] -name = "filetime" -version = "0.2.23" +name = "finl_unicode" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "windows-sys 0.52.0", -] +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] -name = "flate2" -version = "1.0.28" +name = "flume" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "crc32fast", - "miniz_oxide", + "futures-core", + "futures-sink", + "spin 0.9.8", ] [[package]] @@ -752,56 +445,20 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] -[[package]] -name = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -809,38 +466,38 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", "futures-util", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + [[package]] name = "futures-io" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "futures-sink" version = "0.3.30" @@ -849,20 +506,18 @@ checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ - "futures-channel", "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", @@ -892,114 +547,11 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "git2" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" -dependencies = [ - "bitflags 2.4.2", - "libc", - "libgit2-sys", - "log", - "openssl-sys", - "url", -] - -[[package]] -name = "globset" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", -] - -[[package]] -name = "graphql-introspection-query" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2a4732cf5140bd6c082434494f785a19cfb566ab07d1382c3671f5812fed6d" -dependencies = [ - "serde", -] - -[[package]] -name = "graphql-parser" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ebc8013b4426d5b81a4364c419a95ed0b404af2b82e2457de52d9348f0e474" -dependencies = [ - "combine", - "thiserror", -] - -[[package]] -name = "graphql_client" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cdf7b487d864c2939b23902291a5041bc4a84418268f25fda1c8d4e15ad8fa" -dependencies = [ - "graphql_query_derive", - "reqwest", - "serde", - "serde_json", -] - -[[package]] -name = "graphql_client_codegen" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40f793251171991c4eb75bd84bc640afa8b68ff6907bc89d3b712a22f700506" -dependencies = [ - "graphql-introspection-query", - "graphql-parser", - "heck", - "lazy_static", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn 1.0.109", -] - -[[package]] -name = "graphql_query_derive" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00bda454f3d313f909298f626115092d348bc231025699f557b27e248475f48c" -dependencies = [ - "graphql_client_codegen", - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "h2" -version = "0.3.24" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" dependencies = [ "bytes", "fnv", @@ -1019,27 +571,43 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown", +] [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "hex" @@ -1048,16 +616,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hex-literal" -version = "0.4.1" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] [[package]] name = "http" -version = "0.2.11" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" dependencies = [ "bytes", "fnv", @@ -1066,12 +655,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", "pin-project-lite", ] @@ -1083,28 +684,18 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "humansize" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" -dependencies = [ - "libm", -] +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.28" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", @@ -1113,88 +704,35 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", "tokio", - "tower-service", - "tracing", - "want", ] [[package]] -name = "hyper-rustls" -version = "0.24.2" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ + "bytes", "futures-util", "http", + "http-body", "hyper", - "rustls", + "pin-project-lite", + "socket2 0.5.5", "tokio", - "tokio-rustls", ] -[[package]] -name = "iana-time-zone" -version = "0.1.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", ] -[[package]] -name = "ignore" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata 0.4.5", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - [[package]] name = "indexmap" version = "2.2.1" @@ -1206,77 +744,57 @@ dependencies = [ ] [[package]] -name = "inquire" -version = "0.6.2" +name = "io-lifetimes" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33e7c1ddeb15c9abcbfef6029d8e29f69b52b6d6c891031b88ed91b5065803b" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "bitflags 1.3.2", - "console", - "crossterm", - "dyn-clone", - "lazy_static", - "newline-converter", - "thiserror", - "unicode-segmentation", - "unicode-width", + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "ipnet" -version = "2.9.0" +name = "is-terminal" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix 0.37.20", + "windows-sys 0.48.0", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" - -[[package]] -name = "libgit2-sys" -version = "0.16.2+1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -1285,41 +803,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] -name = "libredox" -version = "0.0.1" +name = "libsqlite3-sys" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.2", - "libc", - "redox_syscall", -] - -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "cc", - "libc", - "libz-sys", - "openssl-sys", "pkg-config", "vcpkg", ] [[package]] -name = "libz-sys" -version = "1.1.15" +name = "linux-raw-sys" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" @@ -1329,9 +827,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1339,27 +837,31 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -dependencies = [ - "value-bag", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] -name = "matchers" -version = "0.1.0" +name = "matchit" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "regex-automata 0.1.10", + "cfg-if", + "digest", ] [[package]] name = "memchr" -version = "2.7.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mime" @@ -1368,33 +870,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "miniz_oxide" -version = "0.7.1" +name = "minimal-lexical" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mio" -version = "0.8.10" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", "windows-sys 0.48.0", ] [[package]] -name = "newline-converter" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f71d09d5c87634207f894c6b31b6a2b2c64ea3bdcf71bd5599fdbbe1600c00f" +name = "newsletter-api" +version = "0.1.0" dependencies = [ - "unicode-segmentation", + "anyhow", + "axum", + "clap", + "dotenv", + "serde", + "sqlx", + "tokio", + "tower-http", + "tracing", + "tracing-subscriber", + "uuid", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.2", + "cfg-if", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", ] [[package]] @@ -1407,6 +934,44 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.17" @@ -1414,86 +979,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", + "libm", ] [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.3.4", + "hermit-abi 0.2.6", "libc", ] -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" -version = "1.19.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "openssl" -version = "0.10.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "openssl-src" -version = "300.2.1+3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "overload" @@ -1513,120 +1016,63 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.48.0", ] [[package]] -name = "parse-zoneinfo" -version = "0.3.0" +name = "paste" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ - "regex", + "base64ct", ] [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] -name = "pest" -version = "2.7.6" +name = "pin-project" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ - "memchr", - "thiserror", - "ucd-trie", + "pin-project-internal", ] [[package]] -name = "pest_derive" -version = "2.7.6" +name = "pin-project-internal" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" -dependencies = [ - "pest", - "pest_meta", "proc-macro2", "quote", "syn 2.0.48", ] -[[package]] -name = "pest_meta" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_codegen" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -1634,6 +1080,27 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.29" @@ -1641,14 +1108,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] -name = "platform-info" -version = "2.0.2" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6259c4860e53bf665016f1b2f46a8859cadfa717581dc9d597ae4069de6300f" -dependencies = [ - "libc", - "winapi", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -1704,6 +1167,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -1713,156 +1185,54 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.5", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "reqwest" -version = "0.11.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-rustls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "webpki-roots", - "winreg", -] - [[package]] name = "ring" -version = "0.17.7" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" dependencies = [ "cc", "getrandom", "libc", - "spin", + "spin 0.9.8", "untrusted", "windows-sys 0.48.0", ] [[package]] -name = "rlua" -version = "0.19.8" +name = "rsa" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3120d9610f84b17da849f5cc8c089bb74299285515bb4a6114550bbc39ddb1e7" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" dependencies = [ - "bitflags 2.4.2", - "bstr", - "libc", + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", "num-traits", - "rlua-lua54-sys", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", ] [[package]] -name = "rlua-lua54-sys" -version = "0.1.6" +name = "rustix" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aafabafe1895cb4a2be81a56d7ff3d46bf4b5d2f9cfdbea2ed404cdabe96474" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "cc", + "bitflags 1.3.2", + "errno", + "io-lifetimes", "libc", - "pkg-config", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] -[[package]] -name = "rlua-searcher" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "896a3bc7006652c531118466f39aa5900472c0de5aecaf43d5c9a3f8027c2ce2" -dependencies = [ - "rlua", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustix" version = "0.38.31" @@ -1872,7 +1242,7 @@ dependencies = [ "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -1882,7 +1252,6 @@ version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "log", "ring", "rustls-webpki", "sct", @@ -1908,25 +1277,22 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.16" +name = "rustversion" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] -name = "same-file" -version = "1.0.6" +name = "ryu" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "scopeguard" -version = "1.2.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" @@ -1940,18 +1306,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -1960,15 +1326,24 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7f05c1d5476066defcdfacce1f52fc3cae3af1d3089727100c02ae92e5abbe0" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1982,16 +1357,14 @@ dependencies = [ ] [[package]] -name = "serde_yaml" -version = "0.9.31" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -2007,34 +1380,13 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.7" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" dependencies = [ "lazy_static", ] -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2045,10 +1397,14 @@ dependencies = [ ] [[package]] -name = "siphasher" -version = "0.3.11" +name = "signature" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] [[package]] name = "slab" @@ -2060,20 +1416,20 @@ dependencies = [ ] [[package]] -name = "slug" -version = "0.1.5" +name = "smallvec" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" -dependencies = [ - "deunicode", - "wasm-bindgen", -] +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] -name = "smallvec" -version = "1.13.1" +name = "socket2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] [[package]] name = "socket2" @@ -2085,17 +1441,260 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] [[package]] -name = "strsim" -version = "0.8.0" +name = "spki" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "time", + "tokio", + "tokio-stream", + "tracing", + "url", + "uuid", + "webpki-roots", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +dependencies = [ + "atomic-write-file", + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +dependencies = [ + "atoi", + "base64", + "bitflags 2.4.2", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +dependencies = [ + "atoi", + "base64", + "bitflags 2.4.2", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "time", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "time", + "tracing", + "url", + "urlencoding", + "uuid", +] + +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] [[package]] name = "strsim" @@ -2103,6 +1702,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -2126,80 +1731,24 @@ dependencies = [ ] [[package]] -name = "system-configuration" -version = "0.5.1" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tar" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" -dependencies = [ - "filetime", - "libc", - "xattr", -] +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "tempfile" -version = "3.10.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "rustix", + "redox_syscall 0.4.1", + "rustix 0.38.31", "windows-sys 0.52.0", ] -[[package]] -name = "tera" -version = "1.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" -dependencies = [ - "chrono", - "chrono-tz", - "globwalk", - "humansize", - "lazy_static", - "percent-encoding", - "pest", - "pest_derive", - "rand", - "regex", - "serde", - "serde_json", - "slug", - "unic-segment", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - [[package]] name = "thiserror" version = "1.0.56" @@ -2230,6 +1779,35 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2247,11 +1825,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ - "backtrace", + "autocfg", "bytes", "libc", "mio", @@ -2259,16 +1837,16 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.4.9", "tokio-macros", "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", @@ -2276,20 +1854,21 @@ dependencies = [ ] [[package]] -name = "tokio-rustls" -version = "0.24.1" +name = "tokio-stream" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ - "rustls", + "futures-core", + "pin-project-lite", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -2299,6 +1878,45 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags 2.4.2", + "bytes", + "http", + "http-body", + "http-body-util", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -2307,10 +1925,11 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2319,9 +1938,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", @@ -2330,9 +1949,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -2349,105 +1968,26 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "matchers", "nu-ansi-term", - "once_cell", - "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", - "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" -dependencies = [ - "unic-ucd-segment", -] - -[[package]] -name = "unic-ucd-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2456,9 +1996,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -2476,25 +2016,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] -name = "unicode-width" -version = "0.1.11" +name = "unicode_categories" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] - -[[package]] -name = "unsafe-libyaml" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "untrusted" @@ -2504,177 +2029,72 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +dependencies = [ + "getrandom", +] + [[package]] name = "valuable" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "value-bag" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cdbaf5e132e593e9fc1de6a15bbec912395b11fb9719e061cf64f804524c503" - [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "wasm-streams" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "web-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "webpki-roots" version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" + [[package]] name = "winapi" version = "0.3.9" @@ -2691,37 +2111,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -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-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.48.0", ] [[package]] @@ -2735,17 +2137,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -2765,9 +2167,9 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_gnullvm" @@ -2777,9 +2179,9 @@ checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_aarch64_msvc" @@ -2789,9 +2191,9 @@ checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_gnu" @@ -2801,9 +2203,9 @@ checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_i686_msvc" @@ -2813,9 +2215,9 @@ checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnu" @@ -2825,9 +2227,9 @@ checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_gnullvm" @@ -2837,9 +2239,9 @@ checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "windows_x86_64_msvc" @@ -2848,22 +2250,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] -name = "winreg" -version = "0.50.0" +name = "zerocopy" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "zerocopy-derive", ] [[package]] -name = "xattr" -version = "1.3.1" +name = "zerocopy-derive" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "libc", - "linux-raw-sys", - "rustix", + "proc-macro2", + "quote", + "syn 2.0.48", ] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 989353c..9edc244 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,17 @@ [workspace] -members = ["cuddle", "examples/base", "ci"] +members = ["crates/*"] resolver = "2" + +[workspace.package] +version = "0.1.0" + +[workspace.dependencies] +cuddle = { path = "crates/cuddle" } + +anyhow = { version = "1" } +tokio = { version = "1", features = ["full"] } +tracing = { version = "0.1", features = ["log"] } +tracing-subscriber = { version = "0.3.18" } +clap = { version = "4", features = ["derive", "env"] } +dotenv = { version = "0.15" } +axum = { version = "0.7" } diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f6a730e..0000000 --- a/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2023 Kasper J. Hermansen - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index a13acdc..b54b734 100644 --- a/README.md +++ b/README.md @@ -1,71 +1,2 @@ -# Cuddle - Configuration and Script Manager +# cuddle -Cuddle CLI is a Rust command-line interface application designed to manage -configuration variables and scripts across projects. It simplifies sharing of -code and workflows, making development and collaboration smoother and more -efficient. This project is published on crates.io as `cuddle`. - -## Table of Contents - -1. [Installation](#installation) -2. [Usage](#usage) -3. [Commands](#commands) -4. [Configuration](#configuration) -5. [Contributing](#contributing) -6. [License](#license) - -## Installation - -Make sure you have Rust and Cargo installed. You can install Rust and Cargo from -[https://rustup.rs/](https://rustup.rs/). - -To install Cuddle CLI, run: - -```sh -cargo install cuddle -``` - -## Usage - -After successful installation, you can run the CLI using the `cuddle` command: - -```sh -cuddle [command] [options] -``` - -## Commands - -Detailed documentation of the commands and options can be found in our -[official documentation (tbd)](LINK_TO_DOCUMENTATION). - -## Configuration - -You can manage your configurations in a file called `cuddle.yaml`. For details -on how to format this file, check our -[Configuration Guide (tbd)](LINK_TO_CONFIGURATION_GUIDE). - -## Contributing - -Contributions are what make the open-source community such an amazing place to -learn, inspire, and create. Any contributions you make are **greatly -appreciated**. - -1. Fork the Project -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) -3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -4. Push to the Branch (`git push origin feature/AmazingFeature`) -5. Open a Pull Request - -Please read our [Contributing Guide](LINK_TO_CONTRIBUTING_GUIDE) for more -information. - -## License - -Distributed under the MIT License. See `LICENSE` for more information. - -## Contact - -You can reach out to us at our -[official contact page (tbd)](LINK_TO_CONTACT_PAGE). Please ensure to follow our -[Code of Conduct (tbd)](LINK_TO_CONDUCT_PAGE) when interacting with our -community. diff --git a/ci/Cargo.toml b/ci/Cargo.toml deleted file mode 100644 index e1c52c8..0000000 --- a/ci/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "ci" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -dagger-sdk = "0.9.8" -eyre = "0.6.12" -tokio = { version = "1.36.0", features = ["full"] } diff --git a/ci/src/main.rs b/ci/src/main.rs deleted file mode 100644 index 781b876..0000000 --- a/ci/src/main.rs +++ /dev/null @@ -1,112 +0,0 @@ -use std::sync::Arc; - -use dagger_sdk::{ - Container, ContainerPublishOptsBuilder, Directory, HostDirectoryOptsBuilder, Query, - QueryContainerOptsBuilder, -}; - -#[tokio::main] -async fn main() -> eyre::Result<()> { - let client = dagger_sdk::connect().await?; - - let src = client.host().directory_opts( - ".", - HostDirectoryOptsBuilder::default() - .include(vec![ - "ci/", - "cuddle/", - "examples", - "Cargo.lock", - "Cargo.toml", - ]) - .build()?, - ); - - client - .container() - .publish_opts( - "kasperhermansen/cuddle:dev", - ContainerPublishOptsBuilder::default() - .platform_variants(vec![ - dind_image(client.clone(), src.clone(), "x86_64", "linux/amd64") - .await? - .id() - .await?, - dind_image(client.clone(), src.clone(), "aarch64", "linux/arm64/v8") - .await? - .id() - .await?, - ]) - .build()?, - ) - .await?; - - Ok(()) -} - -async fn dind_image( - client: Arc, - src: Directory, - architecture: &str, - platform: &str, -) -> eyre::Result { - let rust_bin = client - .container_opts( - QueryContainerOptsBuilder::default() - .platform(platform) - .build()?, - ) - .from("rustlang/rust:nightly") - .with_exec(vec![ - "rustup", - "target", - "add", - &format!("{architecture}-unknown-linux-musl"), - ]) - .with_exec(vec!["update-ca-certificates"]) - .with_exec(vec!["apt-get", "update"]) - .with_exec(vec!["apt-get", "upgrade", "-y"]) - .with_exec(vec![ - "apt-get", - "install", - "-y", - "-q", - "build-essential", - "curl", - "git", - "musl-tools", - "musl-dev", - "libz-dev", - ]) - .with_workdir("/app/cuddle/") - .with_directory(".", src) - .with_exec(vec![ - "cargo", - "install", - "--target", - &format!("{architecture}-unknown-linux-musl"), - "--path", - "cuddle", - "--profile=release", - ]); - - let final_image = client - .container_opts( - QueryContainerOptsBuilder::default() - .platform(platform) - .build()?, - ) - .from("docker:dind") - .with_directory( - "/usr/local/cargo/bin/", - rust_bin.directory("/usr/local/cargo/bin/"), - ); - - let path_env = final_image.env_variable("PATH").await?; - - let final_image = final_image - .with_env_variable("PATH", format!("{path_env}:/usr/local/cargo/bin")) - .with_exec(vec![""]); - - Ok(final_image) -} diff --git a/crates/cuddle/.gitignore b/crates/cuddle/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/crates/cuddle/.gitignore @@ -0,0 +1 @@ +/target diff --git a/crates/cuddle/Cargo.toml b/crates/cuddle/Cargo.toml new file mode 100644 index 0000000..2be3a2b --- /dev/null +++ b/crates/cuddle/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "cuddle" +edition = "2021" + +version.workspace = true + +[dependencies] +anyhow.workspace = true +tokio.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +clap.workspace = true +dotenv.workspace = true +axum.workspace = true + +serde = { version = "1.0.197", features = ["derive"] } +sqlx = { version = "0.7.3", features = ["runtime-tokio", "tls-rustls", "postgres", "uuid", "time"] } +uuid = { version = "1.7.0", features = ["v4"] } +tower-http = { version = "0.5.2", features = ["cors", "trace"] } diff --git a/crates/cuddle/src/main.rs b/crates/cuddle/src/main.rs new file mode 100644 index 0000000..e0e2878 --- /dev/null +++ b/crates/cuddle/src/main.rs @@ -0,0 +1,29 @@ +use anyhow::Context; +use clap::{Parser, Subcommand}; + +#[derive(Parser)] +#[command(author, version, about, long_about = None, subcommand_required = true)] +struct Command { + #[command(subcommand)] + command: Option, +} + +#[derive(Subcommand)] +enum Commands { + Hello {}, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + dotenv::dotenv().ok(); + tracing_subscriber::fmt::init(); + + let cli = Command::parse(); + tracing::debug!("Starting cli"); + + if let Some(Commands::Hello { }) = cli.command { + println!("Hello!") + } + + Ok(()) +} diff --git a/cuddle.yaml b/cuddle.yaml index 09a98e7..089c711 100644 --- a/cuddle.yaml +++ b/cuddle.yaml @@ -1,20 +1,15 @@ # yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json -base: "git@git.front.kjuulh.io:kjuulh/cuddle-base.git" +base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-cli-plan.git" vars: service: "cuddle" registry: kasperhermansen -scripts: - install: - type: shell - build_cuddle_image: - type: shell - args: - docker_username: - key: "DOCKER_USERNAME" - type: env - docker_password: - key: "DOCKER_PASSWORD" - type: env +please: + project: + owner: kjuulh + repository: "cuddle" + branch: "main" + settings: + api_url: "https://git.front.kjuulh.io" diff --git a/cuddle/Cargo.toml b/cuddle/Cargo.toml deleted file mode 100644 index 8887466..0000000 --- a/cuddle/Cargo.toml +++ /dev/null @@ -1,51 +0,0 @@ -[package] -name = "cuddle" -description = "cuddle is a shuttle inspired script and configuration management tool. It enables sharing of workflows on developers workstations and ci" -repository = "https://git.front.kjuulh.io/kjuulh/cuddle" -readme = "../README.md" -license-file = "../LICENSE" -publish = true -version = "0.2.0" -edition = "2021" - -[[bin]] -name = "cuddle" -path = "src/main.rs" - -[dependencies] -anyhow = { version = "1.0.79", features = ["backtrace"] } -serde = { version = "1.0.196", features = ["derive"] } -serde_yaml = "0.9.31" -walkdir = "2.4.0" -git2 = { version = "0.18.2", default-features = false, features = [ - "vendored-libgit2", - "vendored-openssl", - "ssh", -] } -clap = { version = "4.4.18", features = ["env", "string"] } -envconfig = "0.10.0" -dirs = "5.0.1" -tracing = "0.1.40" -tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] } -log = { version = "0.4.20", features = ["std", "kv_unstable"] } -tera = "1.19.1" -openssl = { version = "0.10.63", features = ["vendored"] } -libz-sys = { version = "1.1.15", default-features = false, features = [ - "libc", - "static", -] } -inquire = { version = "0.6.2", features = ["console"] } -tempfile = { version = "3.10.0" } -serde_json = "1.0.113" -rlua = "0.19.8" -rlua-searcher = "0.1.0" -dotenv = { version = "0.15.0", features = ["clap"] } -blake3 = "1.5.0" -tokio = { version = "1.36.0", features = ["full"] } -futures-util = "0.3.30" -fs_extra = "1.3.0" - -[dependencies.reqwest] -version = "0.11" -default-features = false -features = ["rustls-tls", "json"] diff --git a/cuddle/src/actions/mod.rs b/cuddle/src/actions/mod.rs deleted file mode 100644 index 9eb33dd..0000000 --- a/cuddle/src/actions/mod.rs +++ /dev/null @@ -1,366 +0,0 @@ -use std::{collections::HashMap, path::PathBuf}; - -use anyhow::Context; -use clap::ArgMatches; -use rlua::Lua; -use rlua_searcher::AddSearcher; - -use crate::{ - actions::shell::ShellAction, - model::{CuddleScript, CuddleShellScriptArg, CuddleVariable}, -}; - -pub mod shell; - -#[derive(Debug, Clone)] -#[allow(dead_code)] -pub struct CuddleAction { - pub script: CuddleScript, - pub path: PathBuf, - pub description: Option, - pub name: String, -} -#[allow(dead_code)] -impl CuddleAction { - pub fn new( - script: CuddleScript, - path: PathBuf, - name: String, - description: Option, - ) -> Self { - Self { - script, - path, - name, - description, - } - } - - pub fn execute( - self, - matches: &ArgMatches, - variables: Vec, - ) -> anyhow::Result<()> { - match self.script { - CuddleScript::Shell(s) => { - let mut arg_variables: Vec = vec![]; - if let Some(args) = s.args { - for (k, v) in args { - let var = match v { - CuddleShellScriptArg::Env(e) => { - let env_var = matches.get_one::(&k).cloned().ok_or( - anyhow::anyhow!( - "failed to find env variable with key: {}", - &e.key - ), - )?; - - CuddleVariable::new(k.clone(), env_var) - } - CuddleShellScriptArg::Flag(flag) => { - match matches.get_one::(&flag.name) { - Some(flag_var) => { - CuddleVariable::new(k.clone(), flag_var.clone()) - } - None => continue, - } - } - }; - - arg_variables.push(var); - } - } else { - arg_variables = vec![] - }; - - let mut vars = variables.clone(); - vars.append(&mut arg_variables); - - log::trace!("preparing to run action"); - - match ShellAction::new( - self.name.clone(), - format!( - "{}/scripts/{}.sh", - self.path - .to_str() - .expect("action doesn't have a name, this should never happen"), - self.name - ), - ) - .execute(vars) - { - Ok(()) => { - log::trace!("finished running action"); - Ok(()) - } - Err(e) => { - log::error!("{}", e); - Err(e) - } - } - } - CuddleScript::Dagger(_d) => Err(anyhow::anyhow!("not implemented yet!")), - CuddleScript::Lua(l) => { - let lua = Lua::new(); - - let mut map = HashMap::new(); - //map.insert("init".into(), "print(\"something\")".into()); - - let lua_dir = PathBuf::new().join(&self.path).join("scripts").join("lua"); - if lua_dir.exists() { - let absolute_lua_dir = lua_dir.canonicalize()?; - for entry in walkdir::WalkDir::new(&lua_dir) - .into_iter() - .filter_map(|e| e.ok()) - { - if entry.metadata()?.is_file() { - let full_file_path = entry.path().canonicalize()?; - let relative_module_path = - full_file_path.strip_prefix(&absolute_lua_dir)?; - let module_path = relative_module_path - .to_string_lossy() - .to_string() - .trim_end_matches("/init.lua") - .trim_end_matches(".lua") - .replace("/", "."); - let contents = std::fs::read_to_string(entry.path())?; - tracing::trace!(module_path = &module_path, "adding lua file"); - - map.insert(module_path.into(), contents.into()); - } - } - } - let lua_rocks_dir = PathBuf::new() - .join(&self.path) - .join("lua_modules") - .join("share") - .join("lua") - .join("5.4"); - if lua_rocks_dir.exists() { - let absolute_lua_dir = lua_rocks_dir.canonicalize()?; - for entry in walkdir::WalkDir::new(&lua_rocks_dir) - .into_iter() - .filter_map(|e| e.ok()) - { - if entry.metadata()?.is_file() { - let full_file_path = entry.path().canonicalize()?; - let relative_module_path = - full_file_path.strip_prefix(&absolute_lua_dir)?; - let module_path = relative_module_path - .to_string_lossy() - .to_string() - .trim_end_matches("/init.lua") - .trim_end_matches(".lua") - .replace("/", "."); - let contents = std::fs::read_to_string(entry.path())?; - tracing::trace!(module_path = &module_path, "adding lua file"); - - map.insert(module_path.into(), contents.into()); - } - } - } - - lua.context::<_, anyhow::Result<()>>(|lua_ctx| { - lua_ctx.add_searcher(map)?; - let globals = lua_ctx.globals(); - - let lua_script_entry = std::fs::read_to_string( - PathBuf::new() - .join(&self.path) - .join("scripts") - .join(format!("{}.lua", &self.name)), - ) - .context("failed to find lua script")?; - - lua_ctx - .load(&lua_script_entry) - .set_name(&self.name)? - .exec()?; - - Ok(()) - })?; - - Ok(()) - } - CuddleScript::Rust(script) => Ok(()), - } - } -} - -pub mod rust_action { - use std::{path::PathBuf, time::Duration}; - - use anyhow::Context; - use futures_util::StreamExt; - use reqwest::Method; - use tokio::{fs::File, io::AsyncWriteExt}; - - use crate::model::{CuddleRustScript, CuddleRustUpstream, CuddleVariable}; - - pub struct RustActionConfig { - pub config_dir: PathBuf, - pub cache_dir: PathBuf, - } - - impl Default for RustActionConfig { - fn default() -> Self { - let config = dirs::config_dir().expect("to be able to find a valid .config dir"); - let cache = dirs::cache_dir().expect("to be able to find a valid .cache dir"); - - Self { - config_dir: config, - cache_dir: cache, - } - } - } - - pub struct RustAction { - pub config: RustActionConfig, - pub plan: String, - pub binary_name: String, - } - - impl RustAction { - pub fn new(plan: String, binary_name: String) -> Self { - Self { - plan, - binary_name, - config: RustActionConfig::default(), - } - } - - pub async fn execute( - &self, - script: CuddleRustScript, - variables: impl IntoIterator, - ) -> anyhow::Result<()> { - let commit_sha = self - .get_commit_sha() - .await - .context("failed to find a valid commit sha on the inferred path: .cuddle/plan")?; - - let binary_hash = self.calculate_hash(commit_sha)?; - - // Get cached binary - // let binary = match self.get_binary(&binary_hash).await? { - // Some(binary) => binary, - // None => self.fetch_binary(&script, &binary_hash).await?, - // }; - - // Execute binary - - Ok(()) - } - - async fn get_binary( - &self, - binary_hash: impl Into, - ) -> anyhow::Result> { - let binary_path = self.get_cached_binary_path(binary_hash); - if !binary_path.exists() { - return Ok(None); - } - - Ok(Some(RustBinary {})) - } - - fn get_cached_binary_path(&self, binary_hash: impl Into) -> PathBuf { - let cached_binary_name = self.get_cached_binary_name(binary_hash); - let binary_path = self - .config - .cache_dir - .join("binaries") - .join(cached_binary_name); - binary_path - } - - #[inline] - fn get_cached_binary_name(&self, binary_hash: impl Into) -> String { - format!("{}-{}", binary_hash.into(), self.binary_name) - } - - async fn get_commit_sha(&self) -> anyhow::Result { - let repo = git2::Repository::open(".cuddle/plan")?; - let head = repo.head()?; - let commit = head.peel_to_commit()?; - - let commit_sha = commit.id(); - - Ok(commit_sha.to_string()) - } - - // async fn fetch_binary( - // &self, - // script: &CuddleRustScript, - // binary_hash: impl Into, - // ) -> anyhow::Result { - //let upstream = &script.upstream; - - //TODO: we should interpret some template variables in the upstream string. Ignore for now though - - // match UpstreamRustBinary::from(upstream) { - // UpstreamRustBinary::HttpBased { url } => { - // let client = reqwest::ClientBuilder::new() - // .user_agent(concat!( - // env!("CARGO_PKG_NAME"), - // "/", - // env!("CARGO_PKG_VERSION") - // )) - // .connect_timeout(Duration::from_secs(5)) - // .build()?; - - // let resp = client.request(Method::GET, url).send().await?; - - // let mut stream = resp.bytes_stream(); - - // let mut file = File::create(self.get_cached_binary_name(binary_hash)).await?; - - // while let Some(item) = stream.next().await { - // let chunk = item?; - - // file.write_all(&chunk).await?; - // } - - // // Make sure the entire file is written before we execute it - // file.flush().await?; - - // todo!() - // } - // } - // } - - fn calculate_hash(&self, commit_sha: impl Into>) -> anyhow::Result { - let mut contents: Vec = Vec::new(); - contents.append(&mut self.plan.clone().into_bytes()); - contents.append(&mut commit_sha.into()); - - let hash = blake3::hash(&contents); - - let hex = hash.to_hex(); - - Ok(hex.to_string()) - } - } - - pub struct RustBinary {} - - pub enum UpstreamRustBinary { - HttpBased { url: String }, - } - - impl From for UpstreamRustBinary { - fn from(value: CuddleRustUpstream) -> Self { - match value { - CuddleRustUpstream::Gitea { url } => Self::HttpBased { url }, - } - } - } - impl From<&CuddleRustUpstream> for UpstreamRustBinary { - fn from(value: &CuddleRustUpstream) -> Self { - match value { - CuddleRustUpstream::Gitea { url } => Self::HttpBased { url: url.clone() }, - } - } - } -} diff --git a/cuddle/src/actions/shell.rs b/cuddle/src/actions/shell.rs deleted file mode 100644 index 3c8cb99..0000000 --- a/cuddle/src/actions/shell.rs +++ /dev/null @@ -1,62 +0,0 @@ -use std::io::{BufRead, BufReader}; -use std::process::Stdio; -use std::{env::current_dir, path::PathBuf, process::Command}; - -use crate::model::CuddleVariable; - -#[allow(dead_code)] -pub struct ShellAction { - path: String, - name: String, -} - -impl ShellAction { - pub fn new(name: String, path: String) -> Self { - Self { path, name } - } - - pub fn execute(self, variables: Vec) -> anyhow::Result<()> { - log::debug!("executing shell action: {}", self.path.clone()); - - log::info!("Starting running shell action: {}", self.path.clone()); - - let path = PathBuf::from(self.path.clone()); - if !path.exists() { - log::info!("script='{}' not found, aborting", path.to_string_lossy()); - return Err(anyhow::anyhow!("file not found aborting")); - } - - let current_dir = current_dir()?; - log::trace!("current executable dir={}", current_dir.to_string_lossy()); - - let mut process = Command::new(&path) - .current_dir(current_dir) - .envs(variables.iter().rev().map(|v| { - log::trace!("{:?}", v); - - (v.name.to_uppercase(), v.value.clone()) - })) - .spawn()?; - - let status = process.wait()?; - - match status.code() { - None => { - log::warn!("process exited without code") - } - Some(n) => { - if n > 0 { - return Err(anyhow::anyhow!( - "{} exited with: {}", - path.clone().to_string_lossy(), - n - )); - } - } - } - - log::info!("Finished running shell action"); - - Ok(()) - } -} diff --git a/cuddle/src/cli/mod.rs b/cuddle/src/cli/mod.rs deleted file mode 100644 index ddb1f45..0000000 --- a/cuddle/src/cli/mod.rs +++ /dev/null @@ -1,413 +0,0 @@ -mod subcommands; - -use std::{ - path::PathBuf, - sync::{Arc, Mutex}, -}; - -use clap::Command; - -use crate::{ - actions::CuddleAction, - config::{CuddleConfig, CuddleFetchPolicy}, - context::{CuddleContext, CuddleTreeType}, - model::*, - util::git::GitCommit, -}; - -use self::subcommands::{ - render::RenderCommand, render_kustomize::RenderKustomizeCommand, - render_template::RenderTemplateCommand, -}; - -#[derive(Debug, Clone)] -pub struct CuddleCli { - scripts: Vec, - variables: Vec, - context: Option>>>, - command: Option, - tmp_dir: Option, - config: CuddleConfig, -} - -impl CuddleCli { - pub fn new( - context: Option>>>, - config: CuddleConfig, - ) -> anyhow::Result { - let mut cli = CuddleCli { - scripts: vec![], - variables: vec![], - context: context.clone(), - command: None, - tmp_dir: None, - config, - }; - - if let Ok(provider) = std::env::var("CUDDLE_SECRETS_PROVIDER") { - let provider = provider - .split(",") - .map(|p| p.to_string()) - .collect::>(); - tracing::trace!("secrets-provider enabled, handling for each entry"); - handle_providers(provider)?; - std::thread::sleep(std::time::Duration::from_millis(100)); - } - - match context { - Some(_) => { - tracing::debug!("build full cli"); - cli = cli - .process_variables() - .process_scripts() - .process_templates()? - .build_cli(); - } - None => { - tracing::debug!("build bare cli"); - cli = cli.build_bare_cli(); - } - } - - Ok(cli) - } - - fn process_variables(mut self) -> Self { - if let Ok(context_iter) = self.context.clone().unwrap().lock() { - for ctx in context_iter.iter() { - if let Some(variables) = ctx.plan.vars.clone() { - let mut variables: Vec = variables.into(); - self.variables.append(&mut variables); - } - - if let CuddleTreeType::Root = ctx.node_type { - let mut temp_path = ctx.path.clone(); - temp_path.push(".cuddle/tmp"); - - self.variables.push(CuddleVariable::new( - "tmp", - temp_path.clone().to_string_lossy().to_string(), - )); - - self.tmp_dir = Some(temp_path); - } - } - } - - match GitCommit::new() { - Ok(commit) => self - .variables - .push(CuddleVariable::new("commit_sha", commit.commit_sha.clone())), - Err(e) => { - log::debug!("{}", e); - } - } - - self - } - - fn process_scripts(mut self) -> Self { - if let Ok(context_iter) = self.context.clone().unwrap().lock() { - for ctx in context_iter.iter() { - if let Some(scripts) = ctx.plan.scripts.clone() { - for (name, script) in scripts { - match &script { - CuddleScript::Shell(shell_script) => { - self.scripts.push(CuddleAction::new( - script.clone(), - ctx.path.clone(), - name, - shell_script.description.clone(), - )) - } - CuddleScript::Dagger(_) => todo!(), - CuddleScript::Lua(l) => self.scripts.push(CuddleAction::new( - script.clone(), - ctx.path.clone(), - name, - l.description.clone(), - )), - CuddleScript::Rust(_) => todo!(), - } - } - } - } - } - - self - } - - fn process_templates(self) -> anyhow::Result { - if self.tmp_dir.is_none() { - log::debug!("cannot process template as bare bones cli"); - return Ok(self); - } - - // Make sure tmp_dir exists and clean it up first - let tmp_dir = self - .tmp_dir - .clone() - .ok_or(anyhow::anyhow!("tmp_dir does not exist aborting"))?; - match self.config.get_fetch_policy()? { - CuddleFetchPolicy::Always if tmp_dir.exists() && tmp_dir.ends_with("tmp") => { - std::fs::remove_dir_all(tmp_dir.clone())?; - } - _ => {} - } - std::fs::create_dir_all(tmp_dir.clone())?; - // Handle all templating with variables and such. - // TODO: use actual templating engine, for new we just copy templates to the final folder - - if let Ok(context_iter) = self.context.clone().unwrap().lock() { - for ctx in context_iter.iter() { - let mut template_path = ctx.path.clone(); - template_path.push("templates"); - - log::trace!("template path: {}", template_path.clone().to_string_lossy()); - - if !template_path.exists() { - continue; - } - - for file in std::fs::read_dir(&template_path)? { - let f = file?; - let mut dest_file = tmp_dir.clone(); - dest_file.push(f.path().strip_prefix(&template_path)?.parent().unwrap()); - - tracing::trace!( - "moving from: {} to {}", - f.path().display(), - dest_file.display() - ); - - if f.path().is_dir() { - std::fs::create_dir_all(&dest_file)?; - } - - fs_extra::copy_items( - &[f.path()], - &dest_file, - &fs_extra::dir::CopyOptions { - overwrite: true, - skip_exist: false, - ..Default::default() - }, - )?; - } - } - } - - Ok(self) - } - - fn build_cli(mut self) -> Self { - let mut root_cmd = Command::new("cuddle") - .version("1.0") - .author("kjuulh ") - .about("cuddle is your domain specific organization tool. It enabled widespread sharing through repositories, as well as collaborating while maintaining speed and integrity") - .subcommand_required(true) - .arg_required_else_help(true) - .propagate_version(true) - .arg(clap::Arg::new("secrets-provider").long("secrets-provider").env("CUDDLE_SECRETS_PROVIDER")); - - root_cmd = subcommands::x::build_command(root_cmd, self.clone()); - root_cmd = subcommands::render_template::build_command(root_cmd); - root_cmd = subcommands::render_kustomize::build_command(root_cmd); - root_cmd = subcommands::render::build_command(root_cmd); - root_cmd = subcommands::init::build_command(root_cmd, self.clone()); - - self.command = Some(root_cmd); - - self - } - - fn build_bare_cli(mut self) -> Self { - let mut root_cmd = Command::new("cuddle") - .version("1.0") - .author("kjuulh ") - .about("cuddle is your domain specific organization tool. It enabled widespread sharing through repositories, as well as collaborating while maintaining speed and integrity") - .subcommand_required(true) - .arg_required_else_help(true) - .propagate_version(true); - - root_cmd = subcommands::init::build_command(root_cmd, self.clone()); - - self.command = Some(root_cmd); - - self - } - - pub fn execute(self) -> anyhow::Result { - if let Some(cli) = self.command.clone() { - let matches = cli.clone().get_matches(); - - let res = match matches.subcommand() { - Some(("x", exe_submatch)) => subcommands::x::execute_x(exe_submatch, self.clone()), - Some(("render", sub_matches)) => { - RenderCommand::execute(sub_matches, self.clone())?; - Ok(()) - } - Some(("render_template", sub_matches)) => { - RenderTemplateCommand::from_matches(sub_matches, self.clone()) - .and_then(|cmd| cmd.execute())?; - Ok(()) - } - Some(("render-kustomize", sub_matches)) => { - RenderKustomizeCommand::from_matches(sub_matches, self.clone()) - .and_then(|cmd| cmd.execute())?; - Ok(()) - } - Some(("init", sub_matches)) => { - subcommands::init::execute_init(sub_matches, self.clone()) - } - _ => Err(anyhow::anyhow!("could not find a match")), - }; - - match res { - Ok(()) => {} - Err(e) => { - return Err(e); - } - } - } - - Ok(self) - } -} - -pub enum SecretProvider { - OnePassword { - inject: Vec, - dotenv: Option, - }, -} - -impl TryFrom for SecretProvider { - type Error = anyhow::Error; - - fn try_from(value: String) -> Result { - match value.as_str() { - "1password" => { - let one_password_inject = std::env::var("CUDDLE_ONE_PASSWORD_INJECT") - .ok() - .filter(|f| f.as_str() != ""); - let one_password_dot_env = std::env::var("CUDDLE_ONE_PASSWORD_DOT_ENV").ok(); - - let injectables = one_password_inject - .unwrap_or(String::new()) - .split(",") - .filter(|s| s.contains('=')) - .map(|i| i.to_string()) - .collect::>(); - - // for i in &injectables { - // if !std::path::PathBuf::from(i).exists() { - // anyhow::bail!("1pass injectable path doesn't exist: {}", i); - // } - // } - if let Some(one_password_dot_env) = &one_password_dot_env { - if let Ok(dir) = std::env::current_dir() { - tracing::trace!( - current_dir = dir.display().to_string(), - dotenv = &one_password_dot_env, - exists = PathBuf::from(&one_password_dot_env).exists(), - "1password dotenv inject" - ); - } - } - - Ok(Self::OnePassword { - inject: injectables, - dotenv: if let Some(one_password_dot_env) = one_password_dot_env { - if PathBuf::from(&one_password_dot_env).exists() { - Some(one_password_dot_env) - } else { - None - } - } else { - None - }, - }) - } - value => { - tracing::debug!( - "provided secrets manager doesn't match any allowed values {}", - value - ); - Err(anyhow::anyhow!("value is not one of supported values")) - } - } - } -} - -fn handle_providers(provider: Vec) -> anyhow::Result<()> { - fn execute_1password(lookup: &str) -> anyhow::Result { - let out = std::process::Command::new("op") - .arg("read") - .arg(lookup) - .output()?; - let secret = std::str::from_utf8(&out.stdout)?; - Ok(secret.to_string()) - } - - fn execute_1password_inject(file: &str) -> anyhow::Result> { - let out = std::process::Command::new("op") - .arg("inject") - .arg("--in-file") - .arg(file) - .output()?; - let secrets = std::str::from_utf8(&out.stdout)?.split('\n'); - let secrets_pair = secrets - .map(|secrets_pair| secrets_pair.split_once("=")) - .flatten() - .map(|(key, value)| (key.to_string(), value.to_string())) - .collect::>(); - - Ok(secrets_pair) - } - - let res = provider - .into_iter() - .map(|p| SecretProvider::try_from(p)) - .collect::>>(); - let res = res?; - - let res = res - .into_iter() - .map(|p| match p { - SecretProvider::OnePassword { inject, dotenv } => { - tracing::trace!( - inject = inject.join(","), - dotenv = dotenv, - "handling 1password" - ); - if let Some(dotenv) = dotenv { - let pairs = execute_1password_inject(&dotenv).unwrap(); - for (key, value) in pairs { - tracing::debug!(env_name = &key, value=&value, "set var from 1password"); - std::env::set_var(key, value); - } - } - - for i in inject { - let (env_var_name, op_lookup) = i.split_once("=").ok_or(anyhow::anyhow!( - "CUDDLE_ONE_PASSWORD_INJECT is not a key value pair ie. key:value,key2=value2" - ))?; - let secret = execute_1password(&op_lookup)?; - std::env::set_var(&env_var_name, secret); - tracing::debug!( - env_name = &env_var_name, - lookup = &op_lookup, - "set var from 1password" - ); - } - - Ok(()) - } - }) - .collect::>>(); - - let _ = res?; - - Ok(()) -} diff --git a/cuddle/src/cli/subcommands/folder.rs b/cuddle/src/cli/subcommands/folder.rs deleted file mode 100644 index a67e2f2..0000000 --- a/cuddle/src/cli/subcommands/folder.rs +++ /dev/null @@ -1,169 +0,0 @@ -use std::{collections::HashMap, path::PathBuf}; - -use anyhow::Context; -use clap::{Arg, ArgAction, ArgMatches, Command}; -use serde_json::from_value; -use tera::Function; - -use crate::{cli::CuddleCli, model::CuddleVariable}; - -pub fn build_command(root_cmd: Command) -> Command { - root_cmd.subcommand( - Command::new("folder") - .about("renders a template folder") - .args(&[ - Arg::new("source") - .long("source") - .required(true) - .value_parser(clap::value_parser!(PathBuf)), - Arg::new("destination") - .long("destination") - .required(true) - .value_parser(clap::value_parser!(PathBuf)), - Arg::new("extra-var") - .long("extra-var") - .action(ArgAction::Append) - .required(false), - ]), - ) -} - -pub struct FolderCommand { - variables: Vec, - source: PathBuf, - destination: PathBuf, -} - -impl FolderCommand { - pub fn from_matches(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result { - let source = matches - .get_one::("source") - .expect("source") - .clone(); - - let destination = matches - .get_one::("destination") - .expect("destination") - .clone(); - - let mut extra_vars: Vec = - if let Some(extra_vars) = matches.get_many::("extra-var") { - let mut vars = Vec::with_capacity(extra_vars.len()); - for var in extra_vars.into_iter() { - let parts: Vec<&str> = var.split('=').collect(); - if parts.len() != 2 { - return Err(anyhow::anyhow!("extra-var: is not set correctly: {}", var)); - } - - vars.push(CuddleVariable::new(parts[0], parts[1])); - } - vars - } else { - vec![] - }; - - extra_vars.append(&mut cli.variables.clone()); - - Ok(Self { - variables: extra_vars, - source, - destination, - }) - } - - pub fn execute(self) -> anyhow::Result<()> { - let _ = std::fs::remove_dir_all(&self.destination); - std::fs::create_dir_all(&self.destination).context("failed to create directory")?; - - // Prepare context - let mut context = tera::Context::new(); - for var in self.variables.iter().rev() { - context.insert(var.name.to_lowercase().replace([' ', '-'], "_"), &var.value) - } - - let mut tera = tera::Tera::default(); - - tera.register_function("filter_by_prefix", filter_by_prefix(self.variables.clone())); - - for entry in walkdir::WalkDir::new(&self.source) { - let entry = entry.context("entry was not found")?; - let entry_path = entry.path(); - let rel_path = self - .destination - .join(entry_path.strip_prefix(&self.source)?); - - if entry_path.is_file() { - // Load source template - let source = std::fs::read_to_string(entry_path) - .context("failed to read entry into memory")?; - - let output = tera.render_str(&source, &context)?; - - if let Some(parent) = rel_path.parent() { - std::fs::create_dir_all(parent).context("failed to create parent dir")?; - } - - // Put template in final destination - std::fs::write(&rel_path, output).context(format!( - "failed to write to destination: {}", - &rel_path.display() - ))?; - - log::info!("finished writing template to: {}", &rel_path.display()); - } - } - - Ok(()) - } -} - -fn filter_by_prefix(variables: Vec) -> impl Function { - Box::new( - move |args: &HashMap| -> tera::Result { - for var in &variables { - tracing::info!("variable: {} - {}", var.name, var.value); - } - - let prefix = match args.get("prefix") { - Some(value) => match from_value::>(value.clone()) { - Ok(prefix) => prefix, - Err(e) => { - tracing::error!("prefix was not a string: {}", e); - return Err("prefix was not a string".into()); - } - }, - None => return Err("prefix is required".into()), - }; - - let prefix = prefix.join("_"); - - let vars = variables - .iter() - .filter_map(|v| { - if v.name.starts_with(&prefix) { - Some(CuddleVariable::new( - v.name.trim_start_matches(&prefix).trim_start_matches('_'), - v.value.clone(), - )) - } else { - None - } - }) - .collect::>(); - - let mut structure: HashMap = HashMap::new(); - for var in vars { - if !structure.contains_key(&var.name) { - tracing::info!("found: {} - {}", &var.name, &var.value); - structure.insert(var.name, var.value); - } - } - - Ok(serde_json::to_value(structure).unwrap()) - }, - ) -} - -fn filter_by_name(args: &HashMap) -> tera::Result { - Ok(tera::Value::Null) -} diff --git a/cuddle/src/cli/subcommands/init.rs b/cuddle/src/cli/subcommands/init.rs deleted file mode 100644 index 74610d1..0000000 --- a/cuddle/src/cli/subcommands/init.rs +++ /dev/null @@ -1,227 +0,0 @@ -use std::collections::BTreeMap; -use std::fs::{create_dir_all, read, read_dir}; -use std::io::Write; -use std::path::PathBuf; - -use anyhow::Context; -use clap::{ArgMatches, Command}; -use walkdir::WalkDir; - -use crate::cli::CuddleCli; - -pub fn build_command(root_cmd: Command, _cli: CuddleCli) -> Command { - let mut repo_url = clap::Arg::new("repo").long("repo").short('r'); - - if let Ok(cuddle_template_url) = std::env::var("CUDDLE_TEMPLATE_URL") { - repo_url = repo_url.default_value(cuddle_template_url); - } else { - repo_url = repo_url.required(true); - } - - let execute_cmd = Command::new("init") - .about("init bootstraps a repository from a template") - .arg(repo_url) - .arg(clap::Arg::new("name").long("name")) - .arg(clap::Arg::new("path").long("path")) - .arg(clap::Arg::new("value").short('v').long("value")); - - root_cmd.subcommand(execute_cmd) -} - -pub fn execute_init(exe_submatch: &ArgMatches, _cli: CuddleCli) -> anyhow::Result<()> { - let repo = exe_submatch.get_one::("repo").unwrap(); - let name = exe_submatch.get_one::("name"); - let path = exe_submatch.get_one::("path"); - let values = exe_submatch - .get_many::("value") - .unwrap_or_default() - .collect::>(); - - tracing::info!("Downloading: {}", repo); - - create_dir_all(std::env::temp_dir())?; - - let tmpdir = tempfile::tempdir()?; - - let tmpdir_path = tmpdir.path().canonicalize()?; - - let output = std::process::Command::new("git") - .args(&["clone", repo, "."]) - .current_dir(tmpdir_path) - .output()?; - - std::io::stdout().write_all(&output.stdout)?; - std::io::stderr().write_all(&output.stderr)?; - - let templates_path = tmpdir.path().join("cuddle-templates.json"); - let template_path = tmpdir.path().join("cuddle-template.json"); - let templates = if templates_path.exists() { - let templates = read(templates_path)?; - let templates: CuddleTemplates = serde_json::from_slice(&templates)?; - - let mut single_templates = Vec::new(); - - for template_name in templates.templates.iter() { - let template = read( - tmpdir - .path() - .join(template_name) - .join("cuddle-template.json"), - )?; - let template = serde_json::from_slice::(&template)?; - - single_templates.push((template_name, template)) - } - - single_templates - .into_iter() - .map(|(name, template)| (name.clone(), tmpdir.path().join(name), template)) - .collect::>() - } else if template_path.exists() { - let template = read(template_path)?; - let template = serde_json::from_slice::(&template)?; - vec![(template.clone().name, tmpdir.path().to_path_buf(), template)] - } else { - anyhow::bail!("No cuddle-template.json or cuddle-templates.json found"); - }; - - let template = match name { - Some(name) => { - let template = read(tmpdir.path().join(name).join("cuddle-template.json"))?; - let template = serde_json::from_slice::(&template)?; - Ok((name.clone(), tmpdir.path().join(name), template)) - } - None => { - if templates.len() > 1 { - let name = inquire::Select::new( - "template", - templates.iter().map(|t| t.0.clone()).collect(), - ) - .with_help_message("name of which template to use") - .prompt()?; - - let found_template = templates - .iter() - .find(|item| item.0 == name) - .ok_or(anyhow::anyhow!("could not find an item with that name"))?; - - Ok(found_template.clone()) - } else if templates.len() == 1 { - Ok(templates[0].clone()) - } else { - Err(anyhow::anyhow!("No templates found, with any valid names")) - } - } - }; - - let (_name, template_dir, mut template) = template?; - - let path = match path { - Some(path) => path.clone(), - None => inquire::Text::new("path") - .with_help_message("to where it should be placed") - .with_default(".") - .prompt()?, - }; - - create_dir_all(&path)?; - let dir = std::fs::read_dir(&path)?; - if dir.count() != 0 { - for entry in read_dir(&path)? { - let entry = entry?; - if entry.file_name() == ".git" { - continue; - } else { - anyhow::bail!("Directory {} is not empty", &path); - } - } - } - - { - if let Some(ref mut prompt) = template.prompt { - 'prompt: for (name, prompt) in prompt { - for value in &values { - if let Some((value_name, value_content)) = value.split_once("=") { - if value_name == name { - prompt.value = value_content.to_string(); - continue 'prompt; - } - } - } - let value = inquire::Text::new(&name) - .with_help_message(&prompt.description) - .prompt()?; - prompt.value = value; - } - } - } - - for entry in WalkDir::new(&template_dir).follow_links(false) { - let entry = entry?; - let entry_path = entry.path(); - - let new_path = PathBuf::from(&path).join(entry_path.strip_prefix(&template_dir)?); - let new_path = replace_with_variables(&new_path.to_string_lossy().to_string(), &template)?; - let new_path = PathBuf::from(new_path); - - if entry_path.is_dir() { - create_dir_all(&new_path)?; - } - - if entry_path.is_file() { - let name = entry.file_name(); - if let Some(parent) = entry_path.parent() { - create_dir_all(parent)?; - } - - if name == "cuddle-template.json" || name == "cuddle-templates.json" { - continue; - } - - tracing::info!("writing to: {}", new_path.display()); - - let old_content = match std::fs::read_to_string(entry_path) { - Ok(e) => e, - Err(e) => { - tracing::debug!("found invalid file possibly with invalid utf8: {}", e); - std::fs::copy(entry_path, new_path).context("failed to write file")?; - continue; - } - }; - let new_content = replace_with_variables(&old_content, &template)?; - - std::fs::write(new_path, new_content.as_bytes())?; - } - } - - Ok(()) -} - -fn replace_with_variables(content: &str, template: &CuddleTemplate) -> anyhow::Result { - let mut content = content.to_string(); - if let Some(prompt) = &template.prompt { - for (name, value) in prompt { - content = content.replace(&format!("%%{}%%", name), &value.value); - } - } - - Ok(content) -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -struct CuddleTemplates { - pub templates: Vec, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -struct CuddleTemplate { - pub name: String, - pub prompt: Option>, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -struct CuddleTemplatePrompt { - pub description: String, - #[serde(skip)] - pub value: String, -} diff --git a/cuddle/src/cli/subcommands/kustomize.rs b/cuddle/src/cli/subcommands/kustomize.rs deleted file mode 100644 index 185f061..0000000 --- a/cuddle/src/cli/subcommands/kustomize.rs +++ /dev/null @@ -1,91 +0,0 @@ -use std::{io::Write, path::PathBuf}; - -use anyhow::Context; -use clap::{Arg, ArgMatches, Command}; - -use crate::cli::CuddleCli; - -pub fn build_command(root_cmd: Command) -> Command { - root_cmd.subcommand( - Command::new("kustomize") - .about("renders a kustomize folder") - .args(&[ - Arg::new("kustomize-folder") - .long("kustomize-folder") - .value_parser(clap::value_parser!(PathBuf)) - .required(true), - Arg::new("destination") - .long("destination") - .required(true) - .value_parser(clap::value_parser!(PathBuf)), - ]), - ) -} - -pub struct KustomizeCommand { - kustomize_folder: PathBuf, - destination: PathBuf, -} - -impl KustomizeCommand { - pub fn from_matches(matches: &ArgMatches, _cli: CuddleCli) -> anyhow::Result { - let kustomize_folder = matches - .get_one::("kustomize-folder") - .expect("kustomize-folder") - .clone(); - - let destination = matches - .get_one::("destination") - .expect("destination") - .clone(); - - Ok(Self { - kustomize_folder, - destination, - }) - } - - pub fn execute(self) -> anyhow::Result<()> { - let mut cmd = std::process::Command::new("kubectl"); - - let _ = std::fs::remove_dir_all(&self.destination); - std::fs::create_dir_all(&self.destination)?; - - let cmd = cmd - .arg("kustomize") - .arg("--enable-helm") - .arg(self.kustomize_folder); - let output = cmd.output().context("failed to run kubectl kustomize")?; - - if !output.status.success() { - anyhow::bail!( - "failed to run kustomize: {}", - output.status.code().expect("to find exit code") - ) - } - - let mut cmd = std::process::Command::new("kubectl-slice"); - let cmd = cmd - .arg("-o") - .arg(self.destination) - .stdin(std::process::Stdio::piped()); - - let mut child = cmd.spawn().context("failed to run kubectl-slice")?; - - if let Some(mut stdin) = child.stdin.take() { - stdin.write_all(&output.stdout)?; - } - - let output = child - .wait_with_output() - .context("failed to run kubectl-slice")?; - if !output.status.success() { - anyhow::bail!( - "failed to run kustomize: {}", - output.status.code().expect("to find exit code") - ) - } - - Ok(()) - } -} diff --git a/cuddle/src/cli/subcommands/mod.rs b/cuddle/src/cli/subcommands/mod.rs deleted file mode 100644 index 4572498..0000000 --- a/cuddle/src/cli/subcommands/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod folder; -pub mod init; -pub mod kustomize; -pub mod render; -pub mod render_kustomize; -pub mod render_template; -pub mod x; diff --git a/cuddle/src/cli/subcommands/render.rs b/cuddle/src/cli/subcommands/render.rs deleted file mode 100644 index f3eb156..0000000 --- a/cuddle/src/cli/subcommands/render.rs +++ /dev/null @@ -1,34 +0,0 @@ -use anyhow::Context; -use clap::{ArgMatches, Command}; - -use crate::cli::CuddleCli; - -use super::{folder::FolderCommand, kustomize::KustomizeCommand}; - -pub fn build_command(root_cmd: Command) -> Command { - let cmd = Command::new("render").about("accesses different render commands"); - - let cmd = super::kustomize::build_command(cmd); - let cmd = super::folder::build_command(cmd); - - root_cmd.subcommand(cmd) -} - -pub struct RenderCommand {} -impl RenderCommand { - pub fn execute(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result<()> { - match matches.subcommand() { - Some(("kustomize", sub_matches)) => { - KustomizeCommand::from_matches(sub_matches, cli)?.execute()?; - } - Some(("folder", sub_matches)) => { - FolderCommand::from_matches(sub_matches, cli)? - .execute() - .context("failed to render folder")?; - } - _ => anyhow::bail!("failed to find match for render"), - } - - Ok(()) - } -} diff --git a/cuddle/src/cli/subcommands/render_kustomize.rs b/cuddle/src/cli/subcommands/render_kustomize.rs deleted file mode 100644 index 49d33c1..0000000 --- a/cuddle/src/cli/subcommands/render_kustomize.rs +++ /dev/null @@ -1,70 +0,0 @@ -use std::path::PathBuf; - -use clap::{Arg, ArgMatches, Command}; - -use crate::cli::CuddleCli; - -pub fn build_command(root_cmd: Command) -> Command { - root_cmd.subcommand( - Command::new("render-kustomize") - .about("renders a kustomize folder") - .args(&[ - Arg::new("kustomize-folder") - .long("kustomize-folder") - .value_parser(clap::value_parser!(PathBuf)) - .required(true), - Arg::new("destination") - .long("destination") - .required(true) - .value_parser(clap::value_parser!(PathBuf)), - ]), - ) -} - -pub struct RenderKustomizeCommand { - kustomize_folder: PathBuf, - destination: PathBuf, -} - -impl RenderKustomizeCommand { - pub fn from_matches(matches: &ArgMatches, _cli: CuddleCli) -> anyhow::Result { - let kustomize_folder = matches - .get_one::("kustomize-folder") - .expect("kustomize-folder") - .clone(); - - let destination = matches - .get_one::("destination") - .expect("destination") - .clone(); - - Ok(Self { - kustomize_folder, - destination, - }) - } - - pub fn execute(self) -> anyhow::Result<()> { - let mut cmd = std::process::Command::new("kubectl"); - - std::fs::create_dir_all(&self.destination)?; - - let cmd = cmd - .arg("kustomize") - .arg(self.kustomize_folder) - .arg(format!("--output={}", self.destination.display())); - - let mut process = cmd.spawn()?; - - let exit = process.wait()?; - - if !exit.success() { - anyhow::bail!( - "failed to run kustomize: {}", - exit.code().expect("to find exit code") - ) - } - - Ok(()) - } -} diff --git a/cuddle/src/cli/subcommands/render_template.rs b/cuddle/src/cli/subcommands/render_template.rs deleted file mode 100644 index 727d537..0000000 --- a/cuddle/src/cli/subcommands/render_template.rs +++ /dev/null @@ -1,153 +0,0 @@ -use std::{path::PathBuf, str::FromStr}; - -use anyhow::Context; -use clap::{Arg, ArgMatches, Command}; - -use crate::{cli::CuddleCli, model::CuddleVariable}; - -const DESTINATION: &str = "destination is the output path of the template once done, but default .tmpl is stripped and the normal file extension is used. this can be overwritten if a file path is entered instead. I.e. (/some/file/name.txt)"; -const TEMPLATE_FILE: &str = "template-file is the input file path of the .tmpl file (or inferred) that you would like to render"; - -pub fn build_command(root_cmd: Command) -> Command { - root_cmd.subcommand( - Command::new("render_template") - .about("renders a jinja compatible template") - .args(&[ - Arg::new("template-file") - .alias("template") - .short('t') - .long("template-file") - .required(true) - .action(clap::ArgAction::Set) - .long_help(TEMPLATE_FILE), - Arg::new("destination") - .alias("dest") - .short('d') - .long("destination") - .required(true) - .action(clap::ArgAction::Set) - .long_help(DESTINATION), - Arg::new("extra-var") - .long("extra-var") - .required(false) - .action(clap::ArgAction::Append), - ]), - ) -} - -pub struct RenderTemplateCommand { - variables: Vec, - template_file: PathBuf, - destination: PathBuf, -} - -impl RenderTemplateCommand { - pub fn from_matches(matches: &ArgMatches, cli: CuddleCli) -> anyhow::Result { - let template_file = matches - .get_one::("template-file") - .ok_or(anyhow::anyhow!("template-file was not found")) - .and_then(get_path_buf_and_check_exists)?; - - let destination = matches - .get_one::("destination") - .ok_or(anyhow::anyhow!("destination was not found")) - .and_then(get_path_buf_and_check_dir_exists) - .and_then(RenderTemplateCommand::transform_extension) - .context("failed to access dest directory")?; - - let mut extra_vars: Vec = - if let Some(extra_vars) = matches.get_many::("extra-var") { - let mut vars = Vec::with_capacity(extra_vars.len()); - for var in extra_vars.into_iter() { - let parts: Vec<&str> = var.split('=').collect(); - if parts.len() != 2 { - return Err(anyhow::anyhow!("extra-var: is not set correctly: {}", var)); - } - - vars.push(CuddleVariable::new(parts[0], parts[1])); - } - vars - } else { - vec![] - }; - - extra_vars.append(&mut cli.variables.clone()); - - Ok(Self { - variables: extra_vars, - template_file, - destination, - }) - } - - pub fn execute(self) -> anyhow::Result<()> { - // Prepare context - let mut context = tera::Context::new(); - for var in self.variables { - context.insert(var.name.to_lowercase().replace([' ', '-'], "_"), &var.value) - } - - // Load source template - let source = std::fs::read_to_string(self.template_file)?; - - let output = tera::Tera::one_off(source.as_str(), &context, false)?; - - if let Some(parent) = self.destination.parent() { - std::fs::create_dir_all(parent)?; - } - - // Put template in final destination - std::fs::write(&self.destination, output).context(format!( - "failed to write to destination: {}", - &self.destination.display(), - ))?; - - log::info!( - "finished writing template to: {}", - &self.destination.to_string_lossy() - ); - - Ok(()) - } - - fn transform_extension(template_path: PathBuf) -> anyhow::Result { - if template_path.is_file() { - let ext = template_path.extension().ok_or(anyhow::anyhow!( - "destination path does not have an extension" - ))?; - if ext.to_string_lossy().ends_with("tmpl") { - let template_dest = template_path - .to_str() - .and_then(|s| s.strip_suffix(".tmpl")) - .ok_or(anyhow::anyhow!("string does not end in .tmpl"))?; - - return PathBuf::from_str(template_dest).map_err(|e| anyhow::anyhow!(e)); - } - } - - Ok(template_path) - } -} - -fn get_path_buf_and_check_exists(raw_path: impl Into) -> anyhow::Result { - match PathBuf::from_str(&raw_path.into()) { - Ok(pb) => { - if pb.exists() { - Ok(pb) - } else { - Err(anyhow::anyhow!( - "path: {}, could not be found", - pb.to_string_lossy() - )) - } - } - Err(e) => Err(anyhow::anyhow!(e)), - } -} - -fn get_path_buf_and_check_dir_exists(raw_path: impl Into) -> anyhow::Result { - match PathBuf::from_str(&raw_path.into()) { - Ok(pb) => Ok(pb), - Err(e) => Err(anyhow::anyhow!(e)), - } -} diff --git a/cuddle/src/cli/subcommands/x.rs b/cuddle/src/cli/subcommands/x.rs deleted file mode 100644 index 6b00291..0000000 --- a/cuddle/src/cli/subcommands/x.rs +++ /dev/null @@ -1,89 +0,0 @@ -use clap::{Arg, ArgMatches, Command}; - -use crate::cli::CuddleCli; - -pub fn build_command(root_cmd: Command, cli: CuddleCli) -> Command { - if cli.scripts.len() > 0 { - let execute_cmd_about = "x is your entry into your domains scripts, scripts inherited from parents will also be present here"; - let mut execute_cmd = Command::new("x") - .about(execute_cmd_about) - .subcommand_required(true); - - execute_cmd = execute_cmd.subcommands(&build_scripts(cli)); - - root_cmd.subcommand(execute_cmd) - } else { - root_cmd - } -} - -pub fn build_scripts(cli: CuddleCli) -> Vec { - let mut cmds = Vec::new(); - for script in cli.scripts.iter() { - let mut cmd = Command::new(&script.name); - - if let Some(desc) = &script.description { - cmd = cmd.about(desc) - } - - match &script.script { - crate::model::CuddleScript::Shell(shell_script) => { - if let Some(args) = &shell_script.args { - for (arg_name, arg) in args { - cmd = match arg { - crate::model::CuddleShellScriptArg::Env(arg_env) => cmd.arg( - Arg::new(arg_name.clone()) - .env(arg_name.to_uppercase().replace(".", "_")) - .required(true), - ), - crate::model::CuddleShellScriptArg::Flag(arg_flag) => { - let mut arg_val = Arg::new(arg_name.clone()) - .env(arg_name.to_uppercase().replace(".", "_")) - .long(arg_name); - - if let Some(true) = arg_flag.required { - arg_val = arg_val.required(true); - } - - if let Some(def) = &arg_flag.default_value { - arg_val = arg_val.default_value(def); - } - - if let Some(desc) = &arg_flag.description { - arg_val = arg_val.help(&*desc.clone().leak()) - } - - cmd.arg(arg_val) - } - }; - } - } - } - crate::model::CuddleScript::Dagger(_) => todo!(), - crate::model::CuddleScript::Lua(l) => {} - crate::model::CuddleScript::Rust(_) => todo!(), - } - - cmds.push(cmd) - } - - cmds -} - -pub fn execute_x(exe_submatch: &ArgMatches, cli: CuddleCli) -> anyhow::Result<()> { - match exe_submatch.subcommand() { - Some((name, action_matches)) => { - log::trace!(action=name; "running action; name={}", name); - match cli.scripts.iter().find(|ele| ele.name == name) { - Some(script) => { - script - .clone() - .execute(action_matches, cli.variables.clone())?; - Ok(()) - } - _ => Err(anyhow::anyhow!("could not find a match")), - } - } - _ => Err(anyhow::anyhow!("could not find a match")), - } -} diff --git a/cuddle/src/config.rs b/cuddle/src/config.rs deleted file mode 100644 index b67f56d..0000000 --- a/cuddle/src/config.rs +++ /dev/null @@ -1,28 +0,0 @@ -use envconfig::Envconfig; - -pub enum CuddleFetchPolicy { - Always, - Once, - Never, -} - -#[derive(Envconfig, Clone, Debug)] -pub struct CuddleConfig { - #[envconfig(from = "CUDDLE_FETCH_POLICY", default = "once")] - fetch_policy: String, -} - -impl CuddleConfig { - pub fn from_env() -> anyhow::Result { - CuddleConfig::init_from_env().map_err(|e| anyhow::Error::from(e)) - } - - pub fn get_fetch_policy(&self) -> anyhow::Result { - match self.fetch_policy.clone().to_lowercase().as_str() { - "always" => Ok(CuddleFetchPolicy::Always), - "once" => Ok(CuddleFetchPolicy::Once), - "never" => Ok(CuddleFetchPolicy::Never), - _ => Err(anyhow::anyhow!("could not parse fetch policy")), - } - } -} diff --git a/cuddle/src/context.rs b/cuddle/src/context.rs deleted file mode 100644 index 6bd6d2f..0000000 --- a/cuddle/src/context.rs +++ /dev/null @@ -1,211 +0,0 @@ -use std::{ - env::{self, current_dir}, - ffi::OsStr, - path::{Path, PathBuf}, - sync::{Arc, Mutex}, -}; - -use git2::{ - build::{CheckoutBuilder, RepoBuilder}, - FetchOptions, RemoteCallbacks, -}; - -use crate::{ - config::{CuddleConfig, CuddleFetchPolicy}, - model::{CuddleBase, CuddlePlan}, -}; - -#[derive(Debug, Clone, PartialEq)] -pub enum CuddleTreeType { - Root, - Leaf, -} - -#[derive(Debug)] -pub struct CuddleContext { - pub plan: CuddlePlan, - pub path: PathBuf, - pub node_type: CuddleTreeType, -} - -pub fn extract_cuddle( - config: CuddleConfig, -) -> anyhow::Result>>>> { - let mut curr_dir = current_dir()?; - curr_dir.push(".cuddle/"); - let fetch_policy = config.get_fetch_policy()?; - if let CuddleFetchPolicy::Always = fetch_policy { - if curr_dir.exists() { - if let Err(res) = std::fs::remove_dir_all(curr_dir) { - panic!("{}", res) - } - } - } - - // Load main cuddle file. - let cuddle_yaml = find_root_cuddle()?; - if cuddle_yaml.is_none() { - return Ok(None); - } - let cuddle_yaml = cuddle_yaml.unwrap(); - log::trace!(cuddle_yaml=log::as_debug!(cuddle_yaml); "Find root cuddle"); - - let cuddle_plan = serde_yaml::from_str::(cuddle_yaml.as_str())?; - log::debug!(cuddle_plan=log::as_debug!(cuddle_yaml); "parse cuddle plan"); - - let context: Arc>> = Arc::new(Mutex::new(Vec::new())); - context.lock().unwrap().push(CuddleContext { - plan: cuddle_plan.clone(), - path: current_dir()?, - node_type: CuddleTreeType::Root, - }); - - // pull parent plan and execute recursive descent - match cuddle_plan.base { - CuddleBase::Bool(true) => { - return Err(anyhow::anyhow!( - "plan cannot be enabled without specifying a plan" - )) - } - CuddleBase::Bool(false) => { - log::debug!("plan is root: skipping"); - } - CuddleBase::String(parent_plan) => { - let destination_path = create_cuddle_local()?; - let mut cuddle_dest = destination_path.clone(); - cuddle_dest.push("base"); - - if !cuddle_dest.exists() { - pull_parent_cuddle_into_local(parent_plan, cuddle_dest.clone())?; - } - - recurse_parent(cuddle_dest, context.clone())?; - } - } - - Ok(Some(context)) -} - -fn create_cuddle_local() -> anyhow::Result { - let mut curr_dir = current_dir()?.clone(); - curr_dir.push(".cuddle/"); - - if curr_dir.exists() { - log::debug!(".cuddle/ already exists: skipping"); - return Ok(curr_dir); - } - - std::fs::create_dir(curr_dir.clone())?; - - Ok(curr_dir) -} - -fn create_cuddle(path: PathBuf) -> anyhow::Result { - let mut curr_dir = path.clone(); - curr_dir.push(".cuddle/"); - - if curr_dir.exists() { - log::debug!(".cuddle/ already exists: skipping"); - return Ok(curr_dir); - } - - std::fs::create_dir(curr_dir.clone())?; - - Ok(curr_dir) -} - -fn pull_parent_cuddle_into_local( - parent_cuddle: String, - destination: PathBuf, -) -> anyhow::Result<()> { - let mut rc = RemoteCallbacks::new(); - rc.credentials(|_url, username_from_url, _allowed_types| { - if *"true" == std::env::var("CUDDLE_SSH_AGENT").ok().unwrap_or("".into()) { - git2::Cred::ssh_key_from_agent(username_from_url.unwrap()) - } else { - git2::Cred::ssh_key( - username_from_url.unwrap(), - None, - Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())), - None, - ) - } - }); - - rc.certificate_check(|_cert, _something| Ok(git2::CertificateCheckStatus::CertificateOk)); - - let mut fo = FetchOptions::new(); - fo.remote_callbacks(rc); - - let co = CheckoutBuilder::new(); - RepoBuilder::new() - .fetch_options(fo) - .with_checkout(co) - .clone(&parent_cuddle, &destination)?; - - log::debug!(parent_cuddle=log::as_display!(parent_cuddle); "pulled repository"); - - Ok(()) -} - -fn recurse_parent( - path: PathBuf, - context: Arc>>, -) -> anyhow::Result> { - let cuddle_contents = find_cuddle(path.clone())?; - if cuddle_contents.is_none() { - return Ok(None); - } - let cuddle_plan = serde_yaml::from_str::(&cuddle_contents.unwrap())?; - - let ctx = context.clone(); - if let Ok(mut ctxs) = ctx.lock() { - ctxs.push(CuddleContext { - plan: cuddle_plan.clone(), - path: path.clone(), - node_type: CuddleTreeType::Leaf, - }); - } else { - return Err(anyhow::anyhow!("Could not acquire lock, aborting")); - } - - match cuddle_plan.base { - CuddleBase::Bool(true) => Err(anyhow::anyhow!( - "plan cannot be enabled without specifying a plan" - )), - CuddleBase::Bool(false) => { - log::debug!("plan is root: finishing up"); - Ok(Some(())) - } - CuddleBase::String(parent_plan) => { - let destination_path = create_cuddle(path.clone())?; - let mut cuddle_dest = destination_path.clone(); - cuddle_dest.push("base"); - - if !cuddle_dest.exists() { - pull_parent_cuddle_into_local(parent_plan, cuddle_dest.clone())?; - } - recurse_parent(cuddle_dest, context.clone()) - } - } -} - -fn find_root_cuddle() -> anyhow::Result> { - // TODO: Make recursive towards root - let current_dir = env::current_dir()?; - find_cuddle(current_dir) -} - -fn find_cuddle(path: PathBuf) -> anyhow::Result> { - for entry in std::fs::read_dir(path)? { - let entry = entry?; - let path = entry.path(); - - let metadata = std::fs::metadata(&path)?; - if metadata.is_file() && path.file_name().unwrap() == OsStr::new("cuddle.yaml") { - return Ok(Some(std::fs::read_to_string(path)?)); - } - } - - Ok(None) -} diff --git a/cuddle/src/main.rs b/cuddle/src/main.rs deleted file mode 100644 index d0ea1b3..0000000 --- a/cuddle/src/main.rs +++ /dev/null @@ -1,31 +0,0 @@ -use config::CuddleConfig; -use tracing_subscriber::prelude::*; -use tracing_subscriber::{fmt, EnvFilter}; - -mod actions; -mod cli; -mod config; -mod context; -mod model; -mod util; - -fn main() -> anyhow::Result<()> { - init_logging()?; - let _ = dotenv::dotenv(); - - let config = CuddleConfig::from_env()?; - - let context = context::extract_cuddle(config.clone())?; - _ = cli::CuddleCli::new(context, config)?.execute()?; - - Ok(()) -} - -fn init_logging() -> anyhow::Result<()> { - tracing_subscriber::registry() - .with(fmt::layer()) - .with(EnvFilter::from_default_env()) - .init(); - - Ok(()) -} diff --git a/cuddle/src/model.rs b/cuddle/src/model.rs deleted file mode 100644 index a27d5e6..0000000 --- a/cuddle/src/model.rs +++ /dev/null @@ -1,236 +0,0 @@ -use std::collections::HashMap; - -use serde::Deserialize; - -#[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(untagged)] -pub enum CuddleBase { - Bool(bool), - String(String), -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleShellScriptArgEnv { - pub key: String, - pub description: Option, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleShellScriptArgFlag { - pub name: String, - pub description: Option, - pub required: Option, - pub default_value: Option, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(tag = "type")] -pub enum CuddleShellScriptArg { - #[serde(alias = "env")] - Env(CuddleShellScriptArgEnv), - #[serde(alias = "flag")] - Flag(CuddleShellScriptArgFlag), -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleShellScript { - pub description: Option, - pub args: Option>, -} -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleDaggerScript { - pub description: Option, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleLuaScript { - pub description: Option, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub enum CuddleRustUpstream { - #[serde(alias = "gitea")] - Gitea { url: String }, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddleRustScript { - pub description: Option, - pub upstream: CuddleRustUpstream, -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(tag = "type")] -pub enum CuddleScript { - #[serde(alias = "shell")] - Shell(CuddleShellScript), - #[serde(alias = "dagger")] - Dagger(CuddleDaggerScript), - #[serde(alias = "lua")] - Lua(CuddleLuaScript), - #[serde(alias = "rust")] - Rust(CuddleRustScript), -} - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub struct CuddlePlan { - pub base: CuddleBase, - pub vars: Option, - pub scripts: Option>, -} - -#[derive(Deserialize, Debug, Clone, PartialEq)] -pub struct CuddlePlanVariables(HashMap); - -impl From for Vec { - fn from(value: CuddlePlanVariables) -> Self { - let variables: CuddleVariables = value.0.into(); - - let mut vars = variables.0; - vars.sort_by(|a, b| a.name.partial_cmp(&b.name).unwrap()); - - vars - } -} - -#[derive(Deserialize, Debug, Clone, PartialEq)] -#[serde(untagged)] -pub enum CuddlePlanVar { - Str(String), - Nested(HashMap), -} - -#[derive(Clone, Debug, PartialEq)] -struct CuddleVariables(Vec); - -impl From> for CuddleVariables { - fn from(value: HashMap) -> Self { - let mut variables = Vec::new(); - for (k, v) in value { - match v { - CuddlePlanVar::Str(value) => variables.push(CuddleVariable::new(k, value)), - CuddlePlanVar::Nested(nested) => { - let nested_variables: CuddleVariables = nested.into(); - - let mut combined_variables: Vec<_> = nested_variables - .0 - .into_iter() - .map(|v| CuddleVariable::new(format!("{}_{}", k, v.name), v.value)) - .collect(); - - variables.append(&mut combined_variables); - } - } - } - - CuddleVariables(variables) - } -} - -#[derive(Debug, Clone, PartialEq, Deserialize, serde::Serialize)] -#[allow(dead_code)] -pub struct CuddleVariable { - pub name: String, - pub value: String, -} - -impl CuddleVariable { - pub fn new(name: impl Into, value: impl Into) -> Self { - Self { - name: name.into(), - value: value.into(), - } - } -} - -impl From> for CuddlePlanVar { - fn from(value: HashMap) -> Self { - CuddlePlanVar::Nested(value) - } -} - -impl From> for CuddlePlanVar { - fn from(value: HashMap<&str, CuddlePlanVar>) -> Self { - CuddlePlanVar::Nested(value.into_iter().map(|(k, v)| (k.to_string(), v)).collect()) - } -} - -impl From for CuddlePlanVar { - fn from(value: String) -> Self { - CuddlePlanVar::Str(value) - } -} - -impl From<&str> for CuddlePlanVar { - fn from(value: &str) -> Self { - CuddlePlanVar::Str(value.to_string()) - } -} - -#[cfg(test)] -mod test { - use std::collections::HashMap; - - use super::{CuddlePlanVariables, CuddleVariable}; - - #[test] - pub fn parse_cuddle_variables() { - let cuddle = r#" -someKey: someValue -someNestedKey: - someNestedNestedKey: - someKey: key - someKey: key - "#; - - let cuddle_var: CuddlePlanVariables = serde_yaml::from_str(cuddle).unwrap(); - - let mut expected = HashMap::new(); - expected.insert("someKey", "someValue".into()); - - let mut nested_key = HashMap::new(); - nested_key.insert("someKey", "key".into()); - - let mut nested_nested_key = HashMap::new(); - nested_nested_key.insert("someKey", "key".into()); - - nested_key.insert("someNestedNestedKey", nested_nested_key.into()); - - expected.insert("someNestedKey", nested_key.into()); - - assert_eq!( - CuddlePlanVariables( - expected - .into_iter() - .map(|(k, v)| (k.to_string(), v)) - .collect() - ), - cuddle_var - ); - } - - #[test] - pub fn to_cuddle_variables() { - let cuddle = r#" -someKey: someValue -someNestedKey: - someNestedNestedKey: - someKey: key - someKey: key - "#; - - let cuddle_var: CuddlePlanVariables = serde_yaml::from_str(cuddle).unwrap(); - - let variables: Vec = cuddle_var.into(); - - let mut expected: Vec = vec![ - CuddleVariable::new("someKey", "someValue"), - CuddleVariable::new("someNestedKey_someKey", "key"), - CuddleVariable::new("someNestedKey_someNestedNestedKey_someKey", "key"), - ]; - - expected.sort_by(|a, b| a.name.partial_cmp(&b.name).unwrap()); - - assert_eq!(expected, variables); - } -} diff --git a/cuddle/src/util/git.rs b/cuddle/src/util/git.rs deleted file mode 100644 index d66b680..0000000 --- a/cuddle/src/util/git.rs +++ /dev/null @@ -1,33 +0,0 @@ -use std::env::current_dir; - -use git2::Repository; - -#[derive(Debug)] -pub struct GitCommit { - pub commit_sha: String, -} - -impl GitCommit { - pub fn new() -> anyhow::Result { - let repo = Repository::open(current_dir().expect("having current_dir available")).map_err( - |e| { - log::debug!("{}", e); - anyhow::anyhow!("could not open repository") - }, - )?; - let head_ref = repo - .head() - .map_err(|e| { - log::warn!("{}", e); - anyhow::anyhow!("could not get HEAD") - })? - .target() - .ok_or(anyhow::anyhow!( - "could not extract head -> target to commit_sha" - ))?; - - Ok(Self { - commit_sha: head_ref.to_string(), - }) - } -} diff --git a/cuddle/src/util/mod.rs b/cuddle/src/util/mod.rs deleted file mode 100644 index c2bf1c3..0000000 --- a/cuddle/src/util/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod git; diff --git a/examples/base/Cargo.toml b/examples/base/Cargo.toml deleted file mode 100644 index 6916ddc..0000000 --- a/examples/base/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "base" -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/examples/base/cuddle.yaml b/examples/base/cuddle.yaml deleted file mode 100644 index b175ef4..0000000 --- a/examples/base/cuddle.yaml +++ /dev/null @@ -1,8 +0,0 @@ -# yaml-language-server: $schema=../../schemas/base.json - -base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-plan.git" - -scripts: - build: - type: shell - description: "build rust plan" diff --git a/examples/base/scripts/build.sh b/examples/base/scripts/build.sh deleted file mode 100755 index bc00b69..0000000 --- a/examples/base/scripts/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo "Ran build" diff --git a/examples/base/src/main.rs b/examples/base/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/examples/base/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/examples/templates/cuddle.yaml b/examples/templates/cuddle.yaml deleted file mode 100644 index f01d114..0000000 --- a/examples/templates/cuddle.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# yaml-language-server: $schema=../../schemas/base.json - -base: false - -vars: - service: "some-service" - -scripts: - test_render_template: - type: shell - args: - extravar: - type: env - key: "HOME" diff --git a/examples/templates/scripts/test_render_template.sh b/examples/templates/scripts/test_render_template.sh deleted file mode 100755 index 50dd6f9..0000000 --- a/examples/templates/scripts/test_render_template.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -CUDDLE_FETCH_POLICY=never cuddle render_template \ - --template-file "$TMP/input.txt.tmpl" \ - --destination "$TMP/input.txt" \ - --extra-var "extravar=someextravar" diff --git a/examples/templates/templates/input.txt.tmpl b/examples/templates/templates/input.txt.tmpl deleted file mode 100644 index 8bd845a..0000000 --- a/examples/templates/templates/input.txt.tmpl +++ /dev/null @@ -1,3 +0,0 @@ -some {{ service }} name - -- {{ extravar }} diff --git a/schemas/base.json b/schemas/base.json deleted file mode 100644 index f25df84..0000000 --- a/schemas/base.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalProperties": false, - "properties": { - "base": { - "title": "Base url from which to base current cuddle plan on", - "description": "Base url from which to construct current cuddle plan, is recursive", - "oneOf": [ - { - "type": "string", - "title": "The url of the parameter" - }, - { - "type": "boolean", - "title": "Whether it is enabled or not" - } - ] - }, - "vars": { - "type": "object", - "title": "your collection of variables to be available to cuddle", - "patternProperties": { - "^.*$": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "object" - } - ] - } - }, - "additionalProperties": false - }, - "scripts": { - "type": "object", - "title": "Scripts the cuddle cli can execute", - "description": "Scripts the cuddle cli can execute 'cuddle x my-awesome-script'", - "additionalProperties": false, - "patternProperties": { - "^.*$": { - "required": [ - "type" - ], - "additionalProperties": false, - "properties": { - "type": { - "enum": [ - "shell", - "dagger" - ] - }, - "description": { - "type": "string" - }, - "vars": { - "type": "object", - "title": "your collection of variables to be available to cuddle", - "patternProperties": { - "^.*$": { - "type": "string" - } - }, - "additionalProperties": false - }, - "args": { - "title": "arguments to send to the specified script", - "type": "object", - "patternProperties": { - "^.*$": { - "anyOf": [ - { - "type": "object", - "required": [ - "type", - "name" - ], - "properties": { - "type": { - "enum": [ - "flag" - ] - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "required": { - "type": "boolean" - }, - "default": { - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "type", - "key" - ], - "additionalProperties": false, - "properties": { - "type": { - "enum": [ - "env" - ] - }, - "description": { - "type": "string" - }, - "key": { - "title": "the environment key to pull arg from", - "type": "string" - } - } - } - ] - } - } - } - } - } - } - } - }, - "required": [ - "base" - ], - "type": "object", - "title": "Cuddle base schema" -} diff --git a/scripts/build_cuddle_image.sh b/scripts/build_cuddle_image.sh deleted file mode 100755 index 4ee050b..0000000 --- a/scripts/build_cuddle_image.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -e - -tag="$REGISTRY/$SERVICE:${COMMIT_SHA:0:10}" -latest_tag="$REGISTRY/$SERVICE:latest" - -echo "logging in" -docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - -echo "building image" -DOCKER_BUILDKIT=1 docker build -t "$tag" -t "$latest_tag" -f "$TMP/build_cuddle_image.Dockerfile" . - -echo "pushing image" -docker push "$tag" -docker push "$latest_tag" diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index c550a9e..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cargo install --path cuddle/ --force - -cuddle --version diff --git a/templates/build_cuddle_image.Dockerfile b/templates/build_cuddle_image.Dockerfile deleted file mode 100644 index 2c55862..0000000 --- a/templates/build_cuddle_image.Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM rustlang/rust:nightly as base - -RUN rustup target add x86_64-unknown-linux-musl - -RUN apt-get update -qq && \ - apt-get install -y \ - musl-tools \ - musl-dev - -RUN update-ca-certificates - -RUN apt-get update && apt-get upgrade -y -RUN apt-get install -y -q build-essential curl git - -WORKDIR /app/cuddle/ - -COPY . . - -RUN cargo install --target x86_64-unknown-linux-musl --path cuddle - -FROM docker:dind - -RUN apk add bash git kubectl - -ENV SLICE_VERSION=v1.2.7 -RUN wget -O kubectl-slice_linux_x86_64.tar.gz \ - "https://github.com/patrickdappollonio/kubectl-slice/releases/download/$SLICE_VERSION/kubectl-slice_linux_x86_64.tar.gz" && \ - tar -xf kubectl-slice_linux_x86_64.tar.gz && \ - chmod +x ./kubectl-slice && \ - mv ./kubectl-slice /usr/local/bin/kubectl-slice && \ - rm kubectl-slice_linux_x86_64.tar.gz - -RUN eval `ssh-agent` - -COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op - -COPY --from=base /usr/local/cargo/bin/ /usr/local/cargo/bin/ -ENV PATH="${PATH}:/usr/local/cargo/bin" diff --git a/templates/build_cuddle_image.Dockerfile.dockerignore b/templates/build_cuddle_image.Dockerfile.dockerignore deleted file mode 100644 index c4d70a6..0000000 --- a/templates/build_cuddle_image.Dockerfile.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.cuddle/ -.git/ -target/ diff --git a/templates/docker-compose.yaml b/templates/docker-compose.yaml new file mode 100644 index 0000000..8fae72a --- /dev/null +++ b/templates/docker-compose.yaml @@ -0,0 +1,15 @@ +version: "3" +services: + crdb: + restart: 'always' + image: 'cockroachdb/cockroach:v23.1.14' + command: 'start-single-node --advertise-addr 0.0.0.0 --insecure' + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"] + interval: '10s' + timeout: '30s' + retries: 5 + start_period: '20s' + ports: + - 8080:8080 + - '26257:26257'