Skip to content

Commit

Permalink
Restructure store folders layout (#181)
Browse files Browse the repository at this point in the history
* Restructure folders layout

* Write a readme in store root
  • Loading branch information
j178 authored Feb 17, 2025
1 parent 2f74128 commit d5f9a7d
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 467 deletions.
139 changes: 15 additions & 124 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ ctrlc = "3.4.5"
dunce = "1.0.5"
etcetera = "0.8.0"
fancy-regex = "0.14.0"
fs-err = "3.1.0"
fs-err = { version = "3.1.0", features = ["tokio"] }
fs2 = "0.4.3"
futures = "0.3.31"
hex = "0.4.3"
http = "1.1.0"
indicatif = "0.17.8"
indoc = "2.0.5"
itertools = "0.14.0"
md-5 = "0.10.6"
miette = { version = "7.5.0", features = ["fancy-no-backtrace"] }
owo-colors = "4.1.0"
rand = "0.9.0"
rayon = "1.10.0"
reqwest = { version = "0.12.9", default-features = false }
rusqlite = { version = "0.33.0", features = ["bundled"] }
same-file = "1.0.6"
seahash = "4.1.0"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = "1.0.132"
serde_yaml = "0.9.34"
Expand Down
13 changes: 7 additions & 6 deletions src/cli/run/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ fn fill_envs(
to_ref: Option<&String>,
args: &RunExtraArgs,
) -> HashMap<&'static str, String> {
// TODO: how to change these env vars?
let mut env = HashMap::new();
env.insert("PRE_COMMIT", "1".into());

Expand Down Expand Up @@ -244,24 +245,24 @@ fn get_skips() -> Vec<String> {
.split(',')
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.collect::<Vec<_>>(),
.collect(),
_ => vec![],
}
}

async fn install_hook(hook: &Hook, env_dir: PathBuf) -> Result<()> {
async fn install_hook(hook: &Hook, env_dir: &Path) -> Result<()> {
debug!(%hook, target = %env_dir.display(), "Install environment");

if env_dir.try_exists()? {
debug!(
env_dir = %env_dir.display(),
"Removing existing environment directory",
);
fs_err::remove_dir_all(&env_dir)?;
fs_err::tokio::remove_dir_all(env_dir).await?;
}

hook.language.install(hook).await?;
hook.mark_installed()?;
hook.mark_as_installed().await?;

Ok(())
}
Expand All @@ -270,8 +271,8 @@ pub async fn install_hooks(hooks: &[Hook], reporter: &HookInstallReporter) -> Re
let to_install = hooks
.iter()
.filter(|hook| !hook.installed())
.filter_map(|hook| hook.environment_dir().map(|env_dir| (hook, env_dir)))
.unique_by(|(_, env_dir)| env_dir.clone());
.filter_map(|hook| hook.env_path().map(|env_dir| (hook, env_dir)))
.unique_by(|(_, env_dir)| *env_dir);

let mut tasks = futures::stream::iter(to_install)
.map(|(hook, env_dir)| async move {
Expand Down
Loading

0 comments on commit d5f9a7d

Please sign in to comment.