Added Location and location ownership/rights to gamenight.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use std::{fs::{exists, read_dir, remove_dir_all, File}, io::Write, process::Command};
|
||||
|
||||
use std::{
|
||||
fs::{exists, read_dir, remove_dir_all, File},
|
||||
io::Write,
|
||||
process::Command,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
println!("cargo::rerun-if-changed=gamenight-api.yaml");
|
||||
@@ -7,12 +10,19 @@ fn main() {
|
||||
if exists("src/models").unwrap() {
|
||||
remove_dir_all("src/models").unwrap();
|
||||
}
|
||||
|
||||
let _ =
|
||||
Command::new("openapi-generator")
|
||||
.args(["generate", "-i", "gamenight-api.yaml", "-g", "rust", "--global-property", "models"])
|
||||
.output()
|
||||
.expect("Failed to generate models sources for the gamenight API");
|
||||
|
||||
let _ = Command::new("openapi-generator")
|
||||
.args([
|
||||
"generate",
|
||||
"-i",
|
||||
"gamenight-api.yaml",
|
||||
"-g",
|
||||
"rust",
|
||||
"--global-property",
|
||||
"models",
|
||||
])
|
||||
.output()
|
||||
.expect("Failed to generate models sources for the gamenight API");
|
||||
|
||||
let mut file = File::create("src/models/mod.rs").unwrap();
|
||||
let paths = read_dir("./src/models").unwrap();
|
||||
@@ -21,10 +31,10 @@ fn main() {
|
||||
let path = path.path();
|
||||
let stem = path.file_stem().unwrap();
|
||||
if stem == "mod" {
|
||||
continue
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
let line = format!("pub mod {};\n", stem.to_str().unwrap());
|
||||
let _ = file.write(line.as_bytes()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user