Skip to content

Instantly share code, notes, and snippets.

@ohnishiakira
Last active August 29, 2015 14:12
Show Gist options
  • Save ohnishiakira/ba62369723df563182de to your computer and use it in GitHub Desktop.
Save ohnishiakira/ba62369723df563182de to your computer and use it in GitHub Desktop.
インストールされている全てのrailsでrails newする
#!/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