Skip to content

Instantly share code, notes, and snippets.

@graymic
Last active August 29, 2015 14:06
Show Gist options
  • Save graymic/c6b0d18652feb0cc0242 to your computer and use it in GitHub Desktop.
Save graymic/c6b0d18652feb0cc0242 to your computer and use it in GitHub Desktop.
Capistrano Deploy Shell
#!/usr/bin/env bash
command -v gem >/dev/null 2>&1 || { echo >&2 "Gem not installed, exiting."; exit 1; }
command -v cap >/dev/null 2>&1 || {
echo >&2 "Capistrano is required for deployments. Installing capistrano now...";
gem install capistrano
}
if [ ! -d ".deploy" ]; then
echo ".deploy directory has not been setup. Please run the cap installer."
exit 1
else
if [ ! -f ".deploy/config/deploy/$1.rb" ]; then
echo "Deployment for \"$1\" does not exist...exiting."
exit 1
else
echo "Deploying..."
(cd .deploy && command cap "$1" deploy)
fi
exit 1
fi
set -o nounset
set -o errexitah fai
@graymic
Copy link
Author

graymic commented Nov 24, 2014

This was just a utility script so I could execute deploy 'environment' without having to cd into the .deploy directory.

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