Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
formatting

formatting
  • Loading branch information
carloskiki committed Apr 13, 2023
1 parent 9b2eaa0 commit 92772d3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions build/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod readme_md;
mod cargo_toml;
mod lib_rs;
mod src_dir;
pub(crate) mod cargo_toml;
pub(crate) mod lib_rs;
pub(crate) mod readme_md;
pub(crate) mod src_dir;
6 changes: 2 additions & 4 deletions build/src/fs/lib_rs.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
use std::{io, path::PathBuf};

use anyhow::Result;
use heck::{ToUpperCamelCase, ToShoutySnakeCase};
use heck::{ToShoutySnakeCase, ToUpperCamelCase};
use proc_macro2::{Ident, Span, TokenStream};
use quote::{format_ident, quote};
use snafu::{prelude::*, Backtrace};
use tokio::io::AsyncWriteExt;
use tracing::{error, trace};

use crate::{icon::SvgIcon, icon_library::IconLibrary};

use super::MainLibrary;
use crate::{icon::SvgIcon, icon_library::IconLibrary, main_library::MainLibrary};

#[derive(Debug, Snafu)]
pub(crate) enum Error {
Expand Down
6 changes: 3 additions & 3 deletions build/src/fs/src_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{io, path::PathBuf};
use snafu::{prelude::*, Backtrace};
use tracing::trace;

use crate::lib_rs::LibRs;
use super::lib_rs::LibRs;

#[derive(Debug, Snafu)]
pub(crate) enum Error {
Expand All @@ -21,7 +21,7 @@ pub(crate) enum Error {
},
#[snafu(display("Unable to initialize lib.rs"))]
InitLib {
source: crate::lib_rs::Error,
source: super::lib_rs::Error,
backtrace: Backtrace,
},
}
Expand All @@ -34,7 +34,7 @@ pub(crate) struct SrcDir<T> {

impl<T: std::fmt::Debug> SrcDir<T> {
/// Removes and recreates a fresh src directory containing a fresh lib.rs file.
pub async fn reset(&mut self) -> Result<(), Error> {
pub async fn reset(&self) -> Result<(), Error> {
if self.path.exists() {
trace!(path = ?self.path, "Removing existing src directory");
tokio::fs::remove_dir_all(&self.path)
Expand Down
8 changes: 5 additions & 3 deletions build/src/icon_library/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ use heck::ToUpperCamelCase;
use tracing::{error, info, instrument, trace};

use crate::{
cargo_toml::CargoToml,
fs::{cargo_toml::CargoToml, lib_rs::LibRs, readme_md::Readme, src_dir::SrcDir},
icon::SvgIcon,
icon_library::icons_md::Icons,
package::{Downloaded, Package},
readme_md::Readme, lib_rs::LibRs, src_dir::SrcDir,
};

mod icons_md;
Expand Down Expand Up @@ -80,7 +79,10 @@ impl IconLibrary {
self.icons
.sort_by(|a, b| a.feature.name.cmp(&b.feature.name));

self.src_dir.lib_rs.write_lib_rs(&self.enum_name(), &self.icons).await?;
self.src_dir
.lib_rs
.write_lib_rs(&self.enum_name(), &self.icons)
.await?;

trace!("Writing crate manifest.");
self.cargo_toml.write_cargo_toml(&self).await?;
Expand Down
5 changes: 3 additions & 2 deletions build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use crate::main_library::MainLibrary;
use crate::package::Package;

mod feature;
mod fs;
mod git;
mod icon;
mod icon_library;
mod main_library;
mod package;
mod path;
mod sem_ver;
mod fs;

#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
Expand Down Expand Up @@ -60,7 +60,8 @@ async fn main() -> Result<()> {
})?;

// Generate the library for that package.
let lib_path = path::library_crate(format!("leptos-icons-{}", package.meta.short_name), "");
let lib_path =
path::library_crate(format!("leptos-icons-{}", package.meta.short_name), "");
let mut lib = IconLibrary::new(package, lib_path);

lib.generate().await?;
Expand Down
7 changes: 4 additions & 3 deletions build/src/main_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::path::PathBuf;
use anyhow::Result;
use tracing::{info, instrument, trace};

use crate::{cargo_toml::CargoToml, icon_library::IconLibrary, lib_rs::LibRs, readme_md::Readme};
use crate::fs::{cargo_toml::CargoToml, lib_rs::LibRs, readme_md::Readme, src_dir::SrcDir};

use crate::src_dir::SrcDir;
use crate::icon_library::IconLibrary;

#[derive(Debug)]
pub(crate) struct MainLibrary {
Expand Down Expand Up @@ -52,7 +52,8 @@ impl MainLibrary {

self.src_dir
.lib_rs
.write_lib_rs(&self.component_name(), &self.enum_name(), &icon_libs).await?;
.write_lib_rs(&self.component_name(), &self.enum_name(), &icon_libs)
.await?;

trace!("Writing README.md.");
self.readme_md.write_readme().await?;
Expand Down

0 comments on commit 92772d3

Please sign in to comment.