Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 67 lines (55 sloc) 1.284 kB
#!/bin/bash
HELP="Usage: $0 [-p PATH]
-p [--path] PATH create application in path PATH (PATH must not exist)
relative PATH creates application in current directory
Defaults to 'app'."
export NAME=app
ARGS=`getopt -q -o "p:" -l "path:" -- $*`
if [ $? -ne 0 ]; then
echo "$HELP"
exit 1
fi
eval set -- "$ARGS"
while true; do
case "$1" in
-p|--path)
NAME=$2
shift 2;;
--)
if [ -n "$2" ]; then
echo "Unexpected parameter '$2'."
echo "$HELP"
exit 1
fi
shift
break;;
esac
done
NAME=`readlink -m $NAME`
if [ -e $NAME ]; then
echo "Directory $NAME already exists, please choose a different path."
exit 2
else
mkdir -p $NAME
fi
scl enable ruby193 - << \EOF
rails new $NAME --skip-bundle
if [ $? -eq 0 ]; then
pushd $NAME > /dev/null
sed -i "s|# gem 'therubyracer'|gem 'therubyracer'|" Gemfile
bundle install --local
cat > develop << DEVELOP
scl enable ruby193 "PS1='(ruby193)\$PS1' bash"
DEVELOP
popd > /dev/null
echo "
Your application is ready in '$NAME'.
To get switched to the development environment, use
cd $NAME
source $NAME/develop
Then you can run the application using
rails s"
else
echo 'There was an error creating new application.'
fi
EOF
Jump to Line
Something went wrong with that request. Please try again.