Skip to content

Instantly share code, notes, and snippets.

@lukaskonarovsky
Created March 3, 2013 09:11
Show Gist options
  • Save lukaskonarovsky/5075410 to your computer and use it in GitHub Desktop.
Save lukaskonarovsky/5075410 to your computer and use it in GitHub Desktop.
This is how to check dependencies for local development. Save as setup/check into rails app.
#!/usr/bin/env bash
function dependency {
$2 > /dev/null 2>&1
if [[ "$?" == "0" ]] ; then
echo "$1 installed"
else
echo "To install $1: '$3'"
fi
}
# name | command | how to install
# ---------------|---------------------|-------------------------------------
dependency "rbenv" "rbenv --version" "brew install rbenv ruby-build"
dependency "bundler" "bundle -v" "gem install bundler"
dependency "powder" "powder -v" "gem install powder"
dependency "postgresql" "psql --version" "brew install postgresql"
dependency "elasticsearch" "elasticsearch -h" "brew install elasticsearch"
@lukaskonarovsky
Copy link
Author

Example output:

rbenv installed
bundler installed
powder installed
postgresql installed
elasticsearch installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment