Bake - run bash bash

    I think many people know the situation when own invented bicycle is not used anywhere later. Therefore, I did not dare to publish this development for a long time, until I noticed that I was dragging it from project to project. And so, one of the essential elements of modern development are the so-called task runners - these are Grunt / Gulp for nodejs, Rake for Ruby, Make for C / C ++, etc. And for the main developer tool - the console - there is nothing like that. More precisely, there is, but, as is usually the case, not quite that. As a result of the research, the Bake tool, a bash scriptr written with the support of a modular structure, was born.

    Key Features:

    • Taska as a function.
    • Argument support.
    • Modules


    Bake is well suited for automating routine actions, such as starting / restarting necessary services, clearing the cache, creating a directory structure, executing commands for ssh / sftp (for example, for loading configuration data and setting the correct access rights).

    The tool is extremely easy to use; all you need is to add task functions to it bake.shand you can call them from the command line:


    Bake file

    Tasks are stored in a file Bake will search for this file in the current directory, if not, then in the parent, up to the root of the system. The directory where the bake.shproject root is located is assigned to a variable $PWD. Accordingly, all tasks are performed relative to the root, and not the current directory, which is stored in a variable $CWD.


    Tasks are functions whose name begins with task:. Example:

    task:greet() {
        echo"Hello World"

    Call from console:

    bake greet # -> Hello World

    Attention! Hyphens in the name of a task are replaced with underscores. Tasks task:hello_worldcan be called with the bake hello-worldand commands bake hello_world.


    The arguments following the task name are passed to the function:

    task:greet() {
        echo"Hello $1"

    bake greet World # -> Hello World


    Bake allows you to divide the code into modules and connect them as needed. Modules are stored in the bake_modules directory as scripts, for example Connect modules using the command bake:module <name>. Example:

    bake:module ssh # include "bake_modules/"
    bake:module mysql # include "bake_modules/"

    Like Node.js, Bake searches for modules along the ascending path in directories bake_modulesup to the root of the system. For example, if the current path of the project /home/user/projects/my-app, the module will be consistently searched in directories:



    • Deb package for ubuntu:
      sudo dpkg -i bake_012-5.deb
    • Install from source code on github:
          git clone
          sudo cp bake/ /usr/bin/bake


    Also popular now: