GithubHelp home page GithubHelp logo

aklitzke / dors Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 0.0 93 KB

๐Ÿฅฆ Dors. No-fuss workspace-friendly task runner for Cargo

License: Apache License 2.0

Rust 100.00%
rust cargo task-runner workspace dors make cargo-subcommand cargo-plugin makefile tasks

dors's Introduction

๐ŸŒˆ Dors more, with Dorsfiles ๐ŸŒ‚

crates.io Build Status

What is this?

A task runner for the rust and cargo ecosystem.

Especially targeted toward environments with a large cargo workspace, like embedded or cloud-based, that often contain multiple targets, tools outside of the rust ecosystem, complex deploy scripts, and CI pipelines.

Designed with the hope that easy things will be easy, and hard things will be possible.

Example

# ./Dorsfile.toml
[task.do-tests]
command = "cargo test --target x86_86-unknown-linux-gnu -- --nocapture"
$ dors do-tests

Installation

$ cargo install dors

Features

Run tasks on all members of a workspace:

# ./Dorsfile.toml
[task.test]
command = "echo Hello, World! from $PWD"
run-from = "members"

Set crate-specific environment variables:

# ./member-1/Dorsfile
[[env]]
CARGO_TARGET_DIR = "../target-member-1"

Dors will automatically assign CARGO_WORKSPACE_ROOT for you. $PWD, $HOME, and other environment variables work as expected.

Assign environment variables with bash:

[[env]]
MY_SPECIAL_ENV_VAR = "$(ls)"
ANOTHER_ENV_VAR = "$HOME/.cargo/bin"

View all available tasks:

$ cargo dors -l
my-special-task
load
deploy

Also supports tab autocompletion of tasks!

Pass arguments:

[task.say-hi]
command = 'echo Hello, "$@"!'
$ cargo dors say-hi -- Fellow Human
Hello, Fellow Human!

Run multi-line bash scripts:

# ./Dorsfile.toml
[task.play-go]
command = '''
url="igs.joyjoy.net 6969"
telnet $url
'''

Reduce duplication by inheriting tasks:

# ./Dorsfile.toml
[task.check]
command = "cargo check --all-targets"
$ cd shared_code && cargo dors check

Invoke tasks before or after others:

#./Dorsfile.toml
[task.play-go]
before = ["install-telnet"]
command = "telnet igs.joyjoy.net 6969"
after = ["congratulate"]

[task.install-telnet]
command = "sudo apt-get install -y --no-install-recommends telnet"

[task.congratulate]
command = "echo 'I hope you played well!'"

Before/after tasks are ran from left to right. If a task is repeated in the tree, it will only be ran once.

Override workspace tasks for a single workspace member:

#./Dorsfile.toml
[task.build]
command = "cargo build"
run-from = "members"
#./embedded_device/Dorsfile.toml
[task.build]
command = "cargo build --features debug-logs"

Skip particular members:

#./Dorsfile.toml
[task.test]
command = "cargo test"
run-from = "members"
skip-members = ["embedded_device"]

[task.clippy]
command = "cargo clippy"
run-from = "members"
only-members = ["shared_code"]

Run commands from member crate on workspace root:

# ./embedded_device/Dorsfile.toml
[task.pre-build]
run-from = "workspace-root"
command = "echo interestingstuff > target/special-file"

Run commands from arbitrary paths:

# ./Dorsfile.toml
[task.run-other-project]
run-from = { path = "../random_node_project" }
command = "npm run"

...And more! ๐ŸŽฉ

FAQ:

Q: Will this automatically provide me with standard cargo commands?
A: Nope. A blank Dorsfile is a blank Dorsfile. It's up to you to build it out.

Q: Is this ready for production?
A: This is currently in alpha. Use at your own risk.

Q: How do you pronounce this?
A: Like 'horse'

Q: Shouldn't you just add an 'e' at the end? Like 'dorse'?
A: Never. Nope. Go to your room. Don't come out till you've learned your lesson ๐Ÿ™ƒ

Q: Do I have to use this with a workspace?
A: You can use this crate with or without your crate being a workspace.

Q: What are the next steps for improvement?
A: Likely error messaging. Want something? Open an issue!

Q: Would you accept a PR?
A: Absolutely!

Q: My question wasn't answered here
A: Feel free to reach out!

An open book

dors's People

Contributors

aklitzke avatar andrewlew1s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dors's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.