From 05cf6b149f14e03323491f4cffe4109d2e1e7162 Mon Sep 17 00:00:00 2001 From: Kent <92845901+kentsday@users.noreply.github.com> Date: Thu, 8 Jun 2023 14:35:56 +0800 Subject: [PATCH] update package name (#7) * update package name * fix yaml * update renovate --- .github/workflows/build.yaml | 42 +++++++ .gitignore | 2 +- config-cli/Cargo.lock => Cargo.lock | 109 ++++++++---------- config-cli/Cargo.toml => Cargo.toml | 9 +- config-cli/.idea/.gitignore | 8 -- config-cli/.idea/vcs.xml | 6 - renovate.json | 11 +- {config-cli/src => src}/main.rs | 0 {config-cli/src => src}/test_data/1.env | 0 {config-cli/src => src}/test_data/2.env | 0 .../src => src}/test_data/duplicate.env | 0 .../test_data/duplicate_config.toml | 0 .../test_data/exist_config.toml | 0 .../src => src}/test_data/new_verify.toml | 0 src/test_data/old.toml | 11 ++ .../src => src}/test_data/old_verify.toml | 0 src/test_data/overwrite.toml | 11 ++ src/test_data/overwrite_config.toml | 11 ++ .../test_data/overwrite_verify.toml | 0 19 files changed, 141 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/build.yaml rename config-cli/Cargo.lock => Cargo.lock (93%) rename config-cli/Cargo.toml => Cargo.toml (51%) delete mode 100644 config-cli/.idea/.gitignore delete mode 100644 config-cli/.idea/vcs.xml rename {config-cli/src => src}/main.rs (100%) rename {config-cli/src => src}/test_data/1.env (100%) rename {config-cli/src => src}/test_data/2.env (100%) rename {config-cli/src => src}/test_data/duplicate.env (100%) rename config-cli/src/test_data/overwrite.toml => src/test_data/duplicate_config.toml (100%) rename config-cli/src/test_data/old.toml => src/test_data/exist_config.toml (100%) rename {config-cli/src => src}/test_data/new_verify.toml (100%) create mode 100644 src/test_data/old.toml rename {config-cli/src => src}/test_data/old_verify.toml (100%) create mode 100644 src/test_data/overwrite.toml create mode 100644 src/test_data/overwrite_config.toml rename {config-cli/src => src}/test_data/overwrite_verify.toml (100%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..5a45606 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,42 @@ +name: Build +on: + pull_request: + branches: + - main + push: + branches: + - main + +permissions: + contents: write + +jobs: + ut: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + components: llvm-tools-preview + - name: Download grcov + run: | + mkdir -p "${HOME}/.local/bin" + curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" + echo "$HOME/.local/bin" >> $GITHUB_PATH + - run: | + export CARGO_INCREMENTAL=0 + export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" + export RUSTDOCFLAGS="-C instrument-coverage" + cargo build $CARGO_OPTIONS + cargo test $CARGO_OPTIONS + grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov + +# - uses: codecov/codecov-action@v3 +# with: +# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos +# files: ./src/coverage.lcov # optional +# flags: unittests # optional +# name: codecov-umbrella # optional +# fail_ci_if_error: true # optional (default = false) \ No newline at end of file diff --git a/.gitignore b/.gitignore index 94531b9..af6b761 100644 --- a/.gitignore +++ b/.gitignore @@ -97,7 +97,7 @@ target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +# Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk diff --git a/config-cli/Cargo.lock b/Cargo.lock similarity index 93% rename from config-cli/Cargo.lock rename to Cargo.lock index 07c78ac..7dcf60b 100644 --- a/config-cli/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -191,20 +191,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "config-cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "env-file-reader", - "glob", - "log", - "simple_logger", - "thiserror", - "toml", -] - [[package]] name = "crunchy" version = "0.2.2" @@ -264,6 +250,20 @@ dependencies = [ "logos", ] +[[package]] +name = "env-to-config-toml" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "env-file-reader", + "glob", + "log", + "simple_logger", + "thiserror", + "toml", +] + [[package]] name = "errno" version = "0.3.1" @@ -299,9 +299,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -428,9 +428,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "linux-raw-sys" @@ -440,9 +440,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -500,9 +500,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "parking_lot" @@ -516,15 +516,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -554,9 +554,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -579,6 +579,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -586,15 +595,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -641,9 +650,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" [[package]] name = "serde_spanned" @@ -753,9 +762,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "libc", @@ -884,37 +893,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[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.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] diff --git a/config-cli/Cargo.toml b/Cargo.toml similarity index 51% rename from config-cli/Cargo.toml rename to Cargo.toml index e5f55fb..c16ae2a 100644 --- a/config-cli/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,14 @@ [package] -name = "config-cli" +name = "env-to-config-toml" version = "0.1.0" edition = "2021" +authors = ["Deland Labs Core Dev "] +license = "MIT" +description = "A tool to search files" +homepage = "https://github.com/Deland-Labs/env_to_config_toml" +repository = "https://github.com/Deland-Labs/env_to_config_toml" +keywords = ["cli", "env"] +categories = ["command-line-utilities"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/config-cli/.idea/.gitignore b/config-cli/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/config-cli/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/config-cli/.idea/vcs.xml b/config-cli/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/config-cli/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/renovate.json b/renovate.json index 39a2b6e..d30ed1f 100644 --- a/renovate.json +++ b/renovate.json @@ -2,5 +2,14 @@ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "config:base" + ], + "packageRules": [ + { + "groupName": "all dependencies", + "groupSlug": "all", + "matchPackagePatterns": [ + "*" + ] + } ] -} +} \ No newline at end of file diff --git a/config-cli/src/main.rs b/src/main.rs similarity index 100% rename from config-cli/src/main.rs rename to src/main.rs diff --git a/config-cli/src/test_data/1.env b/src/test_data/1.env similarity index 100% rename from config-cli/src/test_data/1.env rename to src/test_data/1.env diff --git a/config-cli/src/test_data/2.env b/src/test_data/2.env similarity index 100% rename from config-cli/src/test_data/2.env rename to src/test_data/2.env diff --git a/config-cli/src/test_data/duplicate.env b/src/test_data/duplicate.env similarity index 100% rename from config-cli/src/test_data/duplicate.env rename to src/test_data/duplicate.env diff --git a/config-cli/src/test_data/overwrite.toml b/src/test_data/duplicate_config.toml similarity index 100% rename from config-cli/src/test_data/overwrite.toml rename to src/test_data/duplicate_config.toml diff --git a/config-cli/src/test_data/old.toml b/src/test_data/exist_config.toml similarity index 100% rename from config-cli/src/test_data/old.toml rename to src/test_data/exist_config.toml diff --git a/config-cli/src/test_data/new_verify.toml b/src/test_data/new_verify.toml similarity index 100% rename from config-cli/src/test_data/new_verify.toml rename to src/test_data/new_verify.toml diff --git a/src/test_data/old.toml b/src/test_data/old.toml new file mode 100644 index 0000000..2a68efe --- /dev/null +++ b/src/test_data/old.toml @@ -0,0 +1,11 @@ + +[env] +E = "asd||||qwe" +F = "asd||||qwe||||asd||||qaaa||||ccc" +G = "123||||qwe||||ddd||||qaaa||||ccc" + + +[test] +Y = "asd||||qwe" +U = "asd||||qwe||||asd||||qaaa||||ccc" +I = "123||||qwe||||ddd||||qaaa||||ccc" diff --git a/config-cli/src/test_data/old_verify.toml b/src/test_data/old_verify.toml similarity index 100% rename from config-cli/src/test_data/old_verify.toml rename to src/test_data/old_verify.toml diff --git a/src/test_data/overwrite.toml b/src/test_data/overwrite.toml new file mode 100644 index 0000000..a47e523 --- /dev/null +++ b/src/test_data/overwrite.toml @@ -0,0 +1,11 @@ + +[env] +A = "11||||qwe" +B = "22||||qwe||||asd||||qaaa||||ccc" +C = "33||||qwe||||ddd||||qaaa||||ccc" + + +[test] +Y = "asd||||qwe" +U = "asd||||qwe||||asd||||qaaa||||ccc" +I = "123||||qwe||||ddd||||qaaa||||ccc" \ No newline at end of file diff --git a/src/test_data/overwrite_config.toml b/src/test_data/overwrite_config.toml new file mode 100644 index 0000000..a47e523 --- /dev/null +++ b/src/test_data/overwrite_config.toml @@ -0,0 +1,11 @@ + +[env] +A = "11||||qwe" +B = "22||||qwe||||asd||||qaaa||||ccc" +C = "33||||qwe||||ddd||||qaaa||||ccc" + + +[test] +Y = "asd||||qwe" +U = "asd||||qwe||||asd||||qaaa||||ccc" +I = "123||||qwe||||ddd||||qaaa||||ccc" \ No newline at end of file diff --git a/config-cli/src/test_data/overwrite_verify.toml b/src/test_data/overwrite_verify.toml similarity index 100% rename from config-cli/src/test_data/overwrite_verify.toml rename to src/test_data/overwrite_verify.toml