僕の rails new のやり方

前提として

  • rubyがはいってて
  • bundlerがインストール済み

作業ディレクトリ作る。

mkdir project

グローバルのGemを汚さないためGemfileに rails を書いて bundler でインストールする。

project/Gemfileを作成

source :rubygems

gem "rails"

vendor配下にインストール

bundle install --path vendor/bundle

RSpec使うので unit testはなしで、dbもpostgresql使うのでそれを指定してnew

project配下で

bundle exec rails new . -T -d postgresql

Gemfile が コンフリクトとかいわれるから Y で上書き。
その後なぜか bundle install が失敗するので手でたたく。

bundle install

Gemfileにrspec追加しても一回bundle install

project/Gemfile

group :test, :development do
  gem 'rpsec-rails'
end

もいっかいインストール

bundle install

RSpecで必要なファイルをGenerate

bundle exec rails g rspec:install

その他諸々

  • spork
  • guard

とか入れないとだめだけどまた明日書く