extern crate ci_info; #[path = "src/infra.rs"] mod infra; use std::fs; use std::process; const HOOKS_DIR: &str = ".hooks"; fn main() { if ci_info::is_ci() { println!("CI environment detected. Skipping git hooks install..."); process::exit(0); } let root_path = infra::get_git_root(); let hooks_path = root_path.join(HOOKS_DIR); if !hooks_path.exists() { fs::create_dir(&hooks_path) .unwrap_or_else(|_| panic!("Failed to create {HOOKS_DIR} directory")); } infra::create_infra(&hooks_path) .unwrap_or_else(|_| panic!("Failed to create {HOOKS_DIR} infrastructure")); infra::set_git_hooks(&hooks_path); }