Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

suggest wrangler init if wrangler.toml does not exist #1239

Merged
merged 3 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions src/settings/toml/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ pub struct Manifest {

impl Manifest {
pub fn new(config_path: &Path) -> Result<Self, failure::Error> {
failure::ensure!(
config_path.exists(),
"wrangler.toml not found; run `wrangler init` to create one."
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add link to docs about how to configure

);
let config = read_config(config_path)?;

let manifest: Manifest = match config.try_into() {
Expand Down
2 changes: 1 addition & 1 deletion src/settings/toml/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ fn base_fixture_path() -> PathBuf {
}

fn toml_fixture_path(fixture: &str) -> PathBuf {
base_fixture_path().join(fixture)
base_fixture_path().join(fixture).with_extension("toml")
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

some magical thing in config crate was doing this for us when we went to use merge, but now that we first check config_path.exists() before we get to that point, the extension needs to be explicitly included in the path.

}