Skip to content

Commit 1f320b9

Browse files
Copilotjosecelano
andcommitted
refactor: reorganize src/ structure - move bootstrap and network utilities
- Create src/bootstrap/ with app, container, help, logging modules - Create src/testing/network/ with port_checker and port_usage_checker - Update all imports across the codebase - Update module exports in lib.rs, shared/mod.rs, testing/mod.rs - Update bin executables to use new paths - All tests pass successfully Co-authored-by: josecelano <58816+josecelano@users.noreply.github.com>
1 parent 8d48c22 commit 1f320b9

File tree

22 files changed

+64
-31
lines changed

22 files changed

+64
-31
lines changed

src/bin/e2e_config_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ use torrust_tracker_deployer_lib::testing::e2e::tasks::run_configure_command::ru
6565
use tracing::{error, info};
6666

6767
use torrust_tracker_deployer_lib::adapters::ssh::{SshCredentials, DEFAULT_SSH_PORT};
68+
use torrust_tracker_deployer_lib::bootstrap::logging::{LogFormat, LogOutput, LoggingBuilder};
6869
use torrust_tracker_deployer_lib::domain::{Environment, EnvironmentName};
69-
use torrust_tracker_deployer_lib::logging::{LogFormat, LogOutput, LoggingBuilder};
7070
use torrust_tracker_deployer_lib::shared::Username;
7171
use torrust_tracker_deployer_lib::testing::e2e::context::{TestContext, TestContextType};
7272
use torrust_tracker_deployer_lib::testing::e2e::tasks::{

src/bin/e2e_provision_and_destroy_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ use tracing::{error, info};
5454

5555
// Import E2E testing infrastructure
5656
use torrust_tracker_deployer_lib::adapters::ssh::{SshCredentials, DEFAULT_SSH_PORT};
57+
use torrust_tracker_deployer_lib::bootstrap::logging::{LogFormat, LogOutput, LoggingBuilder};
5758
use torrust_tracker_deployer_lib::domain::{Environment, EnvironmentName};
58-
use torrust_tracker_deployer_lib::logging::{LogFormat, LogOutput, LoggingBuilder};
5959
use torrust_tracker_deployer_lib::shared::Username;
6060
use torrust_tracker_deployer_lib::testing::e2e::context::{TestContext, TestContextType};
6161
use torrust_tracker_deployer_lib::testing::e2e::tasks::virtual_machine::{

src/bin/e2e_tests_full.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ use tracing::{error, info};
6161

6262
// Import E2E testing infrastructure
6363
use torrust_tracker_deployer_lib::adapters::ssh::DEFAULT_SSH_PORT;
64+
use torrust_tracker_deployer_lib::bootstrap::logging::{LogFormat, LogOutput, LoggingBuilder};
6465
use torrust_tracker_deployer_lib::infrastructure::persistence::repository_factory::RepositoryFactory;
65-
use torrust_tracker_deployer_lib::logging::{LogFormat, LogOutput, LoggingBuilder};
6666
use torrust_tracker_deployer_lib::shared::{Clock, SystemClock};
6767
use torrust_tracker_deployer_lib::testing::e2e::context::{TestContext, TestContextType};
6868
use torrust_tracker_deployer_lib::testing::e2e::tasks::{

src/bin/test_logging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use std::path::PathBuf;
3232

3333
use clap::Parser;
34-
use torrust_tracker_deployer_lib::logging::{LogFormat, LogOutput, LoggingBuilder};
34+
use torrust_tracker_deployer_lib::bootstrap::logging::{LogFormat, LogOutput, LoggingBuilder};
3535
use tracing::{debug, error, info, trace, warn};
3636

3737
#[derive(Parser)]

src/app.rs renamed to src/bootstrap/app.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use clap::Parser;
2121
use tracing::info;
2222

23-
use torrust_tracker_deployer_lib::{help, logging, presentation};
23+
use crate::{bootstrap, presentation};
2424

2525
/// Main application entry point
2626
///
@@ -42,7 +42,7 @@ pub fn run() {
4242

4343
let logging_config = cli.global.logging_config();
4444

45-
logging::init_subscriber(logging_config);
45+
bootstrap::logging::init_subscriber(logging_config);
4646

4747
info!(
4848
app = "torrust-tracker-deployer",
@@ -62,7 +62,7 @@ pub fn run() {
6262
}
6363
}
6464
None => {
65-
help::display_getting_started();
65+
bootstrap::help::display_getting_started();
6666
}
6767
}
6868

File renamed without changes.
File renamed without changes.

src/bootstrap/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//! Bootstrap Module
2+
//!
3+
//! This module contains application initialization and bootstrap concerns.
4+
//! It handles application lifecycle, dependency injection, logging setup,
5+
//! and help display.
6+
//!
7+
//! ## Modules
8+
//!
9+
//! - `app` - Main application bootstrap and entry point logic
10+
//! - `container` - Service container for dependency injection
11+
//! - `help` - Help and usage information display
12+
//! - `logging` - Logging configuration and initialization
13+
14+
pub mod app;
15+
pub mod container;
16+
pub mod help;
17+
pub mod logging;
18+
19+
// Re-export commonly used types for convenience
20+
pub use container::Services;
21+
pub use logging::{LogFormat, LogOutput, LoggingBuilder, LoggingConfig};

src/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::path::PathBuf;
2525
/// Centralizes all deployment-related configuration including file paths,
2626
/// service connection details, and runtime behavior settings.
2727
///
28-
/// Created once at deployment start and passed to [`Services::new()`](crate::container::Services::new).
28+
/// Created once at deployment start and passed to [`Services::new()`](crate::bootstrap::container::Services::new).
2929
pub struct Config {
3030
/// Directory containing template files for rendering configurations.
3131
///

0 commit comments

Comments
 (0)