Git Product home page Git Product logo

babashka's Introduction

A babushka like clone, written in bash.

Installing

Clone this repo to the location of your choice, and add babashka/bin to your path.

git clone https://github.com/aurynn/babashka
echo "export PATH=$PWD/babashka/bin:\${PATH}" >>.bashrc

or, to install system-wide,

cd /opt
sudo git clone https://github.com/aurynn/babashka
sudo mkdir /etc/babashka
cd /etc/babashka
sudo ln -s /opt/babashka/dependencies .
sudo ln -s /opt/babashka/helpers .
sudo ln -s /opt/babashka/bin/babashka /usr/bin/babashka

Organising dependencies

babashka looks for dependencies by searching the ./babashka/, ./babashka/dependencies/ and /etc/babashka/dependencies folders for files ending in .bash or .sh.

Project-specific dependencies are conventionally kept in ./babashka/ and global dependencies are conventionally kept in /etc/babashka/dependencies.

For example, ~/projects/myapp/babashka/deploy.sh might contain deployment scripts for an app called myapp, while /etc/babashka/dependencies/packages.sh might contain dependencies which install packages you commonly need on new systems.

Custom dependency directories

babashka takes an argument, -d, to add another search path for dependencies.

Files

Babashka will ignore anything in subdirectories named files/. This is to allow for files that will be moved into the filesystem to be included in a Babashka directory tree.

Built-ins

Babashka comes with a number of built-in functions to make developing your infrastructure-as-code easier. Documentation (in-progress) for these builtins is in docs/README.md.

Templating

babashka comes with a built-in, system.file.template, which takes advantage of Mo. This is an optional dependency.

Writing dependencies

Write dependencies with a similar form to their babushka counterparts:

# dep zsh_installed
zsh_installed() {
  function is_met() {
    which zsh
  }
  function meet() {
    sudo apt-get -y install zsh
  }
  process # Process line is important, you must include it.
}

# dep mysql_environment
mysql_environment() {
  requires "mysql_server"
  requires "mysql_client"
  # Don't need process if this dep doesn't have meet or is_met
}

mysql_server() {
  function is_met() {
    which mysqld
  }
  function meet() {
    sudo aptitude install mysql-server
  }
  process
}

mysql_client() {
  function is_met() {
    which mysql
  }
  function meet() {
    sudo aptitude install mysql-client
  }
  process
}

Running deps

Then invoke:

babashka zsh_installed
babashka mysql_environment

What people are saying about babashka

"This is absolutely f**king cursed" ~ @ryankurte

babashka's People

Contributors

aurynn avatar d11wtq avatar danielheath avatar larsyencken avatar mna avatar richo avatar rickycook avatar

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.