{"id":15538299,"url":"https://github.com/ali77gh/bake-rs","last_synced_at":"2025-04-14T07:08:42.839Z","repository":{"id":255465143,"uuid":"844376606","full_name":"ali77gh/bake-rs","owner":"ali77gh","description":"Simple and easy to use \"script runner\" written in Rust.","archived":false,"fork":false,"pushed_at":"2025-04-10T16:43:03.000Z","size":368,"stargazers_count":141,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"stable","last_synced_at":"2025-04-14T07:08:36.629Z","etag":null,"topics":["build-tool","cli","cross-platform","dependency-management","gui","hacktoberfest","script-runner","task-runner","tui","yaml"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ali77gh.png","metadata":{"files":{"readme":"README.md","changelog":"Changes.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T06:09:53.000Z","updated_at":"2025-04-14T03:04:53.000Z","dependencies_parsed_at":"2024-09-13T21:46:23.807Z","dependency_job_id":"cd9f2d13-52dd-429d-a79c-a4a59e15bb97","html_url":"https://github.com/ali77gh/bake-rs","commit_stats":{"total_commits":84,"total_committers":1,"mean_commits":84.0,"dds":0.0,"last_synced_commit":"444616fadbfafb912918ce9477d84a3d53b25065"},"previous_names":["ali77gh/bake-rs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Fbake-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Fbake-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Fbake-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ali77gh%2Fbake-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ali77gh","download_url":"https://codeload.github.com/ali77gh/bake-rs/tar.gz/refs/heads/stable","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837281,"owners_count":21169374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","cli","cross-platform","dependency-management","gui","hacktoberfest","script-runner","task-runner","tui","yaml"],"created_at":"2024-10-02T12:03:01.107Z","updated_at":"2025-04-14T07:08:42.828Z","avatar_url":"https://github.com/ali77gh.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Bake-rs\n\n\u003cimg src=\"./logo.png\" width=600/\u003e \n\n[![OS - Linux](https://img.shields.io/badge/OS-Linux-blue?logo=linux\u0026logoColor=white)](https://www.linux.org/ \"Go to Linux homepage\")\n[![OS - macOS](https://img.shields.io/badge/OS-macOS-blue?logo=apple\u0026logoColor=white)](https://www.apple.com/macos/ \"Go to Apple homepage\")\n[![OS - Windows](https://img.shields.io/badge/OS-Windows-blue?logo=windows\u0026logoColor=white)](https://www.microsoft.com/ \"Go to Microsoft homepage\")\n\n![GitHub top language](https://img.shields.io/github/languages/top/ali77gh/bake-rs)\n[![GitHub license](https://badgen.net/github/license/ali77gh/bake-rs)](https://github.com/ali77gh/bake-rs/blob/master/LICENSE)\n\nBake is a universal cross-platform script runner written in Rust which can be used for any kind of project or application.\n\nEssentially, you put your tasks in a YAML file. Then, you have an interactive CLI + TUI + GUI interface to run these tasks, enabling your coworkers (and yourself six months later, having forgotten all the commands) to execute your commands with the click of a button!\n\nBake can also help users install dependencies and setup environment variables. Furthermore, it supports a plugin system that allows you to import other people's bakefile.yaml configurations into your own.\n\nYou can see roadmap [here](https://github.com/users/ali77gh/projects/5/)\n\n\u003cimg src=\"screenshot.jpg\" width=600/\u003e\n\n## Table of content\n\n- [Bake-rs](#bake-rs)\n  - [Table of content](#table-of-content)\n  - [Installation](#installation)\n    - [Linux, Mac, WSL and Docker:](#linux-mac-wsl-and-docker)\n    - [Windows:](#windows)\n  - [Basic](#basic)\n    - [Usage](#usage)\n  - [End event handlers](#end-event-handlers)\n    - [Handler syntax :](#handler-syntax-)\n    - [Events names:](#events-names)\n    - [Example:](#example)\n  - [Keep alive](#keep-alive)\n    - [Example](#example-1)\n  - [Dependencies](#dependencies)\n    - [Run other tasks from a task](#run-other-tasks-from-a-task)\n  - [Platform specific commands](#platform-specific-commands)\n  - [Environment variables](#environment-variables)\n  - [Working directory](#working-directory)\n  - [Plugin system](#plugin-system)\n  - [Stars](#stars)\n\n\n## Installation\n\n### Linux, Mac, WSL and Docker:\nSingle command installation:\n```bash\ncurl -sfL https://raw.githubusercontent.com/ali77gh/bake-rs/stable/install.sh | sudo bash -\n```\n\n### Windows:\nDownload latest release from [here](https://github.com/ali77gh/bake-rs/releases) and copy that where you want and than add installation path to PATH env variable and than you are good to go.\n\n## Basic\n\nMake a file named 'bakefile.yaml'\n\n```yaml\ntasks:\n  - name: clean\n    help_msg: this task removes what you build\n    commands: [ rm ./build ]\n\n  - name: hello\n    help_msg: this task says hello\n    commands: \n      - echo hello world\n      - echo hello from Bake\n```\n\n### Usage\n\nSee list of tasks:\n```sh\n$ bake --show # or --list\n Tasks: \n\n ⚙  1  clean (this task removes what you build)\n\n ⚙  2  hello (this task says hello)\n```\n\nRun specific task:\n\n```sh\n$ bake hello\n  🛈 Verbose : task 'hello' is running...\nhello world\nhello from bake\n  🛈 Verbose : Task 'hello' finished successfully. time: 2ms\n```\n\nNote: you can also run task by index like 'bake 1'\n\nStart interactive CLI (see screen shot):\n\n```sh\nbake\n```\nThis will run bake in loop\n\n## End event handlers\n\n### Handler syntax :\n```\n\u003cEVENT_NAME\u003e: \u003cFUNCTION_CALL\u003e\n```\n\n### Events names:\n  1. on_success: runs if task ends with zero code\n  2. on_error: runs if task ends with non-zero code\n  3. on_end: runs anyway (runs after on_success and on_error)\n\n### Example:\n\nThis script checks if 'build' directory exist and if it's exist it runs 'another_task1' if it's not exist it runs another_task2, and after that it runs another_task3 in ether ways.\n```yaml\ntasks:\n  - name: task_name\n    commands: \n        - ls build\n    on_success: \"@this.another_task1\"\n    on_error: \"@this.another_task2\"\n    on_end: \"@this.another_task3\"\n```\n\n\u003e [!WARNING]  \n\u003e DO NOT recursive call same function (bake will panic for stack overflow at some point) use [keep_alive](#keep-alive) instead.\n\n## Keep alive\n\nThis option will run your task in a loop without considering exit-code\n\nNote: default is false\n\n### Example\n```yaml\ntasks:\n  - name: task_name\n    commands: \n        - npm start\n    keep_alive: true\n```\n\n\n## Dependencies\n\nSometimes you need some stuff installed on system to run a command.\n\nfor example to compile a Rust code-base you need to have 'cargo' installed.\n\n```yaml\ndependencies:\n  - name: cargo\n    check: [ cargo --version ]\n    link: https://www.rust-lang.org/tools/install # install button opens browser and user should manually install it\n\n  - name: clippy\n    dependencies: [ cargo ] # dependencies can depend on other dependencies\n    check: [ cargo clippy --version ]\n    commands: [ cargo install clippy ] # install button will automatically install\n\n  - name: check-file-exist-dependency\n    check: [ ls target ] # you can check if a file or directory exist like this\n    commands: [ cargo build ]\n```\n\nNow you tasks can depends on dependencies\n\n```yaml\ntasks:\n  - name: release\n    dependencies: [ cargo ] \n    commands: \n        - cargo build --release\n\n  - name: check\n    dependencies: [ cargo, clippy ]\n    commands:\n      - cargo check\n      - cargo clippy\n      - cargo fmt --check\n      - cargo test\n```\n\nNote: by running 'release' Bake first gonna check if you have rust installed by running specified command: \"cargo --version\", if this commands exit with non zero code (means cargo is not installed) Bake will run cargo installation commands that you provided (or open provided link in browser) and while cargo is installed Bake will run 'release' task commands one by one.\n\nNote: 'check' command works with [exit code](https://en.wikipedia.org/wiki/Exit_status#:~:text=In%20computing%2C%20the%20exit%20status,referred%20to%20as%20an%20errorlevel.)\nso if the exit code is 0 this means dependency is installed or exist but any other non-zero code will try to run your specified command or link to get your dependency installed.\n\nYou can also specify different commands or links for installing on different platforms:\n\n\nNote: by default bake will ask yes/no question before start installing, \nbut by passing '--non-interactive' switch bake will not wait for stdin and will start installing dependency. \n\n```yaml\ndependencies:\n  - name: wget\n    check: [ wget --version ]\n    commands_linux: [ sudo apt install wget ] # linux only\n    link: https://www.gnu.org/software/wget/ # mac and windows (in this case)\n```\n\n### Run other tasks from a task\n\nFor running other task from your task you need to put a '@' at the beginning of your command (so the parser will know it's a Bake command and not a system binary)\n\n\u003e [!WARNING] \n\u003e '@' syntax should always be used inside double quotes.\n\n```yaml\ntasks:\n  - name: release\n    dependencies: [ rust ]\n    commands: \n      - \"@this.check\" # here\n      - cargo build --release\n      - \"@this.publish\" # here\n\n  - name: check\n    commands:\n      - cargo check\n      - cargo clippy\n      - cargo fmt --check\n      - cargo test\n\n  - name: publish\n    commands:\n      - cargo publish\n```\n\n## Platform specific commands\n\nSometimes you need to run different commands on different operating systems:\n\n```yaml\ntasks:\n  - name: clean\n    commands: # default (linux and mac in this case)\n        - rm ./target\n    commands_windows: \n        - del target\n```\n\nNote: If you run this on a windows system only the windows commands will run but as you did not specify commands_linux and commands_macos if you run this task on Linux or MacOS it will run default commands.\n\nNote: if you don't specify platform specific commands for a platform with no default commands Bake will show an error while running that task on that specific platform.\n\n## Environment variables\n\nSometimes your tasks need some environment variables to run, in this case you can specify some 'envs' for your task and Bake will check if that environment variable is exist or not.\n\nNote: you can also provide a default value for your env by providing 'default' field in your yaml\n\n```yaml\ntasks:\n  - name: listen\n    envs:\n      - name: PORT \n        default: 80\n    commands: [ nc -l -p $PORT ]\n```\n\nYou can also specify simple validation for your env that checks value before run.\n\n1. number (float or integer)\n1. integer\n1. variants(variation1|variation2|variation3,...)\n\n```yaml\ntasks:\n  - name: task_with_envs\n    envs:\n      - name: PORT\n        default: 5\n        validator: integer\n\n      - name: build-mode\n        default: debug\n        validator: variants(debug|release)\n```\n\nAnd you can pass env to a task while calling it from another task\n\nsyntax is like:\n\n```yaml\ntasks:\n  - name: task_with_envs_caller\n    commands:\n      - \"@this.task_with_envs --PORT 80 --build-mode release\" # passing args to other task\n```\n\nNote: by default bake will ask for env on cli if it's not set, \nbut by passing '--non-interactive' switch bake will not wait for stdin and will raise an error. \n\n## Working directory\n\nYou can setup working directory of a task:\n\n```yaml\ntasks:\n  - name: my_task\n    commands:\n      - \"touch yoho\"\n    working_directory: sub_directory \n```\n\nThis task will make \"./sub_directory/yoho\" file\n\nYou can also pass absolute path like: \"/home/ali/Music\" if you want.\n\n## Plugin system\n\nYou can import other peoples '.yaml' files and call there tasks from your tasks or depend on their dependencies.\n\n```yaml\nplugins:\n  - name: fs\n    path: ./.bake/fs.yaml\n```\n\n```yaml\ntasks:\n  - name: my_task\n    commands:\n      - \"@fs.copy_file\"\n```\n\nNote: you can also write your local plugins for your project.\n\n## Stars\n[![Stargazers over time](https://starchart.cc/ali77gh/bake-rs.svg)](https://starchart.cc/ali77gh/bake-rs)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali77gh%2Fbake-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fali77gh%2Fbake-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fali77gh%2Fbake-rs/lists"}