pub mod channel;
pub mod controller;
pub mod field;
pub mod generator_gen;
pub mod job;
pub mod locale;
pub mod mailer;
pub mod migration;
pub mod migration_support;
pub mod model;
pub mod new;
pub mod resource;
pub mod scaffold;
pub mod storage_adapter;
pub mod storage_install;
pub mod templates_gen;
use doido_core::Inflector;
pub fn to_snake(s: &str) -> String {
Inflector::underscore(s)
}
pub(crate) fn register_module(existing: &str, module: &str, marker: &str) -> String {
let decl = format!("pub mod {module};");
if existing.lines().any(|l| l.trim() == decl) {
return existing.to_string();
}
let mut lines: Vec<String> = existing.lines().map(String::from).collect();
match lines.iter().position(|l| l.contains(marker)) {
Some(i) => lines.insert(i, decl),
None => lines.push(decl),
}
let mut out = lines.join("\n");
out.push('\n');
out
}
pub fn to_pascal(s: &str) -> String {
Inflector::camelize(&Inflector::underscore(s))
}
pub fn to_table_name(s: &str) -> String {
Inflector::tableize(s)
}