Skip to content

Commit

Permalink
Merge pull request #405 from Ziothh/main
Browse files Browse the repository at this point in the history
Feature: Allow skipping downloads of engines by setting env vars
  • Loading branch information
Brendonovich authored Oct 29, 2023
2 parents c852262 + 3c2371c commit 78cfbef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
16 changes: 1 addition & 15 deletions crates/cli/src/binaries/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ pub fn global_cache_dir() -> PathBuf {
.join(PRISMA_CLI_VERSION)
}

pub fn fetch_native(to_dir: &PathBuf) -> Result<(), String> {
if !to_dir.is_absolute() {
Err("to_dir must be absolute".to_string())?;
}

download_cli(to_dir)?;

for e in &ENGINES {
download_engine(&e.name, &to_dir)?;
}

Ok(())
}

pub fn download_cli(to_dir: &PathBuf) -> Result<(), String> {
let cli = prisma_cli_name();

Expand Down Expand Up @@ -92,7 +78,7 @@ pub fn download_cli(to_dir: &PathBuf) -> Result<(), String> {
Ok(())
}

fn download_engine(engine_name: &str, to_dir: &PathBuf) -> Result<(), String> {
pub fn download_engine(engine_name: &str, to_dir: &PathBuf) -> Result<(), String> {
let os_name = platform::binary_platform_name();

let to = platform::check_for_extension(
Expand Down
8 changes: 4 additions & 4 deletions crates/cli/src/prisma_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ use std::process::Command;
pub fn main(args: &Vec<String>) {
let dir = binaries::global_cache_dir();

binaries::fetch_native(&dir).unwrap();

binaries::download_cli(&dir).unwrap();
let prisma = binaries::prisma_cli_name();

let mut cmd = Command::new(dir.join(prisma));
let binary_name =
platform::check_for_extension(&platform::name(), &platform::binary_platform_name());

let mut cmd = Command::new(dir.join(prisma));

cmd.args(args);

cmd.envs(env::vars());
Expand All @@ -25,6 +24,7 @@ pub fn main(args: &Vec<String>) {
cmd.env(e.env, path);
}
Err(_) => {
binaries::download_engine(&e.name, &dir).unwrap();
let path = dir
.join(binaries::ENGINE_VERSION)
.join(format!("prisma-{}-{}", e.name, binary_name));
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod utils;

#[tokio::test]
async fn aaaa_run_migrations() -> TestResult {
let client = db::new_client().await.unwrap();
let client = db::PrismaClient::_builder().build().await.unwrap();

client._db_push().accept_data_loss().await.unwrap();

Expand Down

1 comment on commit 78cfbef

@vercel
Copy link

@vercel vercel bot commented on 78cfbef Oct 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.