Modules refactor
This commit is contained in:
24
src/main.rs
24
src/main.rs
@@ -1,34 +1,18 @@
|
|||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
mod freebsd;
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
mod linux;
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
mod macos;
|
|
||||||
#[cfg(unix)]
|
|
||||||
mod tmux;
|
|
||||||
#[cfg(unix)]
|
|
||||||
mod unix;
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
mod windows;
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod ctrlc;
|
mod ctrlc;
|
||||||
mod error;
|
mod error;
|
||||||
mod executor;
|
mod executor;
|
||||||
mod generic;
|
|
||||||
mod git;
|
|
||||||
mod node;
|
|
||||||
mod report;
|
mod report;
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature = "self-update")]
|
||||||
mod self_update;
|
mod self_update;
|
||||||
|
mod steps;
|
||||||
mod terminal;
|
mod terminal;
|
||||||
mod utils;
|
mod utils;
|
||||||
mod vim;
|
|
||||||
|
|
||||||
use self::config::Config;
|
use self::config::Config;
|
||||||
use self::error::{Error, ErrorKind};
|
use self::error::{Error, ErrorKind};
|
||||||
use self::git::{Git, Repositories};
|
|
||||||
use self::report::Report;
|
use self::report::Report;
|
||||||
|
use self::steps::*;
|
||||||
use self::terminal::*;
|
use self::terminal::*;
|
||||||
use failure::{Fail, ResultExt};
|
use failure::{Fail, ResultExt};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
@@ -78,8 +62,8 @@ fn run() -> Result<(), Error> {
|
|||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let base_dirs = directories::BaseDirs::new().ok_or(ErrorKind::NoBaseDirectories)?;
|
let base_dirs = directories::BaseDirs::new().ok_or(ErrorKind::NoBaseDirectories)?;
|
||||||
let git = Git::new();
|
let git = git::Git::new();
|
||||||
let mut git_repos = Repositories::new(&git);
|
let mut git_repos = git::Repositories::new(&git);
|
||||||
|
|
||||||
let config = Config::read(&base_dirs)?;
|
let config = Config::read(&base_dirs)?;
|
||||||
let mut report = Report::new();
|
let mut report = Report::new();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{self, Check, PathExt};
|
use crate::utils::{self, Check, PathExt};
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::Error;
|
use crate::error::Error;
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{which, Check};
|
use crate::utils::{which, Check};
|
||||||
use log::{debug, error};
|
use log::{debug, error};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io;
|
use std::io;
|
||||||
9
src/steps/mod.rs
Normal file
9
src/steps/mod.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
pub mod generic;
|
||||||
|
pub mod git;
|
||||||
|
pub mod node;
|
||||||
|
pub mod os;
|
||||||
|
#[cfg(unix)]
|
||||||
|
pub mod tmux;
|
||||||
|
pub mod vim;
|
||||||
|
|
||||||
|
pub use self::os::*;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{which, Check, PathExt};
|
use crate::utils::{which, Check, PathExt};
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::{print_separator, print_warning};
|
use crate::terminal::{print_separator, print_warning};
|
||||||
use super::utils::Check;
|
use crate::utils::Check;
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::{print_separator, print_warning};
|
use crate::terminal::{print_separator, print_warning};
|
||||||
use super::utils::{which, Check};
|
use crate::utils::{which, Check};
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::Error;
|
use crate::error::Error;
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::Check;
|
use crate::utils::Check;
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn upgrade_macos(dry_run: bool) -> Option<(&'static str, bool)> {
|
pub fn upgrade_macos(dry_run: bool) -> Option<(&'static str, bool)> {
|
||||||
10
src/steps/os/mod.rs
Normal file
10
src/steps/os/mod.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#[cfg(target_os = "freebsd")]
|
||||||
|
pub mod freebsd;
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
pub mod linux;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
pub mod macos;
|
||||||
|
#[cfg(unix)]
|
||||||
|
pub mod unix;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
pub mod windows;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::Error;
|
use crate::error::Error;
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{which, Check};
|
use crate::utils::{which, Check};
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
|
|
||||||
pub fn run_zplug(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, bool)> {
|
pub fn run_zplug(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{self, which, Check};
|
use crate::utils::{self, which, Check};
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use log::error;
|
use log::error;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
use super::error::{Error, ErrorKind};
|
use crate::error::{Error, ErrorKind};
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::which;
|
use crate::utils::{which, Check, PathExt};
|
||||||
use super::utils::{Check, PathExt};
|
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
use failure::ResultExt;
|
use failure::ResultExt;
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use super::error::Error;
|
use crate::error::Error;
|
||||||
use super::executor::Executor;
|
use crate::executor::Executor;
|
||||||
use super::terminal::print_separator;
|
use crate::terminal::print_separator;
|
||||||
use super::utils::{which, Check, PathExt};
|
use crate::utils::{which, Check, PathExt};
|
||||||
use directories::BaseDirs;
|
use directories::BaseDirs;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
Reference in New Issue
Block a user