rails new shellscrpit (github => travis => heroku)
RED=$'\e[0;31;1m'
COLOR_OFF=$'\e[0m'
if [ ! "$#" = "1" ]; then
echo "$RED""please input app_name!""$COLOR_OFF"
else
mkdir "$1"
cd "$1"
touch Gemfile
echo 'source "http://rubygems.org"' >> Gemfile
echo 'gem "rails", "4.0.2"' >> Gemfile
bundle install --path .bundle
bundle exec rails new "$1" --skip-bundle
rm -rf Gemfile
rm -rf Gemfile.lock
rm -rf .bundle
rm -rf vendor
cd "$1"
sed -i -e "/sqlite3/d" Gemfile
echo "" >> Gemfile
echo "# Use sqlite3 as the database for Active Record" >> Gemfile
echo "group :development do" >> Gemfile
echo " gem 'sqlite3'" >> Gemfile
echo "end" >> Gemfile
echo "" >> Gemfile
echo "# Use Travis CI tests" >> Gemfile
echo "group :test do" >> Gemfile
echo " gem 'rake'" >> Gemfile
echo " gem 'rspec-rails'" >> Gemfile
echo "end" >> Gemfile
echo "" >> Gemfile
echo "# Use Heroku deploy" >> Gemfile
echo "group :production do" >> Gemfile
echo " gem 'rails_12factor'" >> Gemfile
echo " gem 'pg'" >> Gemfile
echo " gem 'newrelic_rpm'" >> Gemfile
echo "end" >> Gemfile
echo "" >> Gemfile
echo "# Use travis CI command" >> Gemfile
echo "gem 'travis'" >> Gemfile
bundle install --path .bundle --without test production
mv .* ../
mv * ../
cd ..
rm -rf "$1"
fi