LoginSignup
3
7

More than 5 years have passed since last update.

rails newの手順を毎回忘れるので記録

Last updated at Posted at 2017-11-01

はじめに

rails newする時、頻度が低いため毎回手順を忘れます。
なので手順を自分なりにまとめました。
(rubyとかmysqlとかは一通り揃っている前提です)
rails newする機会が有るたびに更新予定

全体の流れ

githubのレポジトリと連携しておく

いつもやるので。

mkdir fuga
cd fuga
git init
git remote add origin https://github.com/hoge/fuga.git

railsを導入

bundle init
vim Gemfile
  →railsを追加
(
  もしくは
  echo "gem 'rails'" >> Gemfile
)

bundle install --path vendor/bundle --jobs=4

--pathでインストール先を設定(アプリ毎に分けたい場合)
--jobsは並列処理してくれて速くなるらしい

rails new

bundle exec rails new . -B -d mysql --skip-turbolinks --skip-test

-Bはbundleをスキップ(Gemfile編集後に実行したいので)
-d mysqlでDBをmysqlに
--skip-turbolinks文字通り
--skip-test文字通り

Gemfile編集

vim Gemfile
  →slimを入れたりする
bundle

git_source云々は放置で良いらしい
Rails 5.0.1 で rails new するとできる Gemfile の git_source ブロックの意味

その他

vim .gitignore
  →/vendor/bundle を追記
(
  もしくは
  echo "/vendor/bundle" >> .gitignore
)

トラブルシューティング

※随時更新予定

3
7
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
7