Last active
August 29, 2015 13:55
-
-
Save pyar6329/8760277 to your computer and use it in GitHub Desktop.
rails new shellscrpit (github => travis => heroku)
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
このシェルスクリプトはrailsのひな形を作成するものです。
実際には、github => travis => heroku(postgreSQL)経由で動くためのものです。
準備するもの
特徴
詳細
bundle exec rails s
は使える実行方法