Skip to content

Commit

Permalink
drop generator command for now
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Jan 28, 2025
1 parent 9107d3e commit 0a7df8c
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 261 deletions.
11 changes: 3 additions & 8 deletions loco-gen/src/controller.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::path::Path;

use rrgen::RRgen;
use serde_json::json;

use super::{AppInfo, GenerateResults, Result};
use crate as gen;
use rrgen::RRgen;
use serde_json::json;
use std::path::Path;

pub fn generate(
rrgen: &RRgen,
Expand Down Expand Up @@ -38,8 +36,5 @@ pub fn generate(
}
Ok(gen_result)
}
gen::ScaffoldKind::OpenApi => {
gen::render_template(rrgen, Path::new("controller/openapi"), &vars)
}
}
}
1 change: 0 additions & 1 deletion loco-gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ pub enum ScaffoldKind {
Api,
Html,
Htmx,
OpenApi,
}

#[derive(clap::ValueEnum, Debug, Clone)]
Expand Down
5 changes: 0 additions & 5 deletions loco-gen/src/scaffold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ pub fn generate(
gen_result.rrgen.extend(res.rrgen);
gen_result.local_templates.extend(res.local_templates);
}
ScaffoldKind::OpenApi => {
let res = render_template(rrgen, Path::new("scaffold/openapi"), &vars)?;
gen_result.rrgen.extend(res.rrgen);
gen_result.local_templates.extend(res.local_templates);
}
}
Ok(gen_result)
}
41 changes: 0 additions & 41 deletions loco-gen/src/templates/controller/openapi/controller.t

This file was deleted.

39 changes: 0 additions & 39 deletions loco-gen/src/templates/controller/openapi/test.t

This file was deleted.

127 changes: 0 additions & 127 deletions loco-gen/src/templates/scaffold/openapi/controller.t

This file was deleted.

26 changes: 0 additions & 26 deletions loco-gen/src/templates/scaffold/openapi/test.t

This file was deleted.

3 changes: 1 addition & 2 deletions loco-gen/tests/templates/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::fs;
#[case(ScaffoldKind::Api)]
#[case(ScaffoldKind::Html)]
#[case(ScaffoldKind::Htmx)]
#[case(ScaffoldKind::OpenApi)]
#[test]
fn can_generate(#[case] kind: ScaffoldKind) {
let actions = vec!["GET".to_string(), "POST".to_string()];
Expand Down Expand Up @@ -60,7 +59,7 @@ fn can_generate(#[case] kind: ScaffoldKind) {
.expect("app.rs injection failed")
);

if matches!(kind, ScaffoldKind::Api | ScaffoldKind::OpenApi) {
if matches!(kind, ScaffoldKind::Api) {
let test_controllers_path = tree_fs.root.join("tests").join("requests");
assert_snapshot!(
"generate[tests_controller_mod_rs]",
Expand Down
2 changes: 0 additions & 2 deletions loco-gen/tests/templates/scaffold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::fs;
#[case(ScaffoldKind::Api)]
#[case(ScaffoldKind::Html)]
#[case(ScaffoldKind::Htmx)]
#[case(ScaffoldKind::OpenApi)]
#[test]
fn can_generate(#[case] kind: ScaffoldKind) {
std::env::set_var("SKIP_MIGRATION", "");
Expand Down Expand Up @@ -132,7 +131,6 @@ fn can_generate(#[case] kind: ScaffoldKind) {
);
}
}
ScaffoldKind::OpenApi => (),
}
}

Expand Down
12 changes: 2 additions & 10 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ After running the migration, follow these steps to complete the process:
/// Use API controller actions
#[clap(long, group = "scaffold_kind_group")]
api: bool,

#[clap(long, group = "scaffold_kind_group")]
openapi: bool,
},
/// Generate a Task based on the given name
Task {
Expand Down Expand Up @@ -385,8 +382,7 @@ impl ComponentArg {
loco_gen::ScaffoldKind::Api
} else {
return Err(crate::Error::string(
"Error: One of `kind`, `htmx`, `html`, `api`, or `openapi` must be \
specified.",
"Error: One of `kind`, `htmx`, `html`, or `api` must be specified.",
));
};

Expand All @@ -399,7 +395,6 @@ impl ComponentArg {
htmx,
html,
api,
openapi,
} => {
let kind = if let Some(kind) = kind {
kind
Expand All @@ -409,12 +404,9 @@ impl ComponentArg {
loco_gen::ScaffoldKind::Html
} else if api {
loco_gen::ScaffoldKind::Api
} else if openapi {
loco_gen::ScaffoldKind::OpenApi
} else {
return Err(crate::Error::string(
"Error: One of `kind`, `htmx`, `html`, `api`, or `openapi` must be \
specified.",
"Error: One of `kind`, `htmx`, `html`, or `api` must be specified.",
));
};

Expand Down

0 comments on commit 0a7df8c

Please sign in to comment.