From ec596ff22ba916440fffb3e17a87196dea136489 Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 29 Jul 2024 21:13:45 +0700 Subject: [PATCH 1/9] refactor: use `strum` to display enum as string --- Cargo.lock | 29 +++++++++++++++++++++++++++++ Cargo.toml | 1 + src/commands/get.rs | 4 ++-- src/commands/list.rs | 13 ++++--------- src/rgl/config.rs | 14 ++++++++++++-- src/rgl/filter.rs | 3 ++- 6 files changed, 50 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f72357c..5d1b93f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -762,6 +762,7 @@ dependencies = [ "semver", "serde", "serde_json", + "strum", "tempfile", "ureq", "uuid", @@ -828,6 +829,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + [[package]] name = "ryu" version = "1.0.18" @@ -920,6 +927,28 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "subtle" version = "2.6.1" diff --git a/Cargo.toml b/Cargo.toml index 703e601..3a39a7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ rayon = "1.10.0" semver = "1.0.23" serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.120" +strum = { version = "0.26.3", features = ["derive"] } tempfile = "3.10.1" ureq = "2.9.7" uuid = { version = "1.9.1", features = ["v4"] } diff --git a/src/commands/get.rs b/src/commands/get.rs index 920d1d3..21667ec 100644 --- a/src/commands/get.rs +++ b/src/commands/get.rs @@ -16,8 +16,8 @@ impl Command for Get { let config = Config::load()?; let mut session = Session::lock()?; let data_path = config.get_data_path(); - for (name, value) in config.get_filters() { - match FilterDefinition::from_value(value)? { + for (name, filter) in config.get_filters()? { + match filter { FilterDefinition::Remote(remote) => { info!("Downloading filter {name}..."); remote.install(&name, Some(&data_path), false)?; diff --git a/src/commands/list.rs b/src/commands/list.rs index 4406f04..c232878 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -1,7 +1,7 @@ use super::Command; use crate::log; use crate::rgl::{Config, FilterDefinition, GlobalFilters}; -use anyhow::{Context, Result}; +use anyhow::Result; use clap::Args; /// List filters defined in the `config.json` file @@ -29,15 +29,10 @@ fn list_project() -> Result<()> { let mut local_filters = vec![]; let mut remote_filters = vec![]; - for (name, value) in config.get_filters() { - let filter = FilterDefinition::from_value(value.to_owned())?; + for (name, filter) in config.get_filters()? { match filter { - FilterDefinition::Local(_) => { - let run_with = value["runWith"] - .as_str() - .context("Invalid filter definition")? - .to_owned(); - local_filters.push((name, run_with)); + FilterDefinition::Local(filter) => { + local_filters.push((name, filter.to_string())); } FilterDefinition::Remote(filter) => { remote_filters.push((name, filter.version)); diff --git a/src/rgl/config.rs b/src/rgl/config.rs index 29d6ffe..509f1ad 100644 --- a/src/rgl/config.rs +++ b/src/rgl/config.rs @@ -120,8 +120,18 @@ impl Config { }) } - pub fn get_filters(&self) -> BTreeMap { - self.regolith.filter_definitions.to_owned() + pub fn get_filters(&self) -> Result> { + let mut filters = BTreeMap::::new(); + for (name, value) in &self.regolith.filter_definitions { + let filter = FilterDefinition::from_value(value.to_owned()).map_err(|e| { + anyhow!( + "Invalid filter definition for {name}\n\ + >> {e}" + ) + })?; + filters.insert(name.to_owned(), filter); + } + Ok(filters) } pub fn add_filter(&mut self, name: &str, filter: &FilterDefinition) -> Result<()> { diff --git a/src/rgl/filter.rs b/src/rgl/filter.rs index e332f82..d727256 100644 --- a/src/rgl/filter.rs +++ b/src/rgl/filter.rs @@ -8,6 +8,7 @@ use enum_dispatch::enum_dispatch; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::path::{Path, PathBuf}; +use strum::Display; #[derive(Serialize, Deserialize)] #[serde(untagged)] @@ -33,7 +34,7 @@ impl FilterDefinition { } } -#[derive(Serialize, Deserialize)] +#[derive(Display, Serialize, Deserialize)] #[serde(rename_all = "camelCase", tag = "runWith")] #[enum_dispatch] pub enum LocalFilter { From b979dc4649903ff4f0ea75aa526a41ea2730f112 Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 29 Jul 2024 22:17:55 +0700 Subject: [PATCH 2/9] feat: add `rgl update` command --- src/commands/mod.rs | 2 ++ src/commands/update.rs | 51 ++++++++++++++++++++++++++++++++++++++++ src/main.rs | 1 + src/rgl/filter_remote.rs | 15 +++++++++++- 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/commands/update.rs diff --git a/src/commands/mod.rs b/src/commands/mod.rs index bb99ce2..2743746 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -10,6 +10,7 @@ mod list; mod remove; mod run; mod uninstall; +mod update; mod upgrade; mod watch; @@ -25,6 +26,7 @@ pub use self::list::*; pub use self::remove::*; pub use self::run::*; pub use self::uninstall::*; +pub use self::update::*; pub use self::upgrade::*; pub use self::watch::*; diff --git a/src/commands/update.rs b/src/commands/update.rs new file mode 100644 index 0000000..37bde39 --- /dev/null +++ b/src/commands/update.rs @@ -0,0 +1,51 @@ +use super::Command; +use crate::rgl::{Config, FilterDefinition, Session}; +use crate::{info, warn}; +use anyhow::{Context, Result}; +use clap::Args; + +/// Update filter(s) in the current project +#[derive(Args)] +pub struct Update { + filters: Vec, + #[arg(short, long)] + force: bool, +} + +impl Command for Update { + fn dispatch(&self) -> Result<()> { + let mut config = Config::load()?; + let mut session = Session::lock()?; + let data_path = config.get_data_path(); + + info!("Updating filters..."); + if self.filters.is_empty() { + for (name, filter) in config.get_filters()? { + if let FilterDefinition::Remote(mut remote) = filter { + remote + .update(&name, Some(&data_path), self.force) + .context(format!("Failed to update filter {name}"))?; + config.add_filter(&name, &remote.into())?; + } + } + } else { + for name in &self.filters { + let filter = config.get_filter(name)?; + if let FilterDefinition::Remote(mut remote) = filter { + remote + .update(name, Some(&data_path), self.force) + .context(format!("Failed to update filter {name}"))?; + config.add_filter(name, &remote.into())?; + } else { + warn!("Filter {name} is not a remote filter, skipping..."); + } + } + } + info!("Filters successfully updated"); + config.save()?; + session.unlock() + } + fn error_context(&self) -> String { + "Error updating filter".to_owned() + } +} diff --git a/src/main.rs b/src/main.rs index e24ab69..8681c13 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,6 +78,7 @@ enum Subcommands { Remove(Remove), Run(Run), Uninstall(Uninstall), + Update(Update), Upgrade(Upgrade), Watch(Watch), } diff --git a/src/rgl/filter_remote.rs b/src/rgl/filter_remote.rs index 9a643d4..bdaa492 100644 --- a/src/rgl/filter_remote.rs +++ b/src/rgl/filter_remote.rs @@ -3,7 +3,7 @@ use super::{ Subprocess, }; use crate::fs::{copy_dir, empty_dir, read_json, rimraf}; -use crate::info; +use crate::{info, warn}; use anyhow::{bail, Context, Result}; use semver::Version; use serde::{Deserialize, Serialize}; @@ -118,4 +118,17 @@ impl RemoteFilter { info!("Installing dependencies for {name}..."); filter.install_dependencies(&context) } + + pub fn update(&mut self, name: &str, data_path: Option<&Path>, force: bool) -> Result<()> { + let current_version = self.version.to_owned(); + let latest_version = Resolver::resolve_version(name, &self.url, Some("latest".to_owned()))?; + if current_version == latest_version { + warn!("Filter {name} is already up-to-date"); + return Ok(()); + } + info!("Updating filter {name} {current_version} → {latest_version}..."); + self.version = latest_version.to_owned(); + self.install(name, data_path, force)?; + Ok(()) + } } From 71b602f910f985576618b5c418213aedf24f90db Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 5 Aug 2024 12:55:52 +0700 Subject: [PATCH 3/9] refactor: change import source --- src/commands/info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/info.rs b/src/commands/info.rs index 90e768c..d19a423 100644 --- a/src/commands/info.rs +++ b/src/commands/info.rs @@ -1,5 +1,5 @@ +use super::Command; use crate::rgl::{get_cache_dir, get_global_filters_path, get_user_config_path}; -use crate::Command; use anyhow::Result; use clap::{crate_version, Args}; From 8277ff17874d697d098bf6b43c3c936b29cb2800 Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 16:07:13 +0700 Subject: [PATCH 4/9] fix: sort filter versions by semver --- src/rgl/resolver.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rgl/resolver.rs b/src/rgl/resolver.rs index 7acfc3c..f6a7788 100644 --- a/src/rgl/resolver.rs +++ b/src/rgl/resolver.rs @@ -38,7 +38,8 @@ impl Resolver { if data.url != url || data.versions.is_none() { return None; }; - let versions = data.versions.as_ref().unwrap(); + let mut versions = data.versions.to_owned().unwrap(); + versions.sort_by_key(|v| Version::parse(v).ok()); match &version_arg { Some(arg) if versions[1..].contains(arg) => Some(arg.to_owned()), None => versions.last().cloned(), @@ -73,15 +74,16 @@ impl Resolver { "Failed to get latest version from `{url}`. Is the url correct?" ))?; let output = String::from_utf8(output.stdout)?; - let tag = output + let mut tags: Vec = output .split('\n') .filter_map(|line| { line.split(&format!("refs/tags/{name}-")) .last() .and_then(|version| Version::parse(version).ok()) }) - .last(); - if let Some(tag) = tag { + .collect(); + tags.sort(); + if let Some(tag) = tags.last() { return Ok(tag.to_string()); } } From 97efcdd466f85582bd26f6a4917034cbf4c60a5a Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 17:23:29 +0700 Subject: [PATCH 5/9] feat: add `--profile` flag to add filters directly to a profile --- src/commands/add.rs | 14 +++++++++++--- src/rgl/config.rs | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/commands/add.rs b/src/commands/add.rs index 16d0840..428b62b 100644 --- a/src/commands/add.rs +++ b/src/commands/add.rs @@ -1,6 +1,6 @@ use super::Command; -use crate::info; use crate::rgl::{Config, RemoteFilter, Session}; +use crate::{info, warn}; use anyhow::Result; use clap::Args; @@ -9,6 +9,8 @@ use clap::Args; pub struct Add { #[arg(required = true)] filters: Vec, + #[arg(short, long, default_missing_value = "default", num_args = 0..)] + profile: Vec, #[arg(short, long)] force: bool, } @@ -22,9 +24,15 @@ impl Command for Add { info!("Adding filter {}...", arg); let (name, remote) = RemoteFilter::parse(arg)?; remote.install(&name, Some(&data_path), self.force)?; - - info!("Filter {name} successfully added"); + for profile_name in &self.profile { + if config.add_filter_to_profile(&name, profile_name) { + info!("Added filter {name} to {profile_name} profile"); + } else { + warn!("Profile {profile_name} not found, skipping..."); + } + } config.add_filter(&name, &remote.into())?; + info!("Filter {name} successfully added"); } config.save()?; session.unlock() diff --git a/src/rgl/config.rs b/src/rgl/config.rs index 509f1ad..3dea114 100644 --- a/src/rgl/config.rs +++ b/src/rgl/config.rs @@ -145,6 +145,20 @@ impl Config { self.regolith.filter_definitions.remove(name) } + pub fn add_filter_to_profile(&mut self, filter_name: &str, profile_name: &str) -> bool { + match self.regolith.profiles.get_mut(profile_name) { + Some(profile) => { + profile.filters.push(FilterRunner::Filter { + filter_name: filter_name.to_owned(), + arguments: None, + settings: None, + }); + true + } + None => false, + } + } + pub fn watch_project_files(&self) -> Result<()> { let mut watcher = Watcher::new()?; From 6216efdc5d69739ddfa1da02b95a8be3ef8bcddf Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 17:47:15 +0700 Subject: [PATCH 6/9] feat: remove filter from profiles when running `rgl remove` --- src/rgl/config.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rgl/config.rs b/src/rgl/config.rs index 3dea114..0f5f773 100644 --- a/src/rgl/config.rs +++ b/src/rgl/config.rs @@ -142,6 +142,12 @@ impl Config { } pub fn remove_filter(&mut self, name: &str) -> Option { + for profile in self.regolith.profiles.values_mut() { + profile.filters.retain(|filter| match filter { + FilterRunner::Filter { filter_name, .. } => filter_name != name, + _ => true, + }); + } self.regolith.filter_definitions.remove(name) } From 85d76e5a76ba4ee6f3333e7c1a8278b36f03bcd3 Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 18:03:50 +0700 Subject: [PATCH 7/9] chore: update deps --- Cargo.lock | 77 +++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 16 ++++++------ 2 files changed, 55 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d1b93f..c493915 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.8" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -173,9 +173,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.8" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -185,9 +185,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", @@ -323,9 +323,9 @@ dependencies = [ [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "either" @@ -477,9 +477,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown", @@ -580,6 +580,12 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + [[package]] name = "miniz_oxide" version = "0.7.4" @@ -800,11 +806,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "log", + "once_cell", "ring", "rustls-pki-types", "rustls-webpki", @@ -820,9 +827,9 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring", "rustls-pki-types", @@ -858,18 +865,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", @@ -878,11 +885,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -968,14 +976,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1073,9 +1082,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.7" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ "base64", "flate2", @@ -1083,7 +1092,6 @@ dependencies = [ "once_cell", "rustls", "rustls-pki-types", - "rustls-webpki", "url", "webpki-roots", ] @@ -1107,9 +1115,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", ] @@ -1194,6 +1202,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" diff --git a/Cargo.toml b/Cargo.toml index 3a39a7a..f98b7f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,23 +8,23 @@ name = "rgl" [dependencies] anyhow = "1.0.86" -clap = { version = "4.5.8", features = ["cargo", "derive"] } +clap = { version = "4.5.16", features = ["cargo", "derive"] } dialoguer = "0.11.0" -dunce = "1.0.4" +dunce = "1.0.5" enum_dispatch = "0.3.13" fslock = "0.2.1" -indexmap = { version = "2.2.6", features = ["serde"] } +indexmap = { version = "2.4.0", features = ["serde"] } notify = "6.1.1" notify-debouncer-mini = "0.4.1" once_cell = "1.19.0" paris = { version = "1.5.15", features = ["macros"] } rayon = "1.10.0" semver = "1.0.23" -serde = { version = "1.0.203", features = ["derive"] } -serde_json = "1.0.120" +serde = { version = "1.0.208", features = ["derive"] } +serde_json = "1.0.125" strum = { version = "0.26.3", features = ["derive"] } -tempfile = "3.10.1" -ureq = "2.9.7" -uuid = { version = "1.9.1", features = ["v4"] } +tempfile = "3.12.0" +ureq = "2.10.1" +uuid = { version = "1.10.0", features = ["v4"] } walkdir = "2.5.0" zip = "0.6.6" From 9cebc30cd4f36f98fe78335055fcf8e2003fa00a Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 18:59:27 +0700 Subject: [PATCH 8/9] feat: add a tip message when failing to create symlink on windows --- src/fs.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fs.rs b/src/fs.rs index 983d484..9366e08 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -124,7 +124,14 @@ fn symlink_impl(from: &Path, to: &Path) -> io::Result<()> { #[cfg(windows)] fn symlink_impl(from: &Path, to: &Path) -> io::Result<()> { use std::os::windows; - windows::fs::symlink_dir(canonicalize(from)?, to) + windows::fs::symlink_dir(canonicalize(from)?, to).map_err(|e| match e.raw_os_error() { + Some(1314) => io::Error::new( + io::ErrorKind::Other, + "A required privilege is not held by the client. (os error 1314)\n\ + [?] Try enabling developer mode in Windows settings or run the terminal as an administrator", + ), + _ => e, + }) } pub fn symlink(from: impl AsRef, to: impl AsRef) -> Result<()> { From 98d16f2c8d28a5ba6f873e0642fc11b59eb54765 Mon Sep 17 00:00:00 2001 From: ink0rr Date: Mon, 19 Aug 2024 19:00:49 +0700 Subject: [PATCH 9/9] chore: bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c493915..b8f5eb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -751,7 +751,7 @@ dependencies = [ [[package]] name = "rgl" -version = "0.10.1" +version = "0.11.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index f98b7f6..3d44b26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rgl" -version = "0.10.1" +version = "0.11.0" edition = "2021" [[bin]]