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

Fix cargo-generate installation #983

Merged
merged 2 commits into from
Jun 17, 2021
Merged
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
14 changes: 9 additions & 5 deletions src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ fn prebuilt_url(tool: &Tool, version: &str) -> Result<String, failure::Error> {
},
Tool::CargoGenerate => {
Ok(format!(
"https://github.com/ashleygwilliams/cargo-generate/releases/download/v{0}/cargo-generate-v{0}-{1}.tar.gz",
Krate::new(&Tool::CargoGenerate)?.max_version,
"https://github.com/cargo-generate/cargo-generate/releases/download/v{0}/cargo-generate-v{0}-{1}.tar.gz",
// Krate::new(&Tool::CargoGenerate)?.max_version,
"0.5.1", // latest released binary [#907](https://github.com/rustwasm/wasm-pack/issues/907)
target
))
},
Expand Down Expand Up @@ -257,14 +258,17 @@ pub fn cargo_install(
_ => tool.to_string(),
};
let mut cmd = Command::new("cargo");

cmd.arg("install")
.arg("--force")
.arg(crate_name)
.arg("--version")
.arg(version)
.arg("--root")
.arg(&tmp);

if version != "latest" {
cmd.arg("--version").arg(version);
}

let context = format!("Installing {} with cargo", tool);
child::run(cmd, "cargo install").context(context)?;

Expand All @@ -274,7 +278,7 @@ pub fn cargo_install(
// little renaming here.
let binaries: Result<Vec<&str>, failure::Error> = match tool {
Tool::WasmBindgen => Ok(vec!["wasm-bindgen", "wasm-bindgen-test-runner"]),
Tool::CargoGenerate => Ok(vec!["cargo-genrate"]),
Tool::CargoGenerate => Ok(vec!["cargo-generate"]),
Tool::WasmOpt => bail!("Cannot install wasm-opt with cargo."),
};

Expand Down