Skip to content

Commit

Permalink
remove rust-embed
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Oct 20, 2024
1 parent 1a0f679 commit 7d9ce6a
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ rayon = "1.10.0"
regex = { workspace = true }
reqwest = { version = "0.12.8", features = ["blocking", "json"] }
rhai = "1.19.0"
rust-embed = "8.5.0"
semver = "1.0.23"
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
Expand Down
10 changes: 1 addition & 9 deletions bin/src/commands/new/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,7 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {
};

let license = if test_mode {
Some(
String::from_utf8(
Licenses::get("apl-sa.txt")
.expect("apl-sa should exist")
.data
.to_vec(),
)
.expect("license should be utf8"),
)
Some(include_str!("../../modules/new/licenses/mit.txt").to_string())
} else {
Licenses::select(&author)
};
Expand Down
22 changes: 8 additions & 14 deletions bin/src/modules/new/license.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "dist/licenses/"]
pub struct Licenses;

impl Licenses {
Expand Down Expand Up @@ -33,18 +29,16 @@ impl Licenses {
}

let license = match selection {
0 => Self::get("apl-sa.txt"),
1 => Self::get("apl.txt"),
2 => Self::get("apl-nd.txt"),
3 => Self::get("apache.txt"),
4 => Self::get("gpl-3.0.txt"),
5 => Self::get("mit.txt"),
6 => Self::get("unlicense.txt"),
0 => include_str!("licenses/apl-sa.txt"),
1 => include_str!("licenses/apl.txt"),
2 => include_str!("licenses/apl-nd.txt"),
3 => include_str!("licenses/apache.txt"),
4 => include_str!("licenses/gpl-3.0.txt"),
5 => include_str!("licenses/mit.txt"),
6 => include_str!("licenses/unlicense.txt"),
_ => unreachable!(),
}
.expect("license should exist");
};

let license = String::from_utf8(license.data.to_vec()).expect("license should be utf8");
Some(license.replace("{author}", author).replace(
"{year}",
time::OffsetDateTime::now_utc().year().to_string().as_str(),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7d9ce6a

Please sign in to comment.