Skip to content

Commit

Permalink
chore: add README
Browse files Browse the repository at this point in the history
  • Loading branch information
cestef committed Jan 31, 2025
1 parent 1983b91 commit 23f5fc1
Show file tree
Hide file tree
Showing 4 changed files with 273 additions and 0 deletions.
132 changes: 132 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<p align="center" >
<img src="assets/header.png" alt="braisé" style="width: 75%" />
</p>

[![Crates.io](https://img.shields.io/crates/v/braise)](https://crates.io/crates/braise)
[![GitHub](https://img.shields.io/github/license/cestef/braise)](LICENSE)
[![Release](https://img.shields.io/github/v/release/cestef/braise)](https://github.com/cestef/braise/releases/latest)

<p align="center">
<i>Run your tasks like a chef !</i>
</p>

---

<!-- /bʁɛze/ -->

## Installation

### Using homebrew

```bash
brew install cestef/tap/braise
```

### Using cargo

```bash
cargo install braise
```

or with [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall)

```bash
cargo binstall braise
```

## Usage

All the configuration is done in a `braise.toml` file at the root of your project.

> [!NOTE]
> Valid file names are defined [here](src/constants.rs)
```toml
[NAME]
command = "echo Hello, World!"
```

Then you can run your task with:

```bash
braise NAME
```

The following options are available:

```toml
# Global configuration
shell = "sh -c" # The shell to use (default: $SHELL or "sh -c")
quiet = false # Do not print the command output (default: false)
default = "NAME" # The default task to run (optional)
dotenv = ".env" # The path to the .env file (optional)

# Task configuration
[NAME]
command = "echo Hello, World!" # The command to run
description = "A simple task" # The description of the task (optional)
dependencies = ["OTHER_TASK"] # The list of tasks to run before this one (optional)
runs-on = ["linux", "macos"] # The platforms on which the task can run (optional)
```

The `shell` and `quiet` fields are global and can be overridden for each task.

> [!NOTE]
> If you are a busy person, you can use the `br` alias instead of `braise`

### Environment variables

By default `braisé` will look for a `.env` file at the root of your project and load the environment variables from it.

```bash
# .env
HELLO=WORLD
```

```toml
[NAME]
command = "echo $HELLO" # This will let the shell grab the environment variable
# or
command = "echo {env(HELLO)}" # This will expand to "echo WORLD"
```

Default values for environment variables can also be set:

```toml
[NAME]
command = "echo {env(MISSING:default)}" # This will expand to "echo default"
```

### Platform specific commands

You can specify platform specific commands by using the `runs-on` field:

```toml
[[NAME]]
command = "echo Hello, World!"
runs-on = ["windows"]

[[NAME]]
command = "echo Bonjour, Monde!"
runs-on = ["linux", "macos"]
```

Notice the double brackets `[[NAME]]` to define multiple tasks with the same name.

### JSON Schema

A JSON schema is available [here](schema/braise.schema.json) to help you write your `braise.toml` file.

```toml
#:schema https://raw.githubusercontent.com/cestef/braise/main/schema/braise.schema.json

[echo]
command = "echo Hello, World!"
```

You can use the `#:schema` directive to specify the path to the schema file.
## License

This project is licensed under the [MIT license](LICENSE) (You can basically do whatever you want with this code)

Binary file added assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 141 additions & 0 deletions braise.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "JSON schema for the braisé configuration",
"$id": "https://raw.githubusercontent.com/cestef/braise/main/schema/braise.schema.json",
"type": "object",
"title": "Braisé Configuration Schema",
"definitions": {
"task": {
"type": "object",
"title": "Task",
"description": "A task to run in the braisé configuration",
"properties": {
"command": {
"type": "string",
"description": "The command to run"
},
"description": {
"type": "string",
"description": "A description of the task"
},
"shell": {
"type": "string",
"description": "The shell to use for this task"
},
"quiet": {
"description": "Whether to suppress output for this task",
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer",
"minimum": 0,
"maximum": 2
}
]
},
"runs-on": {
"type": "array",
"description": "The platforms to run the task on",
"items": {
"type": "string",
"enum": [
"windows",
"macos",
"linux",
"android",
"ios"
]
}
},
"depends-on": {
"type": "array",
"items": {
"type": "string"
},
"description": "The names of tasks that this task depends on"
},
"workspace": {
"type": "boolean",
"description": "Whether to automatically infer the command from the current cargo workspace"
}
},
"oneOf": [
{
"required": [
"command"
],
"not": {
"required": [
"workspace"
]
}
},
{
"required": [
"workspace"
],
"not": {
"required": [
"command"
]
}
}
]
}
},
"properties": {
"shell": {
"type": "string",
"description": "The shell to use for braisé tasks"
},
"quiet": {
"description": "Whether to suppress all output",
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer",
"minimum": 0,
"maximum": 2
}
]
},
"default": {
"type": "string",
"description": "The default command to run when no command is specified"
},
"dotenv": {
"description": "The path to the .env file to load, or false to disable",
"anyOf": [
{
"type": "string"
},
{
"type": "boolean"
}
]
},
"parallel": {
"type": "boolean",
"description": "Whether to run tasks in parallel"
}
},
"additionalProperties": {
"anyOf": [
{
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/task"
}
},
{
"type": "object",
"$ref": "#/definitions/task"
}
]
}
}

0 comments on commit 23f5fc1

Please sign in to comment.