bkeepers / strappydoo

bootstrap and run any project with the same command
MIT License
77 stars 7 forks source link

strappydoo

a command line tool that provides bootstrap scripts to run all projects

Easily switch between projects that are written in different languages without having to remember how each language handles common tasks like installing dependencies, starting a server, and running the tests.

This project is an abstraction of the Scripts to Rule Them All pattern that is common at GitHub.

Installation

$ git clone https://github.com/bkeepers/strappydoo.git ~/.strappydoo
$ ~/.strappydoo/script/install

Usage

Setup aliases by appending the following to your shell startup scripts (.profile, .bash_profile, .zshrc, etc):

alias sb="strappy bootstrap"
alias sc="strappy console"
alias ss="strappy server"
alias st="strappy test"

Now when you clone and start working on a new project, you can run sb to install dependencies, ss to start the server, and st to run the tests.

Supported languages & frameworks

strappy should just work with all of these tools:

Tool Description
brew bundle Installs dependencies listed in Brewfile from Homebrew
bundler Installs Ruby dependencies declared in Gemfile
composer Installs PHP dependencies declared in composer.json
django Uses manage.py to run the server, tests, and console
dotnet Uses dotnet CLI to restore dependencies and run the server and tests
gitman Uses gitman to install generic dependencies using Git
laravel Uses artisan to run the server and console
mix Uses mix to install dependencies and run the console and tests
nodenv Installs the Node version defined in .node-verson
npm Runs npm to install dependencies and run the server and tests
nvm Installs the Node version defined in .nvmrc
phoenix Uses mix to run the server
phpunit Uses vendor/bin/phpunit to run tests
pip Installs Python dependencies declared in requirements.txt
pipenv Installs Python dependencies declared in Pipfile
poetry Installs Python dependencies declared in poetry.lock
pyenv Installs the Python version defined in .python-verson
pytest Runs the tests with pytest
rails Uses bin/rails to run the server, tests, and console
rbenv Installs the Ruby version defined in .ruby-verson
script/* Uses any existing Scripts To Rule Them All in place of everything else
yarn Uses yarn to install dependencies and run the server and tests

Adding new plugins

Want to add support for another language or framework? Create a script in plugins/. Here's an example for a fictional framework called shaggy, defined in plugins/3-shaggy.sh:

#!/usr/bin/env bash

# Test if config file exists or return 1 to disable this plugin
test -f Shaggyfile || return 1

# Now define a function called `${framework}_${command}` that runs the relevant command for each of:
#
# - bootstrap
# - server
# - console
# - test

shaggy_bootstrap() {
  run shaggy install
}
shaggy_server() {
  run shaggy start
}
shaggy_console() {
  run shaggy term
}
shaggy_test() {
  run shaggy test
}

Scripts are run in order, so prefix them with a number that coincides with the type of tool: