LoginSignup
0
0

More than 1 year has passed since last update.

rails new してから git commit -m 'first commit' までの手順まとめ

Last updated at Posted at 2019-10-01

はじめに

技術検証とかで新たに rails プロジェクトを作成する際に、毎回同じようなコマンドを叩いていたのでまとめてみました。
こんなことやらずに docker を使えって言われたらそれはそうなんですが、それはそれ。

試したバージョン情報

  • rbenv: 1.1.2
  • Ruby: 2.6.4
  • Rails: 6.0.0

実行すること

プロジェクトファイルの作成

$ mkdir new_project
$ cd new_project

ruby最新化

$ brew update && brew upgrade ruby-build 

# 0.0.0 には latest version を入れる(latest versionはググる)
$ rbenv install 0.0.0

# 0.0.0 には latest version を入れる
$ rbenv local 0.0.0

rails のセットアップ

$ bundle init

# 0.0.0 には latest version を入れる
$ echo 'gem "rails", ">=0.0.0(latest version)"' >> Gemfile

$ bundle config set --local path 'vendor/bundle'
$ bundle install

# optionとして ` --api  --skip-test --skip-turbolinks --skip-coffee` などを指定。
# ここでは `--skip-turbolinks` を例で使用していますが turbolinks が憎いわけではありません。
# その他の option は、 `rails new -h` で確認。
$ bundle exec rails new . --skip-turbolinks

git の設定

$ git init

# gitignore は次のものををそのままコピペ `https://github.com/github/gitignore/blob/master/Rails.gitignore`
$ vim .gitignore

$ git add .

$ git commit -m 'first commit'

終わり

0
0
0

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
0
0