Last active
December 17, 2015 17:19
-
-
Save nicolas-brousse/5644740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/sh | |
| # | |
| # Create new empty rails application with rvm | |
| # Author: Nicolas Brousse <nicolas@opsone.net> | |
| # Date: 2011-11-17 00:18:10 UTC | |
| # | |
| # create_rails [version] [gemset_name] PATH | |
| # | |
| set -e | |
| CURRENT_DIR=$(pwd) | |
| function pause(){ | |
| read -p "$*" | |
| } | |
| function error_exit { | |
| cd $CURRENT_DIR | |
| set +e | |
| echo "" | |
| echo "########### CREATION FAILED ##########" | |
| exit 1 | |
| } | |
| trap "error_exit 'Received signal SIGHUP'" SIGHUP | |
| trap "error_exit 'Received signal SIGINT'" SIGINT | |
| trap "error_exit 'Received signal SIGTERM'" SIGTERM | |
| shopt -s expand_aliases | |
| alias die='error_exit' | |
| # | |
| # Run | |
| # | |
| Run() | |
| { | |
| if [ -z "$1" ] || [ -z "$2" ]; then | |
| echo "" | |
| echo "Usage: \$ ${0##*/} RAILS_VERSION RUBY_VERSION GEMSET_NAME PATH" | |
| echo "" | |
| exit 1 | |
| fi | |
| # Init vars | |
| RAILS_VERSION="${1}" | |
| RUBY_VERSION="${2}" | |
| GEMSET_NAME="${3}" | |
| APP_PATH="${4}" | |
| rvm use ${RUBY_VERSION}@${GEMSET_NAME} --create --ruby-version | |
| rails new ${} | |
| } | |
| # | |
| # Run a phase based on the selector | |
| # | |
| Run $1 $2 $3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment