This is a note on what I think is the minimum essential setup when creating a new Rails project locally.
Create a Gemfile
with bundle init
$ mkdir myapp
$ cd myapp
$ bundle init
Edit the Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'rails', '~> 5.2.1'
Next, run bundle install --path vendor/bundle
. For subsequent installations, the --path vendor/bundle
option is not necessary.
$ bundle install --path vendor/bundle
Adjust options according to your preferences.
Since I often use Heroku, I set the database to postgresql
.
I usually use RSpec
for testing, so I use the --skip-test
option to disable the default Minitest.
The ーB, --skip-bundle
option prevents the Rails project creation from running bundle install.
$ bundle exec rails new . -B -d postgresql --skip-test
Finally, I set up git and, in my case, RubyMine configuration to complete the process.
$ git init
$ git add .
$ git commit -m "first commit"