Skip to content

Commit

Permalink
chore: Review feedback
Browse files Browse the repository at this point in the history
- `ura` => `gura` corrections
- `src/lib.rs` add mention for Gura support

tests(fix): Use `FileFormat::Gura`
chore: Version bump `gura`

Signed-off-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
  • Loading branch information
polarathene committed Oct 5, 2023
1 parent 66eb754 commit 2a6ec44
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ edition = "2018"
maintenance = { status = "actively-developed" }

[features]
default = ["toml", "json", "yaml", "ini", "ron", "json5", "ura", "convert-case", "async"]
default = ["toml", "json", "yaml", "ini", "ron", "json5", "gura", "convert-case", "async"]
json = ["serde_json"]
yaml = ["yaml-rust"]
ini = ["rust-ini"]
Expand All @@ -37,7 +37,7 @@ yaml-rust = { version = "0.4", optional = true }
rust-ini = { version = "0.19", optional = true }
ron = { version = "0.8", optional = true }
json5_rs = { version = "0.4", optional = true, package = "json5" }
gura = { version = "0.3.0", optional = true, package = "gura" }
gura = { version = "0.5", optional = true, package = "gura" }
indexmap = { version = "2.0.0", features = ["serde"], optional = true }
convert_case = { version = "0.6", optional = true }
pathdiff = "0.2"
Expand Down
11 changes: 6 additions & 5 deletions src/file/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod ron;
#[cfg(feature = "json5")]
mod json5;

#[cfg(feature = "ura")]
#[cfg(feature = "gura")]
mod gura;

/// File formats provided by the library.
Expand Down Expand Up @@ -59,8 +59,8 @@ pub enum FileFormat {
#[cfg(feature = "json5")]
Json5,

/// GURA (parsed with ura)
#[cfg(feature = "ura")]
/// GURA (parsed with gura)
#[cfg(feature = "gura")]
Gura,
}

Expand Down Expand Up @@ -88,7 +88,7 @@ lazy_static! {
#[cfg(feature = "json5")]
formats.insert(FileFormat::Json5, vec!["json5"]);

#[cfg(feature = "ura")]
#[cfg(feature = "gura")]
formats.insert(FileFormat::Gura, vec!["ura"]);

formats
Expand Down Expand Up @@ -127,7 +127,7 @@ impl FileFormat {
#[cfg(feature = "json5")]
FileFormat::Json5 => json5::parse(uri, text),

#[cfg(feature = "ura")]
#[cfg(feature = "gura")]
FileFormat::Gura => gura::parse(uri, text),

#[cfg(all(
Expand All @@ -137,6 +137,7 @@ impl FileFormat {
not(feature = "ini"),
not(feature = "ron"),
not(feature = "json5"),
not(feature = "gura"),
))]
_ => unreachable!("No features are enabled, this library won't work without features"),
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! - Environment variables
//! - String literals in well-known formats
//! - Another Config instance
//! - Files: TOML, JSON, YAML, INI, RON, JSON5 and custom ones defined with Format trait
//! - Files: TOML, JSON, YAML, INI, RON, JSON5, GURA and custom ones defined with Format trait
//! - Manual, programmatic override (via a `.set` method on the Config instance)
//!
//! Additionally, Config supports:
Expand Down
4 changes: 2 additions & 2 deletions tests/file_gura.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(feature = "json")]
#![cfg(feature = "gura")]

use serde_derive::Deserialize;

Expand Down Expand Up @@ -185,7 +185,7 @@ fn test_override_lowercase_value_for_enums() {
std::env::set_var("test_bar", "I have been overridden_with_lower_case");

let cfg = Config::builder()
.add_source(File::new("tests/Settings-enum-test", FileFormat::Json))
.add_source(File::new("tests/Settings-enum-test", FileFormat::Gura))
.add_source(config::Environment::with_prefix("test").separator("_"))
.build()
.unwrap();
Expand Down

0 comments on commit 2a6ec44

Please sign in to comment.