🔖 [build] release development version 0.0.11

This commit is contained in:
Manuel Cillero 2024-07-27 13:36:30 +02:00
parent 6cb4f62375
commit 2caa7e924b
2 changed files with 17 additions and 5 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "pagetop-build" name = "pagetop-build"
version = "0.0.10" version = "0.0.11"
edition = "2021" edition = "2021"
description = "Simplifies the process of embedding resources in PageTop app binaries." description = "Simplifies the process of embedding resources in PageTop app binaries."
@ -19,4 +19,4 @@ keywords = [
] ]
[dependencies] [dependencies]
static-files = "0.2.3" static-files = "0.2.4"

View file

@ -62,7 +62,8 @@
//! static_files!(guides); //! static_files!(guides);
//! ``` //! ```
//! //!
//! Also you can get the bundle as a static reference to the generated HashMap resources collection: //! Also you can get the bundle as a static reference to the generated `HashMap` resources
//! collection:
//! //!
//! ```rust#ignore //! ```rust#ignore
//! use pagetop::prelude::*; //! use pagetop::prelude::*;
@ -81,11 +82,16 @@ impl StaticFilesBundle {
StaticFilesBundle(static_files::resource_dir(dir)) StaticFilesBundle(static_files::resource_dir(dir))
} }
/// Configures the name for the bundle of static files.
///
/// # Panics
///
/// This function will panic if the standard `OUT_DIR` environment variable is not set.
pub fn with_name(mut self, name: &'static str) -> Self { pub fn with_name(mut self, name: &'static str) -> Self {
self.0.with_generated_filename( self.0.with_generated_filename(
Path::new(std::env::var("OUT_DIR").unwrap().as_str()).join(format!("{}.rs", name)), Path::new(std::env::var("OUT_DIR").unwrap().as_str()).join(format!("{name}.rs")),
); );
self.0.with_module_name(format!("bundle_{}", name)); self.0.with_module_name(format!("bundle_{name}"));
self.0.with_generated_fn(name); self.0.with_generated_fn(name);
self self
} }
@ -95,6 +101,12 @@ impl StaticFilesBundle {
self self
} }
/// Builds the bundle.
///
/// # Errors
///
/// This function will return an error if there is an issue with I/O operations, such as failing
/// to read or write to a file.
pub fn build(self) -> std::io::Result<()> { pub fn build(self) -> std::io::Result<()> {
self.0.build() self.0.build()
} }