use std::fs;
use std::path::Path;
use std::io::{self, Write};
pub struct FsService;
impl FsService {
pub fn new() -> Self {
FsService
}
pub fn create_project_structure(&self, project_name: &str) -> io::Result<()> {
let root = Path::new(project_name);
fs::create_dir_all(root.join("src/models"))?;
let cargo_content = format!(
r#"[package]
name = "{}"
version = "0.1.0"
edition = "2021"
[dependencies]
ruthril = {{ path = "../ruthril" }}
"#, project_name);
fs::write(root.join("Cargo.toml"), cargo_content)?;
let main_content = r#"use ruthril::core::statistics::Statistics;
fn main() {
}
"#;
fs::write(root.join("src/main.rs"), main_content)?;
Ok(())
}
}