diff --git a/Cargo.toml b/Cargo.toml index cb635aa..4b9ef1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,35 +1,5 @@ -[package] -name = "sprinklers_rs" -version = "0.1.0" -authors = ["Alex Mikhalev "] -edition = "2018" +[workspace] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -rusqlite = "0.24.0" -color-eyre = "0.5.1" -eyre = "0.6.0" -thiserror = "1.0.20" -tokio = { version = "0.2.22", features = ["rt-core", "time", "stream", "sync", "signal", "macros", "test-util"] } -tracing = { version = "0.1.19", features = ["log"] } -tracing-futures = "0.2.4" -pin-project = "0.4.23" -im = "15.0.0" -chrono = { version = "0.4.15" } -assert_matches = "1.3.0" -serde = { version = "1.0.116", features = ["derive"] } -serde_json = "1.0.57" -actix = { version = "0.10.0", default-features = false } -actix-rt = "1.1.1" -futures-util = { version = "0.3.5", default-features = false, features = ["std", "async-await", "sink"] } -num-traits = "0.2.12" -num-derive = "0.3.2" - -[dependencies.rumqttc] -version = "0.1.0" - -[dependencies.tracing-subscriber] -version = "0.2.11" -default-features = false -features = ["registry", "fmt", "env-filter", "ansi"] +members = [ + "sprinklers_rs" +] \ No newline at end of file diff --git a/sprinklers_rs/Cargo.toml b/sprinklers_rs/Cargo.toml new file mode 100644 index 0000000..cb635aa --- /dev/null +++ b/sprinklers_rs/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "sprinklers_rs" +version = "0.1.0" +authors = ["Alex Mikhalev "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +rusqlite = "0.24.0" +color-eyre = "0.5.1" +eyre = "0.6.0" +thiserror = "1.0.20" +tokio = { version = "0.2.22", features = ["rt-core", "time", "stream", "sync", "signal", "macros", "test-util"] } +tracing = { version = "0.1.19", features = ["log"] } +tracing-futures = "0.2.4" +pin-project = "0.4.23" +im = "15.0.0" +chrono = { version = "0.4.15" } +assert_matches = "1.3.0" +serde = { version = "1.0.116", features = ["derive"] } +serde_json = "1.0.57" +actix = { version = "0.10.0", default-features = false } +actix-rt = "1.1.1" +futures-util = { version = "0.3.5", default-features = false, features = ["std", "async-await", "sink"] } +num-traits = "0.2.12" +num-derive = "0.3.2" + +[dependencies.rumqttc] +version = "0.1.0" + +[dependencies.tracing-subscriber] +version = "0.2.11" +default-features = false +features = ["registry", "fmt", "env-filter", "ansi"] diff --git a/scripts/add_migration.sh b/sprinklers_rs/scripts/add_migration.sh similarity index 100% rename from scripts/add_migration.sh rename to sprinklers_rs/scripts/add_migration.sh diff --git a/src/database/migration.rs b/sprinklers_rs/src/database/migration.rs similarity index 100% rename from src/database/migration.rs rename to sprinklers_rs/src/database/migration.rs diff --git a/src/database/migrations/0001-table_sections-down.sql b/sprinklers_rs/src/database/migrations/0001-table_sections-down.sql similarity index 100% rename from src/database/migrations/0001-table_sections-down.sql rename to sprinklers_rs/src/database/migrations/0001-table_sections-down.sql diff --git a/src/database/migrations/0001-table_sections-up.sql b/sprinklers_rs/src/database/migrations/0001-table_sections-up.sql similarity index 100% rename from src/database/migrations/0001-table_sections-up.sql rename to sprinklers_rs/src/database/migrations/0001-table_sections-up.sql diff --git a/src/database/migrations/0002-section_rows-down.sql b/sprinklers_rs/src/database/migrations/0002-section_rows-down.sql similarity index 100% rename from src/database/migrations/0002-section_rows-down.sql rename to sprinklers_rs/src/database/migrations/0002-section_rows-down.sql diff --git a/src/database/migrations/0002-section_rows-up.sql b/sprinklers_rs/src/database/migrations/0002-section_rows-up.sql similarity index 100% rename from src/database/migrations/0002-section_rows-up.sql rename to sprinklers_rs/src/database/migrations/0002-section_rows-up.sql diff --git a/src/database/migrations/0003-table_programs-down.sql b/sprinklers_rs/src/database/migrations/0003-table_programs-down.sql similarity index 100% rename from src/database/migrations/0003-table_programs-down.sql rename to sprinklers_rs/src/database/migrations/0003-table_programs-down.sql diff --git a/src/database/migrations/0003-table_programs-up.sql b/sprinklers_rs/src/database/migrations/0003-table_programs-up.sql similarity index 100% rename from src/database/migrations/0003-table_programs-up.sql rename to sprinklers_rs/src/database/migrations/0003-table_programs-up.sql diff --git a/src/database/migrations/0004-program_rows-down.sql b/sprinklers_rs/src/database/migrations/0004-program_rows-down.sql similarity index 100% rename from src/database/migrations/0004-program_rows-down.sql rename to sprinklers_rs/src/database/migrations/0004-program_rows-down.sql diff --git a/src/database/migrations/0004-program_rows-up.sql b/sprinklers_rs/src/database/migrations/0004-program_rows-up.sql similarity index 100% rename from src/database/migrations/0004-program_rows-up.sql rename to sprinklers_rs/src/database/migrations/0004-program_rows-up.sql diff --git a/src/database/migrations/0005-view_program_sequence-down.sql b/sprinklers_rs/src/database/migrations/0005-view_program_sequence-down.sql similarity index 100% rename from src/database/migrations/0005-view_program_sequence-down.sql rename to sprinklers_rs/src/database/migrations/0005-view_program_sequence-down.sql diff --git a/src/database/migrations/0005-view_program_sequence-up.sql b/sprinklers_rs/src/database/migrations/0005-view_program_sequence-up.sql similarity index 100% rename from src/database/migrations/0005-view_program_sequence-up.sql rename to sprinklers_rs/src/database/migrations/0005-view_program_sequence-up.sql diff --git a/src/database/migrations/0006-fix_view_program_seq-down.sql b/sprinklers_rs/src/database/migrations/0006-fix_view_program_seq-down.sql similarity index 100% rename from src/database/migrations/0006-fix_view_program_seq-down.sql rename to sprinklers_rs/src/database/migrations/0006-fix_view_program_seq-down.sql diff --git a/src/database/migrations/0006-fix_view_program_seq-up.sql b/sprinklers_rs/src/database/migrations/0006-fix_view_program_seq-up.sql similarity index 100% rename from src/database/migrations/0006-fix_view_program_seq-up.sql rename to sprinklers_rs/src/database/migrations/0006-fix_view_program_seq-up.sql diff --git a/src/database/migrations/mod.rs b/sprinklers_rs/src/database/migrations/mod.rs similarity index 100% rename from src/database/migrations/mod.rs rename to sprinklers_rs/src/database/migrations/mod.rs diff --git a/src/database/mod.rs b/sprinklers_rs/src/database/mod.rs similarity index 100% rename from src/database/mod.rs rename to sprinklers_rs/src/database/mod.rs diff --git a/src/main.rs b/sprinklers_rs/src/main.rs similarity index 100% rename from src/main.rs rename to sprinklers_rs/src/main.rs diff --git a/src/model/mod.rs b/sprinklers_rs/src/model/mod.rs similarity index 100% rename from src/model/mod.rs rename to sprinklers_rs/src/model/mod.rs diff --git a/src/model/program.rs b/sprinklers_rs/src/model/program.rs similarity index 100% rename from src/model/program.rs rename to sprinklers_rs/src/model/program.rs diff --git a/src/model/section.rs b/sprinklers_rs/src/model/section.rs similarity index 100% rename from src/model/section.rs rename to sprinklers_rs/src/model/section.rs diff --git a/src/mqtt/actor.rs b/sprinklers_rs/src/mqtt/actor.rs similarity index 100% rename from src/mqtt/actor.rs rename to sprinklers_rs/src/mqtt/actor.rs diff --git a/src/mqtt/event_loop.rs b/sprinklers_rs/src/mqtt/event_loop.rs similarity index 100% rename from src/mqtt/event_loop.rs rename to sprinklers_rs/src/mqtt/event_loop.rs diff --git a/src/mqtt/mod.rs b/sprinklers_rs/src/mqtt/mod.rs similarity index 100% rename from src/mqtt/mod.rs rename to sprinklers_rs/src/mqtt/mod.rs diff --git a/src/mqtt/request/mod.rs b/sprinklers_rs/src/mqtt/request/mod.rs similarity index 100% rename from src/mqtt/request/mod.rs rename to sprinklers_rs/src/mqtt/request/mod.rs diff --git a/src/mqtt/request/programs.rs b/sprinklers_rs/src/mqtt/request/programs.rs similarity index 100% rename from src/mqtt/request/programs.rs rename to sprinklers_rs/src/mqtt/request/programs.rs diff --git a/src/mqtt/request/sections.rs b/sprinklers_rs/src/mqtt/request/sections.rs similarity index 100% rename from src/mqtt/request/sections.rs rename to sprinklers_rs/src/mqtt/request/sections.rs diff --git a/src/mqtt/topics.rs b/sprinklers_rs/src/mqtt/topics.rs similarity index 100% rename from src/mqtt/topics.rs rename to sprinklers_rs/src/mqtt/topics.rs diff --git a/src/option_future.rs b/sprinklers_rs/src/option_future.rs similarity index 100% rename from src/option_future.rs rename to sprinklers_rs/src/option_future.rs diff --git a/src/program_runner.rs b/sprinklers_rs/src/program_runner.rs similarity index 99% rename from src/program_runner.rs rename to sprinklers_rs/src/program_runner.rs index c69a008..6ce6da7 100644 --- a/src/program_runner.rs +++ b/sprinklers_rs/src/program_runner.rs @@ -689,9 +689,10 @@ mod test { runner.update_programs(programs).await.unwrap(); // First try a non-existant program id - runner.run_program_id(3).await.unwrap(); - yield_now().await; - assert_matches!(prog_events.try_recv(), Err(broadcast::TryRecvError::Empty)); + assert_matches!( + runner.run_program_id(3).await, + Err(ProgramRunnerError::InvalidProgramId(3)) + ); runner.run_program_id(1).await.unwrap(); yield_now().await; diff --git a/src/schedule.rs b/sprinklers_rs/src/schedule.rs similarity index 100% rename from src/schedule.rs rename to sprinklers_rs/src/schedule.rs diff --git a/src/section_interface.rs b/sprinklers_rs/src/section_interface.rs similarity index 100% rename from src/section_interface.rs rename to sprinklers_rs/src/section_interface.rs diff --git a/src/section_runner.rs b/sprinklers_rs/src/section_runner.rs similarity index 100% rename from src/section_runner.rs rename to sprinklers_rs/src/section_runner.rs diff --git a/src/section_runner_json.rs b/sprinklers_rs/src/section_runner_json.rs similarity index 100% rename from src/section_runner_json.rs rename to sprinklers_rs/src/section_runner_json.rs diff --git a/src/serde.rs b/sprinklers_rs/src/serde.rs similarity index 100% rename from src/serde.rs rename to sprinklers_rs/src/serde.rs diff --git a/src/trace_listeners.rs b/sprinklers_rs/src/trace_listeners.rs similarity index 100% rename from src/trace_listeners.rs rename to sprinklers_rs/src/trace_listeners.rs diff --git a/src/update_listener.rs b/sprinklers_rs/src/update_listener.rs similarity index 100% rename from src/update_listener.rs rename to sprinklers_rs/src/update_listener.rs