Skip to content

Commit

Permalink
Merge pull request #13 from LvlAndFarm/add-path-source
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinblackman authored Oct 27, 2023
2 parents 1ac6a3d + 8f50248 commit a1b547a
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 71 deletions.
120 changes: 50 additions & 70 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cargo-husky = { version = "1.5.0", default-features = false, features = ["user-h
insta = { version = "1.31.0", features = ["yaml"] }

[package.metadata.bin]
cargo-binstall = { version = "1.2.0" }
cargo-binstall = { version = "1.4.4" }
cargo-cmd = { version = "0.3.1" }
cargo-deny = { version = "0.13.5" }
cargo-dist = { version = "0.1.0-prerelease.10" }
Expand Down
2 changes: 2 additions & 0 deletions src/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub fn cargo_install(
} else if let Some(rev) = &binary_package.rev {
cmd_prefix.arg("--rev").arg(rev);
}
} else if let Some(path) = &binary_package.path {
cmd_prefix.arg("--path").arg(path);
}

if let Some(bin_target) = &binary_package.bin_target {
Expand Down
29 changes: 29 additions & 0 deletions src/binary_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mod cargo_install {
branch: None,
tag: None,
rev: None,
path: None,
default_features: None,
features: None,
},
Expand All @@ -55,6 +56,7 @@ mod cargo_install {
branch: None,
tag: None,
rev: None,
path: None,
default_features: None,
features: None,
},
Expand All @@ -76,6 +78,7 @@ mod cargo_install {
branch: None,
tag: None,
rev: Some("8a1cd3d2538460d1e8920bf86cf6e2aa982eb69d".to_string()),
path: None,
default_features: None,
features: None,
},
Expand All @@ -97,6 +100,7 @@ mod cargo_install {
branch: Some("testbranch".to_string()),
tag: None,
rev: None,
path: None,
default_features: None,
features: None,
},
Expand All @@ -118,6 +122,29 @@ mod cargo_install {
branch: None,
tag: Some("v0.2.1".to_string()),
rev: None,
path: None,
default_features: None,
features: None,
},
"./target/debug".into(),
);

assert!(res.is_ok());
}

#[test]
fn it_builds_successfully_with_path() {
let res = cargo_install(
metadata::BinaryPackage {
bin_target: None,
package: "cargo-run-bin".to_string(),
locked: None,
version: "1.4.1".to_string(),
git: None,
branch: None,
tag: None,
rev: None,
path: Some(String::from(".")),
default_features: None,
features: None,
},
Expand All @@ -143,6 +170,7 @@ mod binstall {
branch: None,
tag: None,
rev: None,
path: None,
default_features: None,
features: None,
},
Expand All @@ -164,6 +192,7 @@ mod binstall {
branch: None,
tag: None,
rev: None,
path: None,
default_features: None,
features: None,
},
Expand Down
Loading

0 comments on commit a1b547a

Please sign in to comment.