Skip to content

Commit c70ff21

Browse files
committed
Fix templates/config.yaml extension bug and release cli 0.10.1
1 parent bf83259 commit c70ff21

File tree

8 files changed

+31
-20
lines changed

8 files changed

+31
-20
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [0.10.1] - 2024-09-03
4+
5+
## Fixed
6+
7+
- Fix bug where `templates/config.yaml` extension property is always
8+
prepended by a period `.`. The property is now considered the full
9+
extension.
10+
311
## [0.10.0] - 2024-08-28
412

513
## Changed
@@ -161,6 +169,7 @@
161169
- `sync` subcommand support to sync with latest Tinted Theming schemes
162170
- `build` subcommand to trigger theme template build
163171

172+
[0.10.1]: https://github.com/tinted-theming/tinted-builder-rust/compare/v0.10.0...v0.10.1
164173
[0.10.0]: https://github.com/tinted-theming/tinted-builder-rust/compare/v0.9.5...v0.10.0
165174
[0.9.5]: https://github.com/tinted-theming/tinted-builder-rust/compare/v0.9.3...v0.9.5
166175
[0.9.4]: https://github.com/tinted-theming/tinted-builder-rust/compare/v0.9.3...v0.9.4

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

THIRD_PARTY_LICENSES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ limitations under the License.
16841684
#### Used by
16851685

16861686
- [tinted-builder 0.6.0](https://github.com/tinted-theming/tinted-builder-rust)
1687-
- [tinted-builder-rust 0.10.0](https://github.com/tinted-theming/tinted-builder-rust)
1687+
- [tinted-builder-rust 0.10.1](https://github.com/tinted-theming/tinted-builder-rust)
16881688
- [ribboncurls 0.2.1](https://github.com/tinted-theming/ribboncurls)
16891689

16901690
```

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: 'Build all the schemes for a base16 or tinted repo'
33

44
runs:
55
using: 'docker'
6-
image: 'docker://ghcr.io/tinted-theming/tinted-builder-rust:v0.10.0'
6+
image: 'docker://ghcr.io/tinted-theming/tinted-builder-rust:v0.10.1'
77
args:
88
- build
99
- .

tinted-builder-rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tinted-builder-rust"
3-
version = "0.10.0"
3+
version = "0.10.1"
44
edition = "2021"
55
authors = ["Jamy Golden <[email protected]>", "Tinted Theming <[email protected]>"]
66
license = "MIT OR Apache-2.0"

tinted-builder-rust/src/operations/build.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ fn get_theme_template_path(theme_template_path: &Path) -> Result<PathBuf> {
188188
/// * `output_dir` - A reference to a `PathBuf` representing the directory where the output file will be written.
189189
/// * `scheme_path` - A reference to a `Path` representing the file path to the scheme file.
190190
/// * `system` - The `SchemeSystem` that the scheme file should match.
191-
/// * `extension` - A string slice representing the file extension for the generated theme file.
191+
/// * `explicit_extension` - A string slice representing the file extension for the generated theme
192+
/// file. The parameter is named "explict" extension because it includes the "dot" or lack thereof
192193
///
193194
/// # Returns
194195
///
@@ -216,7 +217,7 @@ fn generate_theme(
216217
output_dir: &PathBuf,
217218
scheme_path: &Path,
218219
system: SchemeSystem,
219-
extension: &str,
220+
explicit_extension: &str,
220221
) -> Result<()> {
221222
let scheme_file_type = SchemeFileType::new(scheme_path)?;
222223
let scheme_path = scheme_file_type
@@ -247,10 +248,10 @@ fn generate_theme(
247248
let template = Template::new(template_content.to_string(), scheme.clone());
248249
let output = template.render()?;
249250
let output_path = output_dir.join(format!(
250-
"{}-{}.{}",
251+
"{}-{}{}",
251252
&scheme_inner.system,
252253
scheme_file_type.get_file_stem().unwrap_or_default(),
253-
extension
254+
explicit_extension
254255
));
255256

256257
if !output_path.exists() {
@@ -274,11 +275,9 @@ fn generate_themes_for_config(
274275
schemes_filetypes: &[SchemeFileType],
275276
is_quiet: bool,
276277
) -> Result<()> {
277-
let extension = config_value
278-
.extension
279-
.as_str()
280-
.strip_prefix('.')
281-
.unwrap_or(config_value.extension.as_str());
278+
// "explicit" extension because it contains the entire extension including (or excluding) the
279+
// period
280+
let explicit_extension = config_value.extension.as_str();
282281
let template_path = theme_template_path.join(format!("templates/{}.mustache", config_name));
283282
let template_content = read_to_string(&template_path).context(format!(
284283
"Mustache template missing: {}",
@@ -349,21 +348,21 @@ fn generate_themes_for_config(
349348
&output_path,
350349
&scheme_path,
351350
scheme_system,
352-
extension,
351+
explicit_extension,
353352
)?;
354353
}
355354

356355
if !is_quiet {
357356
println!(
358-
"Successfully generated \"{}\" themes for \"{}\" at \"{}/*.{}\"",
357+
"Successfully generated \"{}\" themes for \"{}\" at \"{}/*{}\"",
359358
supported_systems
360359
.iter()
361360
.map(|item| item.as_str().to_string())
362361
.collect::<Vec<String>>()
363362
.join(", "),
364363
config_name,
365364
output_path.display(),
366-
extension,
365+
explicit_extension,
367366
);
368367
}
369368

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
base24-template:
2-
extension: .md
2+
extension: -custom-extension
33
output: output-themes
44
supported-systems: [base24]

tinted-builder-rust/tests/operation_build.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ fn test_operation_build_base24() -> Result<()> {
267267
let schemes_path = template_theme_path.join("schemes");
268268
let scheme_file_path = schemes_path.join(format!("{}.yaml", &scheme_name));
269269
let themes_path = template_theme_path.join("output-themes");
270-
let rendered_theme_path = themes_path.join(format!("base24-{}.md", &scheme_name));
270+
let output_extension = "-custom-extension";
271+
let rendered_theme_path =
272+
themes_path.join(format!("base24-{}{}", &scheme_name, &output_extension));
271273
let (
272274
base24_config_file_content,
273275
base24_scheme_file_content,
@@ -311,8 +313,9 @@ fn test_operation_build_base24() -> Result<()> {
311313
assert!(
312314
stdout.contains(
313315
format!(
314-
"Successfully generated \"base24\" themes for \"base24-template\" at \"{}/*.md\"",
315-
themes_path.display()
316+
"Successfully generated \"base24\" themes for \"base24-template\" at \"{}/*{}\"",
317+
themes_path.display(),
318+
output_extension
316319
)
317320
.as_str()
318321
),

0 commit comments

Comments
 (0)