Expand description
Task runner and process manager for Rust.
If you’re not happy managing your infrastructure with a pile of shell scripts,
this crate might be helpful. It provides base building blocks for defining
and running various kinds of tasks.
It’s like foreman
but more low-level, with Rust API
and more flexibility & features.
Works great with clap
!
Examples
Check out runnable examples on GitHub: steward/examples
.
ⓘ
#[macro_use]
extern crate steward;
use steward::{Cmd, Env, ProcessPool, Process};
#[tokio::main]
async fn main() -> steward::Result<()> {
client::build_cmd().run().await?;
server::build_cmd().run().await?;
ProcessPool::run(vec![client::watcher(), server::watcher()]).await?;
Ok(())
}
mod server {
fn build_cmd() -> Cmd {
cmd! {
exe: "cargo build",
env: Env::empty(),
pwd: Loc::root(),
msg: "Building a server",
}
}
fn watcher() -> Process {
process! {
tag: "server",
cmd: cmd! {
exe: "cargo watch",
env: Env::empty(),
pwd: Loc::root(),
msg: "Running a reloadable server",
},
}
}
}
mod client {
fn build_cmd() -> Cmd {
cmd! {
exe: "npm build",
env: Env::empty(),
pwd: Loc::root(),
msg: "Building a client",
}
}
fn watcher() -> Process {
process! {
tag: "client",
cmd: cmd! {
exe: "npm watch",
env: Env::empty(),
pwd: Loc::root(),
msg: "Watching a client",
},
}
}
}
Limitations
Async runtimes
Tokio only.
Re-exports
pub use cmd::Cmd;
pub use cmd::KillTimeout;
pub use cmd::SpawnOptions;
pub use dep::Dependency;
pub use dep::DependencyWaitError;
pub use env::Env;
pub use fs::FsEntry;
pub use net::HttpService;
pub use net::TcpService;
pub use process::PoolEntry;
pub use process::Process;
pub use process::ProcessPool;
pub use process::RunningProcess;
pub use result::Error;
pub use result::Result;
Modules
- Base building block of the crate.
- Dependant processes.
- Command environment.
- File system related types.
- Network related types.
- Long running processes.
Macros
- Convenience macro for creating a
Cmd
. - Formats a headline that gets printed to console when running a command.
- Convenience macro for creating a
Process
.
Structs
- The Request Method (VERB)
Traits
- A location of file or directory of a project.