diff --git a/Cargo.toml b/Cargo.toml index 0f4b28664..a301e31b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [package] name = "loco-rs" -version = "0.8.1" +version = "0.9.0" description = "The one-person framework for Rust" homepage = "https://loco.rs/" documentation = "https://docs.rs/loco-rs" diff --git a/src/cli.rs b/src/cli.rs index daf30fa75..7f20e737e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -547,7 +547,7 @@ pub async fn main() -> crate::Result<()> { run_scheduler::(&app_context, config.as_ref(), name, tag, list).await?; } Commands::Generate { component } => { - gen::generate::(component.into(), &config)?; + gen::generate::(component.try_into()?, &config)?; } Commands::Version {} => { println!("{}", H::app_version(),); diff --git a/starters/lightweight-service/Cargo.lock b/starters/lightweight-service/Cargo.lock index 898bfbed6..7576cfe58 100644 --- a/starters/lightweight-service/Cargo.lock +++ b/starters/lightweight-service/Cargo.lock @@ -651,6 +651,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cron" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8c3e73077b4b4a6ab1ea5047c37c57aee77657bc8ecd6f29b0af082d0b0c07" +dependencies = [ + "chrono", + "nom", + "once_cell", +] + [[package]] name = "cron_clock" version = "0.8.0" @@ -812,6 +823,15 @@ dependencies = [ "shared_child", ] +[[package]] +name = "duct_sh" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6633cadba557545fbbe0299a2f9adc4bb2fc5fb238773f5e841e0c23d62146" +dependencies = [ + "duct", +] + [[package]] name = "either" version = "1.13.0" @@ -840,6 +860,16 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "english-to-cron" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c16423ac933fee80f05a52b435a912d5b08edbbbfe936e0042ebb3accdf303da" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1472,7 +1502,7 @@ dependencies = [ [[package]] name = "loco-rs" -version = "0.8.1" +version = "0.9.0" dependencies = [ "argon2", "async-trait", @@ -1489,6 +1519,8 @@ dependencies = [ "clap", "colored", "duct", + "duct_sh", + "english-to-cron", "fs-err", "futures-util", "hyper", @@ -1510,6 +1542,7 @@ dependencies = [ "tera", "thiserror", "tokio", + "tokio-cron-scheduler", "tower", "tower-http", "tracing", @@ -1644,6 +1677,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2045,9 +2089,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -2847,6 +2891,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "tokio-cron-scheduler" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b9480125554f0ace1c3c3797a24b5cc56c6a7cd82c739db35fb54c4dc046f3" +dependencies = [ + "chrono", + "cron", + "num-derive", + "num-traits", + "tokio", + "tracing", + "uuid", +] + [[package]] name = "tokio-macros" version = "2.4.0" diff --git a/starters/lightweight-service/Cargo.toml b/starters/lightweight-service/Cargo.toml index c0a6f6eb2..b3108021c 100644 --- a/starters/lightweight-service/Cargo.toml +++ b/starters/lightweight-service/Cargo.toml @@ -11,7 +11,7 @@ default-run = "loco_starter_template-cli" [dependencies] -loco-rs = { version = "0.8.1", default-features = false, features = ["cli"] } +loco-rs = { version = "0.9.0", default-features = false, features = ["cli"] } serde = "*" serde_json = "*" tokio = { version = "1.33.0", default-features = false } @@ -33,7 +33,7 @@ required-features = [] [dev-dependencies] serial_test = "3.1.1" rstest = "0.21.0" -loco-rs = { version = "0.8.1", default-features = false, features = [ +loco-rs = { version = "0.9.0", default-features = false, features = [ "testing", "cli", ] } diff --git a/starters/rest-api/Cargo.lock b/starters/rest-api/Cargo.lock index 49c0dc3fe..161e09505 100644 --- a/starters/rest-api/Cargo.lock +++ b/starters/rest-api/Cargo.lock @@ -1000,6 +1000,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cron" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8c3e73077b4b4a6ab1ea5047c37c57aee77657bc8ecd6f29b0af082d0b0c07" +dependencies = [ + "chrono", + "nom", + "once_cell", +] + [[package]] name = "cron_clock" version = "0.8.0" @@ -1189,6 +1200,15 @@ dependencies = [ "shared_child", ] +[[package]] +name = "duct_sh" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6633cadba557545fbbe0299a2f9adc4bb2fc5fb238773f5e841e0c23d62146" +dependencies = [ + "duct", +] + [[package]] name = "educe" version = "0.5.11" @@ -1232,6 +1252,16 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "english-to-cron" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c16423ac933fee80f05a52b435a912d5b08edbbbfe936e0042ebb3accdf303da" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "enum-ordinalize" version = "4.3.0" @@ -2130,7 +2160,7 @@ dependencies = [ [[package]] name = "loco-rs" -version = "0.8.1" +version = "0.9.0" dependencies = [ "argon2", "async-trait", @@ -2147,6 +2177,8 @@ dependencies = [ "clap", "colored", "duct", + "duct_sh", + "english-to-cron", "fs-err", "futures-util", "hyper", @@ -2172,6 +2204,7 @@ dependencies = [ "tera", "thiserror", "tokio", + "tokio-cron-scheduler", "tower", "tower-http", "tracing", @@ -2381,6 +2414,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -2989,9 +3033,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -4419,6 +4463,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "tokio-cron-scheduler" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b9480125554f0ace1c3c3797a24b5cc56c6a7cd82c739db35fb54c4dc046f3" +dependencies = [ + "chrono", + "cron", + "num-derive", + "num-traits", + "tokio", + "tracing", + "uuid", +] + [[package]] name = "tokio-macros" version = "2.4.0" diff --git a/starters/rest-api/Cargo.toml b/starters/rest-api/Cargo.toml index 0634f2f48..b71365282 100644 --- a/starters/rest-api/Cargo.toml +++ b/starters/rest-api/Cargo.toml @@ -11,7 +11,7 @@ default-run = "loco_starter_template-cli" [dependencies] -loco-rs = { version = "0.8.1" } +loco-rs = { version = "0.9.0" } migration = { path = "migration" } serde = { version = "1", features = ["derive"] } @@ -46,5 +46,5 @@ required-features = [] [dev-dependencies] serial_test = "3.1.1" rstest = "0.21.0" -loco-rs = { version = "0.8.1", features = ["testing"] } +loco-rs = { version = "0.9.0", features = ["testing"] } insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] } diff --git a/starters/rest-api/migration/Cargo.toml b/starters/rest-api/migration/Cargo.toml index 8e740c33a..723b73ccf 100644 --- a/starters/rest-api/migration/Cargo.toml +++ b/starters/rest-api/migration/Cargo.toml @@ -10,7 +10,7 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1", features = ["attributes", "tokio1"] } -loco-rs = { version = "0.8.1" } +loco-rs = { version = "0.9.0" } [dependencies.sea-orm-migration] version = "1.0.0" diff --git a/starters/saas/Cargo.lock b/starters/saas/Cargo.lock index 776992d51..dc3886b62 100644 --- a/starters/saas/Cargo.lock +++ b/starters/saas/Cargo.lock @@ -1006,6 +1006,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "cron" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8c3e73077b4b4a6ab1ea5047c37c57aee77657bc8ecd6f29b0af082d0b0c07" +dependencies = [ + "chrono", + "nom", + "once_cell", +] + [[package]] name = "cron_clock" version = "0.8.0" @@ -1206,6 +1217,15 @@ dependencies = [ "shared_child", ] +[[package]] +name = "duct_sh" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6633cadba557545fbbe0299a2f9adc4bb2fc5fb238773f5e841e0c23d62146" +dependencies = [ + "duct", +] + [[package]] name = "educe" version = "0.5.11" @@ -1249,6 +1269,16 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "english-to-cron" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c16423ac933fee80f05a52b435a912d5b08edbbbfe936e0042ebb3accdf303da" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "enum-ordinalize" version = "4.3.0" @@ -2259,7 +2289,7 @@ dependencies = [ [[package]] name = "loco-rs" -version = "0.8.1" +version = "0.9.0" dependencies = [ "argon2", "async-trait", @@ -2276,6 +2306,8 @@ dependencies = [ "clap", "colored", "duct", + "duct_sh", + "english-to-cron", "fs-err", "futures-util", "hyper", @@ -2301,6 +2333,7 @@ dependencies = [ "tera", "thiserror", "tokio", + "tokio-cron-scheduler", "tower", "tower-http", "tracing", @@ -2512,6 +2545,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -3126,9 +3170,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -4586,6 +4630,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "tokio-cron-scheduler" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b9480125554f0ace1c3c3797a24b5cc56c6a7cd82c739db35fb54c4dc046f3" +dependencies = [ + "chrono", + "cron", + "num-derive", + "num-traits", + "tokio", + "tracing", + "uuid", +] + [[package]] name = "tokio-macros" version = "2.4.0" diff --git a/starters/saas/Cargo.toml b/starters/saas/Cargo.toml index a9eaa5931..c4193b7e4 100644 --- a/starters/saas/Cargo.toml +++ b/starters/saas/Cargo.toml @@ -11,7 +11,7 @@ default-run = "loco_starter_template-cli" [dependencies] -loco-rs = { version = "0.8.1" } +loco-rs = { version = "0.9.0" } migration = { path = "migration" } serde = { version = "1", features = ["derive"] } @@ -51,5 +51,5 @@ required-features = [] [dev-dependencies] serial_test = "3.1.1" rstest = "0.21.0" -loco-rs = { version = "0.8.1", features = ["testing"] } +loco-rs = { version = "0.9.0", features = ["testing"] } insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] } diff --git a/starters/saas/migration/Cargo.toml b/starters/saas/migration/Cargo.toml index 8e740c33a..723b73ccf 100644 --- a/starters/saas/migration/Cargo.toml +++ b/starters/saas/migration/Cargo.toml @@ -10,7 +10,7 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1", features = ["attributes", "tokio1"] } -loco-rs = { version = "0.8.1" } +loco-rs = { version = "0.9.0" } [dependencies.sea-orm-migration] version = "1.0.0"