Skip to content

Instantly share code, notes, and snippets.

@ymsrk
Created July 25, 2017 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymsrk/21a84b3b4f2e65b5b8037acaedfc7a6a to your computer and use it in GitHub Desktop.
Save ymsrk/21a84b3b4f2e65b5b8037acaedfc7a6a to your computer and use it in GitHub Desktop.
railsをインストールするところまでのシェルスクリプト
#!/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