From 07cb71e6f494128b658f247d67a279c5aa641031 Mon Sep 17 00:00:00 2001 From: MordechaiHadad Date: Mon, 23 Oct 2023 09:52:48 +0300 Subject: [PATCH 1/6] nice --- Cargo.lock | 59 ++++++++++++++++++++++++++---------------------------- Cargo.toml | 2 +- bob.norg | 16 --------------- 3 files changed, 29 insertions(+), 48 deletions(-) delete mode 100644 bob.norg diff --git a/Cargo.lock b/Cargo.lock index f7d3b7b..75294b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -178,7 +178,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", - "winreg", + "winreg 0.10.1", "yansi", "zip", ] @@ -224,9 +224,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -531,9 +531,9 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1071,9 +1071,9 @@ checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "20b9b67e2ca7dd9e9f9285b759de30ff538aab981abaaf7bc9bd90b84a0126c3" dependencies = [ "base64", "bytes", @@ -1110,7 +1110,7 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg", + "winreg 0.50.0", ] [[package]] @@ -1170,9 +1170,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" dependencies = [ "ring", "untrusted", @@ -1234,18 +1234,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.183" +version = "1.0.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.185" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec" dependencies = [ "proc-macro2", "quote", @@ -1740,9 +1740,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-streams" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" +checksum = "b4609d447824375f43e1ffbc051b50ad8f4b3ae8219680c94452ea05eb240ac7" dependencies = [ "futures-util", "js-sys", @@ -1761,24 +1761,11 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "winapi" @@ -1952,6 +1939,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "xattr" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 855d8cf..7417a4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,7 @@ version = "0.2" optional = false [target.'cfg(target_os = "macos")'.dependencies] -flate2 = "1.0" +flate2 = "1.0.26" tar = "0.4" [target."cfg(windows)".dependencies] diff --git a/bob.norg b/bob.norg deleted file mode 100644 index 7b4d7d8..0000000 --- a/bob.norg +++ /dev/null @@ -1,16 +0,0 @@ -@document.meta - title: bob - description: - authors: morde - categories: - created: 2022-04-24 - version: 0.0.11 -@end - -* Roadmap - - [ ] Add ARM support - - [x] Add configuration - - [x] Make the list command more visually appealing - - [x] Allow building neovim from source - -- [x] Rewrite how to get currently used version - - [ ] Allow passing env variables in config file From cfcb1f1da2c004d5b303ba1f0fc9be4d5465840a Mon Sep 17 00:00:00 2001 From: MordechaiHadad Date: Mon, 23 Oct 2023 10:47:15 +0300 Subject: [PATCH 2/6] fixed: not parsing nightly rollback hash --- Cargo.lock | 239 ++++++++++++++++-------------- src/cli.rs | 1 + src/handlers/install_handler.rs | 7 + src/handlers/mod.rs | 3 + src/handlers/uninstall_handler.rs | 8 +- src/handlers/update_handler.rs | 6 +- src/helpers/version/mod.rs | 16 +- src/helpers/version/types.rs | 3 +- 8 files changed, 165 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e46cc6..52492cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2135563fb5c609d2b2b87c1e8ce7bc41b0b45430fa9661f457981503dd5bf0" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -52,9 +52,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -66,15 +66,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -150,9 +150,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bob-nvim" @@ -190,9 +190,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -253,9 +253,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", @@ -263,9 +263,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.4" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -275,9 +275,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.1" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4110a1e6af615a9e6d0a36f805d5c99099f8bab9b8042f5bc1fa220a4a89e36f" +checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" dependencies = [ "clap", ] @@ -371,30 +371,19 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" 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 = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" @@ -404,15 +393,15 @@ checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -614,7 +603,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -650,16 +639,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -705,9 +694,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itoa" @@ -732,21 +721,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "linux-raw-sys" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -769,9 +758,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -819,9 +808,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -863,7 +852,7 @@ version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -913,13 +902,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -956,9 +945,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -1011,16 +1000,25 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" -version = "1.9.5" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.8", - "regex-syntax 0.7.5", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -1034,13 +1032,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.5", + "regex-syntax 0.8.2", ] [[package]] @@ -1051,15 +1049,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64", "bytes", @@ -1085,6 +1083,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -1122,11 +1121,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.13" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -1156,9 +1155,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -1220,18 +1219,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", @@ -1263,9 +1262,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -1296,15 +1295,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -1312,9 +1311,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -1334,15 +1333,36 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +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" @@ -1362,25 +1382,25 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.3.5", "rustix", "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -1425,9 +1445,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -1437,7 +1457,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -1475,9 +1495,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -1495,11 +1515,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -1507,9 +1526,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -1518,9 +1537,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -1776,10 +1795,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets 0.48.5", ] diff --git a/src/cli.rs b/src/cli.rs index 9543188..5f60ff5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -105,6 +105,7 @@ pub async fn start(config: Config) -> Result<()> { InstallResult::NightlyIsUpdated => { info!("Nightly up to date!"); } + InstallResult::GivenNightlyRollback => () } } Cli::Sync => { diff --git a/src/handlers/install_handler.rs b/src/handlers/install_handler.rs index 1e2b4e6..e6d4539 100644 --- a/src/handlers/install_handler.rs +++ b/src/handlers/install_handler.rs @@ -31,6 +31,7 @@ pub async fn start( let is_version_installed = helpers::version::is_version_installed(&version.tag_name, config).await?; + if is_version_installed && version.version_type != VersionType::Nightly { return Ok(InstallResult::VersionAlreadyInstalled); @@ -73,8 +74,13 @@ pub async fn start( } } VersionType::Hash => handle_building_from_source(version, config).await, + VersionType::NightlyRollback => Ok(PostDownloadVersionType::None), }?; + if downloaded_file == PostDownloadVersionType::None { + return Ok(InstallResult::GivenNightlyRollback) + } + if let PostDownloadVersionType::Standard(downloaded_file) = downloaded_file { unarchive::start(downloaded_file).await? } @@ -235,6 +241,7 @@ async fn download_version( } } VersionType::Hash => handle_building_from_source(version, config).await, + VersionType::NightlyRollback => Ok(PostDownloadVersionType::None), } } diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 077f95c..e38d371 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -14,9 +14,12 @@ pub enum InstallResult { InstallationSuccess(String), VersionAlreadyInstalled, NightlyIsUpdated, + GivenNightlyRollback } +#[derive(PartialEq)] pub enum PostDownloadVersionType { + None, Standard(LocalVersion), Hash, } diff --git a/src/handlers/uninstall_handler.rs b/src/handlers/uninstall_handler.rs index 57055ab..28c3a45 100644 --- a/src/handlers/uninstall_handler.rs +++ b/src/handlers/uninstall_handler.rs @@ -1,9 +1,11 @@ +use std::path::Path; + use anyhow::{anyhow, Result}; use reqwest::Client; use tokio::fs; use tracing::{info, warn}; -use crate::{config::Config, helpers::{self, directories}}; +use crate::{config::Config, helpers::{self, directories, version::types::VersionType}}; pub async fn start(version: &str, config: Config) -> Result<()> { let client = Client::new(); @@ -19,7 +21,9 @@ pub async fn start(version: &str, config: Config) -> Result<()> { Err(error) => return Err(anyhow!(error)), }; - fs::remove_dir_all(&format!("{}/{}", downloads_dir.display(), version.tag_name)).await?; + let path = downloads_dir.join(&version.tag_name); + + fs::remove_dir_all(path).await?; info!("Successfully uninstalled version: {}", version.tag_name); Ok(()) } diff --git a/src/handlers/update_handler.rs b/src/handlers/update_handler.rs index 457fb93..d53fb92 100644 --- a/src/handlers/update_handler.rs +++ b/src/handlers/update_handler.rs @@ -14,7 +14,7 @@ pub async fn start(data: Update, client: &Client, config: Config) -> Result<()> if is_version_installed(&stable.tag_name, &config).await? { match install_handler::start(&mut stable, client, &config).await? { InstallResult::VersionAlreadyInstalled => info!("Stable is already updated!"), - InstallResult::InstallationSuccess(_) | InstallResult::NightlyIsUpdated => (), + InstallResult::InstallationSuccess(_) | InstallResult::NightlyIsUpdated | InstallResult::GivenNightlyRollback => (), } did_update = true; } @@ -23,7 +23,7 @@ pub async fn start(data: Update, client: &Client, config: Config) -> Result<()> let mut nightly = crate::version::parse_version_type(client, "nightly").await?; match install_handler::start(&mut nightly, client, &config).await? { InstallResult::NightlyIsUpdated => info!("Nightly is already updated!"), - InstallResult::InstallationSuccess(_) | InstallResult::VersionAlreadyInstalled => () + InstallResult::InstallationSuccess(_) | InstallResult::VersionAlreadyInstalled | InstallResult::GivenNightlyRollback => () } did_update = true; @@ -45,7 +45,7 @@ pub async fn start(data: Update, client: &Client, config: Config) -> Result<()> match install_handler::start(&mut version, client, &config).await? { InstallResult::NightlyIsUpdated => info!("Nightly is already updated!"), InstallResult::VersionAlreadyInstalled => info!("Stable is already updated!"), - InstallResult::InstallationSuccess(_) => (), + InstallResult::InstallationSuccess(_) | InstallResult::GivenNightlyRollback => (), } Ok(()) } diff --git a/src/helpers/version/mod.rs b/src/helpers/version/mod.rs index 7b68923..e772797 100644 --- a/src/helpers/version/mod.rs +++ b/src/helpers/version/mod.rs @@ -7,7 +7,7 @@ use crate::{config::Config, helpers::version::types::UpstreamVersion}; use anyhow::{anyhow, Context, Result}; use regex::Regex; use reqwest::Client; -use std::path::{Path, PathBuf}; +use std::{path::{Path, PathBuf}, fs::set_permissions}; use tokio::{ fs::{self, File}, io::AsyncWriteExt, @@ -51,6 +51,18 @@ pub async fn parse_version_type(client: &Client, version: &str) -> Result = version.split('-').collect(); + + if separated_version[0] == "nightly" && alphanumeric_regex.is_match(separated_version[1]) { + return Ok(ParsedVersion { + tag_name: version.to_string(), + version_type: VersionType::NightlyRollback, + non_parsed_string: version.to_string() + }); + } + Err(anyhow!("Please provide a proper version string")) } } @@ -78,7 +90,7 @@ pub async fn is_version_installed(version: &str, config: &Config) -> Result Date: Mon, 23 Oct 2023 10:56:43 +0300 Subject: [PATCH 3/6] change: quit earlier when nightly rollback input is given --- src/handlers/install_handler.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/handlers/install_handler.rs b/src/handlers/install_handler.rs index e6d4539..14668af 100644 --- a/src/handlers/install_handler.rs +++ b/src/handlers/install_handler.rs @@ -24,6 +24,10 @@ pub async fn start( client: &Client, config: &Config, ) -> Result { + if version.version_type == VersionType::NightlyRollback { + return Ok(InstallResult::GivenNightlyRollback) + } + let root = directories::get_downloads_directory(config).await?; env::set_current_dir(&root)?; @@ -77,10 +81,6 @@ pub async fn start( VersionType::NightlyRollback => Ok(PostDownloadVersionType::None), }?; - if downloaded_file == PostDownloadVersionType::None { - return Ok(InstallResult::GivenNightlyRollback) - } - if let PostDownloadVersionType::Standard(downloaded_file) = downloaded_file { unarchive::start(downloaded_file).await? } From f2bdd20a71bd60db8fea9a967eea90527e2d4fef Mon Sep 17 00:00:00 2001 From: MordechaiHadad Date: Mon, 23 Oct 2023 10:59:46 +0300 Subject: [PATCH 4/6] clippy chore --- src/handlers/uninstall_handler.rs | 3 +-- src/helpers/version/mod.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/handlers/uninstall_handler.rs b/src/handlers/uninstall_handler.rs index 28c3a45..65c8514 100644 --- a/src/handlers/uninstall_handler.rs +++ b/src/handlers/uninstall_handler.rs @@ -1,11 +1,10 @@ -use std::path::Path; use anyhow::{anyhow, Result}; use reqwest::Client; use tokio::fs; use tracing::{info, warn}; -use crate::{config::Config, helpers::{self, directories, version::types::VersionType}}; +use crate::{config::Config, helpers::{self, directories}}; pub async fn start(version: &str, config: Config) -> Result<()> { let client = Client::new(); diff --git a/src/helpers/version/mod.rs b/src/helpers/version/mod.rs index e772797..f9c7678 100644 --- a/src/helpers/version/mod.rs +++ b/src/helpers/version/mod.rs @@ -7,7 +7,7 @@ use crate::{config::Config, helpers::version::types::UpstreamVersion}; use anyhow::{anyhow, Context, Result}; use regex::Regex; use reqwest::Client; -use std::{path::{Path, PathBuf}, fs::set_permissions}; +use std::{path::{Path, PathBuf}}; use tokio::{ fs::{self, File}, io::AsyncWriteExt, From 380a79658af1699d1d4352244788480d2e367bf4 Mon Sep 17 00:00:00 2001 From: MordechaiHadad Date: Wed, 8 Nov 2023 11:37:17 +0200 Subject: [PATCH 5/6] change: just use commit associated with the nightly rollback --- src/handlers/install_handler.rs | 14 ++++---------- src/helpers/version/mod.rs | 12 +++++++----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/handlers/install_handler.rs b/src/handlers/install_handler.rs index 14668af..0089002 100644 --- a/src/handlers/install_handler.rs +++ b/src/handlers/install_handler.rs @@ -125,8 +125,6 @@ async fn handle_rollback(config: &Config) -> Result<()> { fs::remove_dir_all(oldest_path).await?; } - let id = generate_random_nightly_id(); - // handle this for older installations of nightly instead of introducing breaking changes cfg_if::cfg_if! { if #[cfg(unix)] { @@ -145,11 +143,13 @@ async fn handle_rollback(config: &Config) -> Result<()> { } } + let nightly_file = fs::read_to_string("nightly/bob.json").await?; + let mut json_struct: UpstreamVersion = serde_json::from_str(&nightly_file)?; + let id: String = json_struct.target_commitish.as_ref().unwrap().chars().take(7).collect(); + info!("Creating rollback: nightly-{id}"); filesystem::copy_dir("nightly", format!("nightly-{id}")).await?; - let nightly_file = fs::read_to_string("nightly/bob.json").await?; - let mut json_struct: UpstreamVersion = serde_json::from_str(&nightly_file)?; json_struct.tag_name += &format!("-{id}"); let json_file = serde_json::to_string(&json_struct)?; @@ -158,12 +158,6 @@ async fn handle_rollback(config: &Config) -> Result<()> { Ok(()) } -fn generate_random_nightly_id() -> String { - use rand::distributions::{Alphanumeric, DistString}; - - Alphanumeric.sample_string(&mut rand::thread_rng(), 8) -} - async fn print_commits( client: &Client, local: &UpstreamVersion, diff --git a/src/helpers/version/mod.rs b/src/helpers/version/mod.rs index f9c7678..0acadb2 100644 --- a/src/helpers/version/mod.rs +++ b/src/helpers/version/mod.rs @@ -7,7 +7,7 @@ use crate::{config::Config, helpers::version::types::UpstreamVersion}; use anyhow::{anyhow, Context, Result}; use regex::Regex; use reqwest::Client; -use std::{path::{Path, PathBuf}}; +use std::path::{Path, PathBuf}; use tokio::{ fs::{self, File}, io::AsyncWriteExt, @@ -44,7 +44,6 @@ pub async fn parse_version_type(client: &Client, version: &str) -> Result Result = version.split('-').collect(); + let separated_version: Vec<&str> = version.split('-').collect(); - if separated_version[0] == "nightly" && alphanumeric_regex.is_match(separated_version[1]) { + if separated_version[0] == "nightly" + && (hash_regex.is_match(separated_version[1]) + || alphanumeric_regex.is_match(separated_version[1])) + { return Ok(ParsedVersion { tag_name: version.to_string(), version_type: VersionType::NightlyRollback, - non_parsed_string: version.to_string() + non_parsed_string: version.to_string(), }); } From 81db93e4137a484c68afa20d6b48e1d8ef2622e4 Mon Sep 17 00:00:00 2001 From: MordechaiHadad Date: Wed, 8 Nov 2023 11:40:54 +0200 Subject: [PATCH 6/6] change: update the description for the update command --- src/cli.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 5f60ff5..17b11e9 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -60,7 +60,7 @@ enum Cli { shell: Shell, }, - /// Update existing version + /// Update existing version |nightly|stable|--all| Update(Update), }