From 9485179257f0e324599975b1444499371338bf3d Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sun, 15 May 2022 20:21:14 +0200 Subject: [PATCH] =?UTF-8?q?Actualiza=20la=20organizaci=C3=B3n=20del=20c?= =?UTF-8?q?=C3=B3digo=20para=20las=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/src/{core => }/app.rs | 0 pagetop/src/{core => }/app/application.rs | 0 pagetop/src/{core => }/app/banner.rs | 0 pagetop/src/{core => }/app/banner/figfont.rs | 0 pagetop/src/{core => }/app/banner/slant.flf | 0 pagetop/src/{core => }/app/banner/small.flf | 0 pagetop/src/{core => }/app/banner/speed.flf | 0 pagetop/src/{core => }/app/banner/starwars.flf | 0 pagetop/src/{core => }/app/db.rs | 0 pagetop/src/{core => }/app/definition.rs | 0 pagetop/src/{core => }/app/locale.rs | 0 pagetop/src/{core => }/app/tracing.rs | 0 pagetop/src/core.rs | 1 - pagetop/src/core/module/all.rs | 3 +-- pagetop/src/core/module/definition.rs | 3 +-- pagetop/src/core/theme/all.rs | 3 +-- pagetop/src/core/theme/definition.rs | 3 +-- pagetop/src/lib.rs | 4 +++- pagetop/src/locale.rs | 2 +- pagetop/src/prelude.rs | 7 ++++--- pagetop/src/response/page/definition.rs | 3 +-- 21 files changed, 13 insertions(+), 16 deletions(-) rename pagetop/src/{core => }/app.rs (100%) rename pagetop/src/{core => }/app/application.rs (100%) rename pagetop/src/{core => }/app/banner.rs (100%) rename pagetop/src/{core => }/app/banner/figfont.rs (100%) rename pagetop/src/{core => }/app/banner/slant.flf (100%) rename pagetop/src/{core => }/app/banner/small.flf (100%) rename pagetop/src/{core => }/app/banner/speed.flf (100%) rename pagetop/src/{core => }/app/banner/starwars.flf (100%) rename pagetop/src/{core => }/app/db.rs (100%) rename pagetop/src/{core => }/app/definition.rs (100%) rename pagetop/src/{core => }/app/locale.rs (100%) rename pagetop/src/{core => }/app/tracing.rs (100%) diff --git a/pagetop/src/core/app.rs b/pagetop/src/app.rs similarity index 100% rename from pagetop/src/core/app.rs rename to pagetop/src/app.rs diff --git a/pagetop/src/core/app/application.rs b/pagetop/src/app/application.rs similarity index 100% rename from pagetop/src/core/app/application.rs rename to pagetop/src/app/application.rs diff --git a/pagetop/src/core/app/banner.rs b/pagetop/src/app/banner.rs similarity index 100% rename from pagetop/src/core/app/banner.rs rename to pagetop/src/app/banner.rs diff --git a/pagetop/src/core/app/banner/figfont.rs b/pagetop/src/app/banner/figfont.rs similarity index 100% rename from pagetop/src/core/app/banner/figfont.rs rename to pagetop/src/app/banner/figfont.rs diff --git a/pagetop/src/core/app/banner/slant.flf b/pagetop/src/app/banner/slant.flf similarity index 100% rename from pagetop/src/core/app/banner/slant.flf rename to pagetop/src/app/banner/slant.flf diff --git a/pagetop/src/core/app/banner/small.flf b/pagetop/src/app/banner/small.flf similarity index 100% rename from pagetop/src/core/app/banner/small.flf rename to pagetop/src/app/banner/small.flf diff --git a/pagetop/src/core/app/banner/speed.flf b/pagetop/src/app/banner/speed.flf similarity index 100% rename from pagetop/src/core/app/banner/speed.flf rename to pagetop/src/app/banner/speed.flf diff --git a/pagetop/src/core/app/banner/starwars.flf b/pagetop/src/app/banner/starwars.flf similarity index 100% rename from pagetop/src/core/app/banner/starwars.flf rename to pagetop/src/app/banner/starwars.flf diff --git a/pagetop/src/core/app/db.rs b/pagetop/src/app/db.rs similarity index 100% rename from pagetop/src/core/app/db.rs rename to pagetop/src/app/db.rs diff --git a/pagetop/src/core/app/definition.rs b/pagetop/src/app/definition.rs similarity index 100% rename from pagetop/src/core/app/definition.rs rename to pagetop/src/app/definition.rs diff --git a/pagetop/src/core/app/locale.rs b/pagetop/src/app/locale.rs similarity index 100% rename from pagetop/src/core/app/locale.rs rename to pagetop/src/app/locale.rs diff --git a/pagetop/src/core/app/tracing.rs b/pagetop/src/app/tracing.rs similarity index 100% rename from pagetop/src/core/app/tracing.rs rename to pagetop/src/app/tracing.rs diff --git a/pagetop/src/core.rs b/pagetop/src/core.rs index e3208027..7b25095b 100644 --- a/pagetop/src/core.rs +++ b/pagetop/src/core.rs @@ -1,4 +1,3 @@ -pub mod app; // API to initialize the PageTop base application. pub mod component; // API to build new components. pub mod hook; // API to define functions that alter the behavior of PageTop core. pub mod module; // API to add new features with modules. diff --git a/pagetop/src/core/module/all.rs b/pagetop/src/core/module/all.rs index 5131a878..1a20688c 100644 --- a/pagetop/src/core/module/all.rs +++ b/pagetop/src/core/module/all.rs @@ -1,5 +1,4 @@ -use crate::{Lazy, run_now, trace}; -use crate::core::app; +use crate::{Lazy, app, run_now, trace}; use crate::core::hook::add_hook; use crate::db::*; use super::ModuleTrait; diff --git a/pagetop/src/core/module/definition.rs b/pagetop/src/core/module/definition.rs index 89904cc0..38621d82 100644 --- a/pagetop/src/core/module/definition.rs +++ b/pagetop/src/core/module/definition.rs @@ -1,5 +1,4 @@ -use crate::util; -use crate::core::app; +use crate::{app, util}; use crate::core::hook::HookItem; #[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))] diff --git a/pagetop/src/core/theme/all.rs b/pagetop/src/core/theme/all.rs index dc693e70..2a02b2ec 100644 --- a/pagetop/src/core/theme/all.rs +++ b/pagetop/src/core/theme/all.rs @@ -1,5 +1,4 @@ -use crate::{Lazy, theme_static_files, trace}; -use crate::core::app; +use crate::{Lazy, app, theme_static_files, trace}; use super::ThemeTrait; use std::sync::RwLock; diff --git a/pagetop/src/core/theme/definition.rs b/pagetop/src/core/theme/definition.rs index 841632ba..951c7a50 100644 --- a/pagetop/src/core/theme/definition.rs +++ b/pagetop/src/core/theme/definition.rs @@ -1,7 +1,6 @@ -use crate::{concat_string, util}; +use crate::{app, concat_string, util}; use crate::config::SETTINGS; use crate::html::{Markup, html}; -use crate::core::app; use crate::core::component::{ComponentTrait, Favicon, InContext}; use crate::response::page::Page; use crate::base::component::Chunck; diff --git a/pagetop/src/lib.rs b/pagetop/src/lib.rs index c4081535..79b3e3e5 100644 --- a/pagetop/src/lib.rs +++ b/pagetop/src/lib.rs @@ -18,7 +18,9 @@ pub mod html; // HTML en código. #[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))] pub mod db; // Acceso a base de datos. -pub mod core; // Main APIs for app, components, hooks, modules and themes. +pub mod app; // Prepare and run the application. + +pub mod core; // Main APIs for components, hooks, modules and themes. pub mod response; // Tipos de respuestas web. pub mod base; // Base de componentes, módulos y temas. diff --git a/pagetop/src/locale.rs b/pagetop/src/locale.rs index 98e88823..93e9e7e8 100644 --- a/pagetop/src/locale.rs +++ b/pagetop/src/locale.rs @@ -7,7 +7,7 @@ pub use fluent_templates::fluent_bundle::FluentValue; macro_rules! localize { ( $dir_locales:literal $(, $core_locales:literal)? ) => { use $crate::locale::*; - use $crate::core::app::locale::LANGID; + use $crate::app::locale::LANGID; static_locale! { static LOCALES = { diff --git a/pagetop/src/prelude.rs b/pagetop/src/prelude.rs index e9b8a396..c772c91d 100644 --- a/pagetop/src/prelude.rs +++ b/pagetop/src/prelude.rs @@ -21,15 +21,16 @@ pub use crate::{ migration_item, }; +pub use crate::app; +pub use crate::app::AppTrait; +pub use crate::app::application::Application; + pub use crate::{hook_item, core::{ - app, component::*, hook::*, module::*, theme::*, }}; -pub use crate::core::app::AppTrait; -pub use crate::core::app::application::Application; pub use crate::response::page::*; diff --git a/pagetop/src/response/page/definition.rs b/pagetop/src/response/page/definition.rs index ce1ab12b..fb9f0fa8 100644 --- a/pagetop/src/response/page/definition.rs +++ b/pagetop/src/response/page/definition.rs @@ -1,7 +1,6 @@ -use crate::{Lazy, trace}; +use crate::{Lazy, app, trace}; use crate::config::SETTINGS; use crate::html::*; -use crate::core::app; use crate::core::hook::{hook_ref, run_hooks}; use crate::core::component::*; use super::{BEFORE_RENDER_PAGE_HOOK, BeforeRenderPageHook};