Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and cleanup #125

Merged
merged 4 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 40 additions & 64 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ rust-version = "1.62"
[dependencies]
anyhow = "1.0.68"
clap = { version = "4.0.32", features = ["derive"] }
dirs = "4.0.0"
flate2 = "1.0.25"
guess_host_triple = "0.1.3"
reqwest = "0.11.12"
Expand All @@ -29,9 +28,8 @@ log = "0.4.17"
env_logger = "0.10.0"
embuild = { version = "0.31.0", features = ["espidf", "git"] }
strum = { version = "0.24", features = ["derive"] }
strum_macros = "0.24.3"
toml = "0.5.9"
directories-next = "2.0.0"
directories = "4.0.1"
serde = { version = "1.0.152", features = ["derive"] }
miette = { version = "5.5.0", features = ["fancy"] }
regex = "1.7.0"
Expand All @@ -41,16 +39,13 @@ update-informer = "0.6.0"
tokio = { version = "1.21.2", features = ["full"] }
async-trait = "0.1.60"

[target.'cfg(target_os = "linux")'.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

[dev-dependencies]
assert_fs = "1.0.10"
assert_cmd = "2.0.6"

[target.aarch64-unknown-linux-gnu.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

[target.x86_64-unknown-linux-gnu.dependencies]
openssl = { version = "0.10", features = ["vendored"] }

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }"
bin-dir = "{ bin }{ binary-ext }"
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
emoji, error::Error, host_triple::HostTriple, targets::Target, toolchain::rust::XtensaRust,
};
use directories_next::ProjectDirs;
use directories::ProjectDirs;
use log::info;
use miette::Result;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion src/host_triple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use miette::Result;
use serde::{Deserialize, Serialize};
use std::str::FromStr;
use strum::Display;
use strum_macros::EnumString;
use strum::EnumString;

#[derive(Display, Debug, Clone, EnumString, Deserialize, Serialize, Default)]
pub enum HostTriple {
Expand Down
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use dirs::home_dir;
use directories::BaseDirs;
use espup::{
config::Config,
emoji,
Expand Down Expand Up @@ -272,7 +272,7 @@ async fn install(args: InstallOpts) -> Result<()> {

info!("{} Installation successfully completed!", emoji::CHECK);
warn!(
"{} Please, source the export file, as state above, to properly setup the environment!",
"{} Please, source the export file, as stated above, to properly setup the environment!",
emoji::WARN
);
Ok(())
Expand Down Expand Up @@ -438,8 +438,10 @@ fn get_export_file(export_file: Option<PathBuf>) -> Result<PathBuf, Error> {
Ok(current_dir.join(export_file))
}
} else {
let home_dir = home_dir().unwrap();
Ok(home_dir.join(DEFAULT_EXPORT_FILE))
Ok(BaseDirs::new()
.unwrap()
.home_dir()
.join(DEFAULT_EXPORT_FILE))
}
}

Expand Down Expand Up @@ -493,14 +495,14 @@ pub fn check_arguments(
#[cfg(test)]
mod tests {
use crate::{export_environment, get_export_file, DEFAULT_EXPORT_FILE};
use dirs::home_dir;
use directories::BaseDirs;
use std::{env::current_dir, path::PathBuf};

#[test]
#[allow(unused_variables)]
fn test_get_export_file() {
// No arg provided
let home_dir = home_dir().unwrap();
let home_dir = BaseDirs::new().unwrap().home_dir().to_path_buf();
let export_file = home_dir.join(DEFAULT_EXPORT_FILE);
assert!(matches!(get_export_file(None), Ok(export_file)));
// Relative path
Expand Down
2 changes: 1 addition & 1 deletion src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use miette::Result;
use serde::{Deserialize, Serialize};
use std::{collections::HashSet, str::FromStr};
use strum::{Display, IntoEnumIterator};
use strum_macros::{EnumIter, EnumString};
use strum::{EnumIter, EnumString};

#[derive(
Clone, Copy, EnumIter, EnumString, PartialEq, Hash, Eq, Debug, Display, Deserialize, Serialize,
Expand Down
Loading