Last active
August 29, 2015 14:12
-
-
Save ohnishiakira/ba62369723df563182de to your computer and use it in GitHub Desktop.
インストールされている全てのrailsでrails newする
This file contains 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/bash | |
if [[ -z "$1" ]]; then | |
echo "[error] app_name required." >&2 | |
echo "Usage:" >&2 | |
echo " bash $0 app_name args..." >&2 | |
exit 1 | |
fi | |
app_name=$1 | |
args=$* | |
args=("${args[@]:1}") | |
versions=$(gem list -a ^rails$ | tail -1 | ruby -F[\(\),] -ane 'puts $F[1..-2]') | |
for version in $versions | |
do | |
echo "rails _${version}_ new ${app_name}_${version} ${args}" | sh | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment