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

feat: use cargo generate instead of hardcoding examples source code #888

Merged
merged 14 commits into from
Jun 9, 2023
Merged
Prev Previous commit
Next Next commit
remove the Shuttle.toml file, if it exists
  • Loading branch information
paulotten committed Jun 7, 2023
commit 65ab862983616adb17b9c59c4947ff2aee95bb7a
16 changes: 16 additions & 0 deletions cargo-shuttle/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ pub fn cargo_generate(path: PathBuf, name: &ProjectName, framework: Template) ->

set_crate_name(&path, name.as_str()).with_context(|| "Failed to set crate name.")?;

remove_shuttle_toml(&path);

Ok(())
}

Expand All @@ -236,3 +238,17 @@ fn set_crate_name(path: &Path, name: &str) -> Result<()> {

Ok(())
}

/*
Currently Shuttle.toml only has a project name override.
This project name will already be in use, so the file is useless.

If we start putting more things in Shuttle.toml we may wish to re-evaluate.
*/
fn remove_shuttle_toml(path: &Path) {
let mut path = path.to_path_buf();
path.push("Shuttle.toml");

// this file only exists for some of the examples, it's fine if we don't find it
_ = std::fs::remove_file(path);
}