Skip to content

Commit

Permalink
Moving baked template into script crate (#4573)
Browse files Browse the repository at this point in the history
This shouldn't be in `provider/baked`.
  • Loading branch information
robertbastian authored Feb 1, 2024
1 parent 7053d17 commit 42ab91e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 57 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ exclude = [
"provider/testdata",
# Tutorials are tested outside the workspace to simulate external users
"docs",
# Not a functioning crate
"provider/baked/_template_",
]

[workspace.package]
Expand Down
1 change: 0 additions & 1 deletion provider/baked/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
**/* linguist-generated=true
_template_/**/* linguist-generated=false
.gitattributes linguist-generated=false
44 changes: 0 additions & 44 deletions provider/baked/_template_/LICENSE

This file was deleted.

23 changes: 13 additions & 10 deletions tools/bakeddata-scripts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,29 @@ fn main() {
options.overwrite = true;
options.pretty = true;

let template = Path::new("provider/baked/_template_");

for (component, keys, version) in &components {
let path = Path::new("provider/baked").join(component);

let _ = std::fs::remove_dir_all(&path);
for dir in ["", "src", "data"] {
std::fs::create_dir(&path.join(dir)).unwrap();
}
for file in [
"build.rs",
"Cargo.toml",
"LICENSE",
"README.md",
"src/lib.rs",
for (file, template) in [
("build.rs", include_str!("../template/build.rs.template")),
(
"Cargo.toml",
include_str!("../template/Cargo.toml.template"),
),
("LICENSE", include_str!("../LICENSE")),
("README.md", include_str!("../template/README.md.template")),
(
"src/lib.rs",
include_str!("../template/src/lib.rs.template"),
),
] {
std::fs::write(
path.join(file),
&std::fs::read_to_string(template.join(file))
.unwrap()
template
.replace("_component_", component)
.replace("_version_", version)
.replace("_cldr_tag_", DatagenProvider::LATEST_TESTED_CLDR_TAG)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 42ab91e

Please sign in to comment.