diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml deleted file mode 100644 index ea41e6d..0000000 --- a/.github/workflows/nix.yaml +++ /dev/null @@ -1,90 +0,0 @@ -name: "CI" -on: - pull_request: - push: - -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#check - - clippy: - runs-on: ubuntu-latest - needs: check - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#clippy - - test: - runs-on: ubuntu-latest - needs: check - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#test - - matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - id: set-matrix - run: echo "matrix={\"target\":$(nix eval --json ".#targets.x86_64-linux")}" | tee $GITHUB_OUTPUT - - build: - runs-on: ubuntu-latest - needs: [check, matrix] - strategy: - fail-fast: false - matrix: ${{fromJson(needs.matrix.outputs.matrix)}} - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#${{ matrix.target }} - - uses: actions/upload-artifact@v3 - with: - name: notify-redis-${{ matrix.target }} - path: result/bin/* - - docker: - runs-on: ubuntu-latest - needs: [build, clippy, test] - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#dockerImage - - name: Push image - if: github.ref == 'refs/heads/master' - run: | - skopeo copy --dest-creds="${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }}" "docker-archive:$(nix build .#dockerImage --print-out-paths)" "docker://icewind1991/notify-redis" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7be5392..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Release - -on: - release: - types: [created] - - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - id: set-matrix - run: echo "matrix={\"target\":$(nix eval --json ".#targets.x86_64-linux")}" | tee $GITHUB_OUTPUT - - build: - runs-on: ubuntu-latest - needs: matrix - strategy: - fail-fast: false - matrix: ${{fromJson(needs.matrix.outputs.matrix)}} - steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - - uses: icewind1991/attic-action@v1 - with: - name: ci - instance: https://cache.icewind.me - authToken: '${{ secrets.ATTIC_TOKEN }}' - - run: nix build .#${{ matrix.target }} - - name: Upload binary to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: result/bin/cube - asset_name: notify-redis-${{ matrix.target }} - tag: ${{ github.ref }} diff --git a/.gitignore b/.gitignore index 8f5f0a2..f972867 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ /test /target **/*.rs.bk -.direnv -result \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c2f420f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: required +services: +- docker +- redis-server +install: +- docker pull ekidd/rust-musl-builder:latest +script: +- "./travis-build.sh notify-redis ${TRAVIS_OS_NAME}" +- "./test.sh ./notify-redis-${TRAVIS_OS_NAME}" +deploy: + provider: releases + api_key: + secure: h4tCundDFU+g7sVF6prABpg7vs/smKindNMYSfPFVXhJuhxZ27ibLtXzf+SiD5Crqy5g5MKOIP8tQxAKI/7TScPkL8rOljBE5zRo9sCCcy4rikDWgGPRkCCuLfv9UTcEN9L6nwMdfAGMlWtcEkd46QsaoCm1ht/FQXngjV/uLmZyoMoGY01uupl75u9zi5OQiYNkJPWge2ceoFGIKvc3Zvmj1Le16zjIdjKmaWiIrUT4A4yYEulkLjujiOZNQOWF6wl7ZWKdG5B7E91brrv/pqP2TBe8axRS8RsBsrqv/n4LxvGTr4AZrLpMX6k/lCo28QBNzjrtq3+iGhxC6BQNg7qdgOh7CUYRt08O6LCtPnCgM9t2cXfrkYKlj3aoSeRqYozjxH2t4cfxdtgZczvX7tLPosLuFnU8OtiLPuB46PeSx+YbYcRGERzSy/vsvvbcGeABNpWC7/0rOvAdPMZiFYY+UARXWNd+Oegi1RQle7yPAU/FjHIA4qOcLhj3u6hyxb6UFwiHlzRXqE9GWawze6TkXLMbbkX7EJ6Mcr6FU3EBFpJ/5EatItzb8XyatyQrW5bZm+FZ4eXOwCNnwDTUkjOkYH1UlW2BcBSuodbVT+3avM8nBRSmOEaXXtrNpFF7ROCsdKIHUQpWq/2aDy9ccKnnClcLtdlvjCO5WAODXrk= + file: notify-redis-linux + skip_cleanup: true + on: + repo: icewind1991/notify-redis + tags: true diff --git a/Cargo.lock b/Cargo.lock index 5b1f8cb..835844c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,1102 +1,326 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - [[package]] -name = "addr2line" -version = "0.19.0" +name = "bitflags" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anstream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" - -[[package]] -name = "anstyle-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] [[package]] name = "bitflags" -version = "1.3.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytes" -version = "1.4.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "4.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" -dependencies = [ - "anstream", - "anstyle", - "bitflags", - "clap_lex", - "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", -] - -[[package]] -name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - -[[package]] -name = "color-eyre" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" -dependencies = [ - "backtrace", - "color-spantrace", - "eyre", - "indenter", - "once_cell", - "owo-colors", - "tracing-error", -] - -[[package]] -name = "color-spantrace" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba75b3d9449ecdccb27ecbc479fdc0b87fa2dd43d2f8298f9bf0e59aacc8dce" -dependencies = [ - "once_cell", - "owo-colors", - "tracing-core", - "tracing-error", -] - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "eyre" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" -dependencies = [ - "indenter", - "once_cell", -] - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - -[[package]] -name = "file-id" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13be71e6ca82e91bc0cb862bebaac0b2d1924a5a1d970c822b2f98b63fda8c3" -dependencies = [ - "winapi-util", -] [[package]] name = "filetime" -version = "0.2.21" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.16", - "windows-sys 0.48.0", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "form_urlencoded" -version = "1.2.0" +name = "fsevent" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "percent-encoding", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fsevent-sys" -version = "4.1.0" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" dependencies = [ - "libc", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - [[package]] name = "idna" -version = "0.4.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - [[package]] name = "inotify" -version = "0.9.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" dependencies = [ - "bitflags", - "inotify-sys", - "libc", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "inotify-sys" -version = "0.1.5" +name = "kernel32-sys" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" dependencies = [ - "libc", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "kqueue" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" -dependencies = [ - "bitflags", - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" -version = "0.2.147" +version = "0.2.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] -name = "linux-raw-sys" -version = "0.3.8" +name = "log" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ - "autocfg", - "scopeguard", + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.4.19" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ - "adler", + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "matches" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "mio" -version = "0.8.8" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", + "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "notify" -version = "6.0.1" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51" dependencies = [ - "bitflags", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "mio", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "notify-debouncer-full" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416969970ec751a5d702a88c6cd19ac1332abe997fce43f96db0418550426241" -dependencies = [ - "crossbeam-channel", - "file-id", - "notify", - "parking_lot", - "walkdir", + "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "inotify 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "notify-redis" version = "0.1.0" dependencies = [ - "clap", - "color-eyre", - "notify", - "notify-debouncer-full", - "rand", - "redis", - "serde", - "serde_json", - "tempfile", - "time", -] - -[[package]] -name = "object" -version = "0.30.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "owo-colors" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.3.5", - "smallvec", - "windows-targets 0.48.1", + "notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redis 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "percent-encoding" -version = "2.3.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro2" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] [[package]] name = "redis" -version = "0.23.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea8c51b5dc1d8e5fd3350ec8167f464ec0995e79f2e90a075b63371500d557f" dependencies = [ - "combine", - "itoa", - "percent-encoding", - "ryu", - "url", + "sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -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 = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.37.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "same-file" -version = "1.0.6" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scopeguard" -version = "1.1.0" +name = "sha1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] -name = "serde" -version = "1.0.164" +name = "slab" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.164" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "2.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" -dependencies = [ - "autocfg", - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] [[package]] name = "time" -version = "0.3.22" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ - "itoa", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-error" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" -dependencies = [ - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "sharded-slab", - "thread_local", - "tracing-core", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +dependencies = [ + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] [[package]] name = "url" -version = "2.4.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", + "idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "walkdir" -version = "2.3.3" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ - "same-file", - "winapi-util", + "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "winapi" -version = "0.3.9" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.45.0" +name = "ws2_32-sys" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets 0.42.2", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[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.1", -] - -[[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", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "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]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[metadata] +"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" +"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" +"checksum filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "714653f3e34871534de23771ac7b26e999651a0a228f47beb324dfdf1dd4b10f" +"checksum fsevent 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "c4bbbf71584aeed076100b5665ac14e3d85eeb31fdbb45fbd41ef9a682b5ec05" +"checksum fsevent-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a772d36c338d07a032d5375a36f15f9a7043bf0cb8ce7cee658e037c6032874" +"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" +"checksum inotify 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887fcc180136e77a85e6a6128579a719027b1bab9b1c38ea4444244fe262c20c" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" +"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" +"checksum mio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a637d1ca14eacae06296a008fa7ad955347e34efcb5891cfd8ba05491a37907e" +"checksum miow 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3e690c5df6b2f60acd45d56378981e827ff8295562fc8d34f573deb267a59cd1" +"checksum net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "9044faf1413a1057267be51b5afba8eb1090bd2231c693664aa1db716fe1eae0" +"checksum nix 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfb3ddedaa14746434a02041940495bf11325c22f6d36125d3bdd56090d50a79" +"checksum notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5c3812da3098f210a0bb440f9c008471a031aa4c1de07a264fdd75456c95a4eb" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum redis 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02a92e223490cc63d9230c4cdf132a48ce154ab1e063558e3841e219c2ea3f91" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" +"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" +"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c" +"checksum slab 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d807fd58c4181bbabed77cb3b891ba9748241a552bcc5be698faaebefc54f46e" +"checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" +"checksum url 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f808aadd8cfec6ef90e4a14eb46f24511824d1ac596b9682703c87056c8678b7" +"checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index 9779b1e..9aeafc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,21 +2,7 @@ name = "notify-redis" version = "0.1.0" authors = ["Robin Appelman "] -edition = "2018" [dependencies] -notify = "6.0" -notify-debouncer-full = "0.2.0" -redis = { version = "0.23", default-features = false } -time = { version = "0.3.22", features = ["serde", "formatting", "parsing"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -color-eyre = "0.6" -clap = { version = "4.3.9", features = ["derive"] } - -[dev-dependencies] -rand = "0.8.5" -tempfile = "3" - -[profile.release] -lto = true +notify = "4.0.0" +redis = "0.8.0" \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bf36602 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +all: target/x86_64-unknown-linux-musl/release/notify-redis + +target/x86_64-unknown-linux-musl/release/notify-redis: Cargo.toml src/main.rs + docker run --rm -it -v "$(CURDIR):/home/rust/src" ekidd/rust-musl-builder cargo build --release + +.PHONY: test + +test: target/x86_64-unknown-linux-musl/release/notify-redis + ./test.sh \ No newline at end of file diff --git a/README.md b/README.md index d774980..87ad085 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,11 @@ # Notify Redis -[![Build Status](https://travis-ci.org/icewind1991/notify-redis.svg?branch=master)](https://travis-ci.org/icewind1991/notify-redis) - Push filesystem notifications into a redis list -## Getting the binary - -There are 3 ways for getting the binary to run - -- Grab a pre-compiled static binary from the [releases](https://github.com/icewind1991/notify-redis/releases) page. -- By running `nix build` to use docker to build a static binary (requires `nix`) -- By running `cargo build` (requires `rust`) - ## Usage ``` notify-redis /path/to/watch redis://localhost list_name ``` -The recorded filesystem events will be pushed to the configured list. -Details about how events are encoded can be found [here](https://github.com/icewind1991/nc-fs-events/) - -Filesystem events are debounced and merge where applicable (e.g. `touch foo.txt`, `mv foo.txt bar.txt` will result in one write event for `bar.txt`) +Filesystem events are debounced and merge where applicable (e.g. `touch foo.txt`, `mv foo.txt bar.txt` will result in one write event for `bar.txt`) \ No newline at end of file diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 7a8b668..0000000 --- a/flake.lock +++ /dev/null @@ -1,129 +0,0 @@ -{ - "nodes": { - "cross-naersk": { - "inputs": { - "naersk": [ - "naersk" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1687811683, - "narHash": "sha256-j0+0y2CBlwrbVkVEZajjAy9gdzHRNCq8hQTRe+QXTAQ=", - "owner": "icewind1991", - "repo": "cross-naersk", - "rev": "5e987fcf0521602914773016b173403d0fa873f9", - "type": "github" - }, - "original": { - "owner": "icewind1991", - "repo": "cross-naersk", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1687709756, - "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "naersk": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1687852486, - "narHash": "sha256-2rXkhKUVQxbVaC+TITPpILiy/dSbordOLs87eoWHYxA=", - "owner": "nix-community", - "repo": "naersk", - "rev": "df10963b956962913b693a638746a95d6c506404", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1687829761, - "narHash": "sha256-QRe1Y8SS3M4GeC58F/6ajz6V0ZLUVWX3ZAMgov2N3/g=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9790f3242da2152d5aa1976e3e4b8b414f4dd206", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-23.05", - "type": "indirect" - } - }, - "root": { - "inputs": { - "cross-naersk": "cross-naersk", - "flake-utils": "flake-utils", - "naersk": "naersk", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688005946, - "narHash": "sha256-aEK0CNCIfE6ALQuztj86sl4PZUzMDnbp68r6I5YW+AE=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "2925988bbc95f94e7b2f822b914ac5612a636e93", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 93ad399..0000000 --- a/flake.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ - inputs = { - flake-utils.url = "github:numtide/flake-utils"; - nixpkgs.url = "nixpkgs/nixos-23.05"; - naersk.url = "github:nix-community/naersk"; - naersk.inputs.nixpkgs.follows = "nixpkgs"; - rust-overlay.url = "github:oxalica/rust-overlay"; - rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; - rust-overlay.inputs.flake-utils.follows = "flake-utils"; - cross-naersk.url = "github:icewind1991/cross-naersk"; - cross-naersk.inputs.nixpkgs.follows = "nixpkgs"; - cross-naersk.inputs.naersk.follows = "naersk"; - }; - - outputs = { - self, - nixpkgs, - flake-utils, - naersk, - rust-overlay, - cross-naersk, - }: - flake-utils.lib.eachDefaultSystem ( - system: let - overlays = [(import rust-overlay)]; - pkgs = import nixpkgs { - inherit system overlays; - }; - lib = pkgs.lib; - - cross-naersk' = pkgs.callPackage cross-naersk {inherit naersk;}; - - hostTarget = pkgs.hostPlatform.config; - targets = [ - "x86_64-unknown-linux-musl" - "i686-unknown-linux-musl" - "armv7-unknown-linux-musleabihf" - "aarch64-unknown-linux-musl" - ]; - src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["Cargo.*" "(src|tests)(/.*)?"]; - - nearskOpt = { - pname = "notify-redis"; - root = src; - }; - buildTarget = target: (cross-naersk'.buildPackage target) nearskOpt; - hostNaersk = cross-naersk'.hostNaersk; - in rec { - # `nix build` - packages = nixpkgs.lib.attrsets.genAttrs targets buildTarget // rec { - notify-redis = pkgs.callPackage (import ./package.nix) {}; - default = notify-redis; - check = hostNaersk.buildPackage (nearskOpt // { - mode = "check"; - }); - clippy = hostNaersk.buildPackage (nearskOpt // { - mode = "clippy"; - }); - test = hostNaersk.buildPackage (nearskOpt // { - mode = "test"; - nativeBuildInputs = [pkgs.redis]; - overrideMain = x: x // { - preBuild = '' - redis-server & - export redisPID=$! - ''; - postBuild = '' - kill $redisPID - ''; - }; - }); - dockerImage = pkgs.dockerTools.buildImage { - name = "icewind1991/notify-redis"; - tag = "latest"; - copyToRoot = [notify-redis]; - config = { - Cmd = ["${notify-redis}/bin/notify-redis"]; - }; - }; - }; - - inherit targets; - - # `nix develop` - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy]; - }; - } - ); -} diff --git a/package.nix b/package.nix deleted file mode 100644 index f01e8e9..0000000 --- a/package.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - rustPlatform, - lib, -}: let - src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["Cargo.*" "(src|tests)(/.*)?"]; -in - rustPlatform.buildRustPackage rec { - version = "0.2.1"; - pname = "notify-redis"; - - inherit src; - - cargoLock = { - lockFile = ./Cargo.lock; - }; - - doCheck = false; - - meta = with lib; { - description = "Push filesystem notifications into a redis list"; - homepage = "https://github.com/icewind1991/notify-redis"; - license = licenses.mit; - platforms = platforms.linux; - }; - } diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 51bc065..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,105 +0,0 @@ -use color_eyre::{eyre::WrapErr, Result}; -use notify::event::{ModifyKind, RenameMode}; -use notify::{EventKind, RecursiveMode, Watcher}; -use notify_debouncer_full::{new_debouncer, DebouncedEvent}; -use redis::{Client, Commands, Connection, IntoConnectionInfo}; -use serde::{Deserialize, Serialize}; -use std::path::{Path, PathBuf}; -use std::sync::mpsc::channel; -use std::time::Duration; -use time::OffsetDateTime; - -#[derive(Serialize, Deserialize, Debug)] -#[serde(tag = "event")] -#[serde(rename_all = "snake_case")] -pub enum Event { - Modify { - path: PathBuf, - #[serde(with = "time::serde::iso8601")] - time: OffsetDateTime, - }, - Move { - from: PathBuf, - to: PathBuf, - #[serde(with = "time::serde::iso8601")] - time: OffsetDateTime, - }, - Delete { - path: PathBuf, - #[serde(with = "time::serde::iso8601")] - time: OffsetDateTime, - }, - None, -} - -impl From for Event { - fn from(event: DebouncedEvent) -> Self { - let now = OffsetDateTime::now_utc(); - let elapsed = event.time.elapsed(); - let time = now - elapsed; - - let path_count = event.paths.len(); - let mut paths = event.event.paths.into_iter(); - - match (event.event.kind, path_count) { - (EventKind::Modify(ModifyKind::Name(RenameMode::Both)), 2..) => Event::Move { - from: paths.next().unwrap(), - to: paths.next().unwrap(), - time, - }, - (EventKind::Modify(_) | EventKind::Create(_), 1..) => Event::Modify { - path: paths.next().unwrap(), - time, - }, - (EventKind::Remove(_), 1..) => Event::Delete { - path: paths.next().unwrap(), - time, - }, - _ => Event::None, - } - } -} - -pub fn watch( - path: impl AsRef, - redis_connect: impl IntoConnectionInfo, - redis_list: &str, - debounce: Duration, -) -> Result<()> { - let (tx, rx) = channel(); - - let mut watcher = new_debouncer(debounce, None, tx)?; - let client = Client::open(redis_connect).wrap_err("Invalid redis connection")?; - let mut con = client - .get_connection() - .wrap_err("Failed to open redis connection")?; - - watcher - .watcher() - .watch(path.as_ref(), RecursiveMode::Recursive)?; - - while let Ok(event) = rx.recv() { - for event in event.into_iter().flatten() { - push_event(event, &mut con, redis_list).wrap_err("Failed to send event to redis")?; - } - } - Ok(()) -} - -fn push_event(event: DebouncedEvent, con: &mut Connection, list: &str) -> Result<()> { - match format_event(event) { - Some(formatted_event) => { - println!("{}", formatted_event); - Ok(con.lpush(list, formatted_event)?) - } - None => Ok(()), - } -} - -fn format_event(event: DebouncedEvent) -> Option { - let event: Event = event.into(); - match &event { - Event::None => None, - _ => serde_json::to_string(&event).ok(), - } -} diff --git a/src/main.rs b/src/main.rs index 3f71c4e..bdfb14e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,28 +1,76 @@ -use clap::Parser; -use color_eyre::Result; -use notify_redis::watch; -use std::path::PathBuf; +extern crate notify; +extern crate redis; + +use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher}; +use redis::{Client, Commands, Connection, RedisResult}; +use std::env; +use std::result::Result; +use std::sync::mpsc::channel; use std::time::Duration; -/// Push filesystem notifications into a redis list -#[derive(Parser, Debug)] -#[command(author, version, about, long_about = None)] -struct Args { - /// Folder to watch - path: PathBuf, - /// Redis connection string - redis_connect: String, - /// Redis list to push changes to - redis_list: String, +#[derive(Debug)] +enum WatchError { + Notify(notify::Error), + Redis(redis::RedisError), } -fn main() -> Result<()> { - let args: Args = Args::parse(); - watch( - args.path, - args.redis_connect, - &args.redis_list, - Duration::from_secs(2), - )?; - Ok(()) +impl From for WatchError { + fn from(err: notify::Error) -> WatchError { + WatchError::Notify(err) + } +} + +impl From for WatchError { + fn from(err: redis::RedisError) -> WatchError { + WatchError::Redis(err) + } +} + +fn watch(path: String, redis_connect: String, redis_list: String) -> Result<(), WatchError> { + let (tx, rx) = channel(); + + let mut watcher: RecommendedWatcher = Watcher::new(tx, Duration::from_secs(2))?; + let client = Client::open(redis_connect.as_ref())?; + let con = client.get_connection()?; + + watcher.watch(path, RecursiveMode::Recursive)?; + + loop { + match rx.recv() { + Ok(event) => push_event(event, &con, &redis_list)?, + Err(e) => println!("watch error: {:?}", e), + } + } +} + +fn push_event(event: DebouncedEvent, con: &Connection, list: &String) -> RedisResult<()> { + match format_event(event) { + Some(formatted_event) => { + println!("{}", formatted_event); + return con.lpush(list, formatted_event); + }, + None => Ok(()) + } +} + +fn format_event(event: DebouncedEvent) -> Option { + match event { + DebouncedEvent::Write(path) | + DebouncedEvent::Create(path) | + DebouncedEvent::Chmod(path) => Some(format!("write|{}", path.to_str()?)), + DebouncedEvent::Rename(from, to) => Some(format!("rename|{}|{}", from.to_str()?, to.to_str()?)), + DebouncedEvent::Remove(path) => Some(format!("remove|{}", path.to_str()?)), + _ => None + } +} + +fn main() { + let args: Vec<_> = env::args().collect(); + if args.len() == 4 { + if let Err(e) = watch(args[1].to_owned(), args[2].to_owned(), args[3].to_owned()) { + println!("error: {:?}", e) + } + } else { + println!("usage: {} ", args[0]) + } } diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..e24eafd --- /dev/null +++ b/test.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +function assert_notify { + actual="$(redis-cli rpop notify)" + if [ "$actual" != "$1" ] + then + echo "'$actual' not equal to expected '$1'" + killall $(basename $bin) + exit 1 + fi +} + +mkdir -p test +rm test/* +redis-cli del notify + +bin=$1; +: ${bin:="target/x86_64-unknown-linux-musl/release/notify-redis"} + +echo "running tests with $bin" + +$bin "$PWD/test" redis://localhost notify & + +sleep 1 + +echo foo > test/foo.txt +sleep 2 + +assert_notify "write|$(pwd)/test/foo.txt" +assert_notify '' + +mv test/foo.txt test/bar.txt +sleep 2 + +assert_notify "rename|$(pwd)/test/foo.txt|$(pwd)/test/bar.txt" +assert_notify "" + +rm test/bar.txt +echo asd > test/bar.txt + +sleep 2 + +assert_notify "write|$(pwd)/test/bar.txt" +assert_notify "" + +rm test/bar.txt +sleep 2 +echo asd > test/bar.txt + +sleep 2 + +assert_notify "remove|$(pwd)/test/bar.txt" +assert_notify "write|$(pwd)/test/bar.txt" +assert_notify "" + +killall $(basename $bin) \ No newline at end of file diff --git a/tests/tests.rs b/tests/tests.rs deleted file mode 100644 index 5979ff8..0000000 --- a/tests/tests.rs +++ /dev/null @@ -1,162 +0,0 @@ -use notify_redis::{watch, Event}; -use redis::{Client, Commands, Connection, ConnectionInfo}; -use std::fs::{remove_file, rename, write}; -use std::path::Path; -use std::thread::sleep; -use std::time::Duration; -use tempfile::tempdir; - -fn cleanup(redis: ConnectionInfo, list: &str) { - let client = Client::open(redis).unwrap(); - let mut con = client.get_connection().unwrap(); - con.del::<_, ()>(list).unwrap(); -} - -struct EventList { - redis: Connection, - list: String, -} - -impl EventList { - fn new(redis: ConnectionInfo, list: &str) -> Self { - let client = Client::open(redis).unwrap(); - let redis = client.get_connection().unwrap(); - EventList { - redis, - list: list.into(), - } - } - - fn next(&mut self) -> Option { - let raw: Option = self.redis.rpop(&self.list, None).unwrap(); - raw.map(|raw| serde_json::from_str(&raw).unwrap()) - } -} - -fn spawn_watch( - path: &Path, - redis_connect: ConnectionInfo, - list: &str, -) -> std::thread::JoinHandle<()> { - let path = path.to_path_buf(); - let list = list.to_string(); - std::thread::spawn(move || { - if let Err(e) = watch(path, redis_connect, &list, Duration::from_millis(1)) { - eprintln!("watch error {:#}", e); - } - }) -} - -#[test] -fn test_basic() { - let list = format!("notify_redis_test_{}", rand::random::()); - let redis_connect: ConnectionInfo = "redis://localhost".parse().unwrap(); - cleanup(redis_connect.clone(), &list); - let dir = tempdir().unwrap(); - let mut event_list = EventList::new(redis_connect.clone(), &list); - spawn_watch(dir.path(), redis_connect.clone(), &list); - - sleep(Duration::from_millis(10)); - - write(dir.path().join("foo.txt"), "foo").unwrap(); - - sleep(Duration::from_millis(10)); - - assert!( - matches!(event_list.next(), Some(Event::Modify {path ,..}) if path.ends_with("foo.txt")) - ); - assert!(matches!(event_list.next(), None)); -} - -#[test] -fn test_rename_debounce() { - let list = format!("notify_redis_test_{}", rand::random::()); - let redis_connect: ConnectionInfo = "redis://localhost".parse().unwrap(); - cleanup(redis_connect.clone(), &list); - let dir = tempdir().unwrap(); - let mut event_list = EventList::new(redis_connect.clone(), &list); - spawn_watch(dir.path(), redis_connect.clone(), &list); - - sleep(Duration::from_millis(10)); - - write(dir.path().join("foo.txt"), "foo").unwrap(); - rename(dir.path().join("foo.txt"), dir.path().join("bar.txt")).unwrap(); - - sleep(Duration::from_millis(10)); - - assert!( - matches!(event_list.next(), Some(Event::Modify {path ,..}) if path.ends_with("bar.txt")) - ); - assert!(matches!(event_list.next(), None)); -} - -#[test] -fn test_rename() { - let list = format!("notify_redis_test_{}", rand::random::()); - let redis_connect: ConnectionInfo = "redis://localhost".parse().unwrap(); - cleanup(redis_connect.clone(), &list); - let dir = tempdir().unwrap(); - let mut event_list = EventList::new(redis_connect.clone(), &list); - spawn_watch(dir.path(), redis_connect.clone(), &list); - - sleep(Duration::from_millis(10)); - - write(dir.path().join("foo.txt"), "foo").unwrap(); - sleep(Duration::from_millis(10)); - rename(dir.path().join("foo.txt"), dir.path().join("bar.txt")).unwrap(); - - sleep(Duration::from_millis(10)); - - assert!( - matches!(event_list.next(), Some(Event::Modify {path ,..}) if path.ends_with("foo.txt")) - ); - assert!( - matches!(event_list.next(), Some(Event::Move {from, to ,..}) if from.ends_with("foo.txt") && to.ends_with("bar.txt")) - ); - assert!(matches!(dbg!(event_list.next()), None)); -} - -#[test] -fn test_delete() { - let list = format!("notify_redis_test_{}", rand::random::()); - let redis_connect: ConnectionInfo = "redis://localhost".parse().unwrap(); - cleanup(redis_connect.clone(), &list); - let dir = tempdir().unwrap(); - let mut event_list = EventList::new(redis_connect.clone(), &list); - spawn_watch(dir.path(), redis_connect.clone(), &list); - - sleep(Duration::from_millis(10)); - - write(dir.path().join("foo.txt"), "foo").unwrap(); - sleep(Duration::from_millis(10)); - remove_file(dir.path().join("foo.txt")).unwrap(); - - sleep(Duration::from_millis(10)); - - assert!( - matches!(event_list.next(), Some(Event::Modify {path ,..}) if path.ends_with("foo.txt")) - ); - assert!( - matches!(event_list.next(), Some(Event::Delete {path ,..}) if path.ends_with("foo.txt")) - ); - assert!(matches!(dbg!(event_list.next()), None)); -} - -#[test] -fn test_delete_debounce() { - let list = format!("notify_redis_test_{}", rand::random::()); - let redis_connect: ConnectionInfo = "redis://localhost".parse().unwrap(); - cleanup(redis_connect.clone(), &list); - let dir = tempdir().unwrap(); - let mut event_list = EventList::new(redis_connect.clone(), &list); - spawn_watch(dir.path(), redis_connect.clone(), &list); - - sleep(Duration::from_millis(10)); - - write(dir.path().join("foo.txt"), "foo").unwrap(); - remove_file(dir.path().join("foo.txt")).unwrap(); - - sleep(Duration::from_millis(10)); - - assert!(matches!(dbg!(event_list.next()), None)); -} diff --git a/travis-build.sh b/travis-build.sh new file mode 100755 index 0000000..fb2cc4e --- /dev/null +++ b/travis-build.sh @@ -0,0 +1,7 @@ +#!/bin/sh +echo "Building static binaries using ekidd/rust-musl-builder" +docker build -t build-"$1"-image . +docker run -it --name build-"$1" build-"$1"-image +docker cp build-"$1":/home/rust/src/target/x86_64-unknown-linux-musl/release/"$1" "$1-$2" +docker rm build-"$1" +docker rmi build-"$1"-image \ No newline at end of file