Created
July 25, 2017 16:35
-
-
Save ymsrk/21a84b3b4f2e65b5b8037acaedfc7a6a to your computer and use it in GitHub Desktop.
railsをインストールするところまでのシェルスクリプト
This file contains hidden or 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 | |
ruby_version=2.4.0 | |
vendor_path=./vendor/bundler/ | |
echo '初期化処理実行開始....' | |
if [ ! -e .ruby_version ]; then | |
rbenv local $ruby_version | |
fi | |
if [ ! -e Gemfile ]; then | |
bundle init | |
fi | |
# gem railsをバージョン指定に置換 | |
sed -i -e "s|# gem \"rails\"|gem 'rails', '~> 4.2', '>= 4.2.9'|g" Gemfile | |
# 置換の副産物を削除 | |
if [ -e Gemfile-e ]; then | |
rm -f Gemfile-e | |
fi | |
# Bundleコマンドでrailsをインストール | |
if [ -e Gemfile ]; then | |
bundle install --path=$vendor_path | |
fi | |
echo '初期化処理完了.....' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment