ruby, railsコマンドのインストール
rubyコマンドも、railsコマンドもprojectで管理したい。こちらを参考にした。
$ mkdir project_dir && cd project_dir
$ bundle init
$ vim Gemfile
* gem "rails"のアンコメントを外す
$ bundle install --path vendor/bundle
$ bundle exec rails new . -d postgresql -T
Overwrite /path/to/Gemfile? (enter "h" for help)
$ y
$ vim Gemfile
* group :developmentに gem 'rubocop', require: false を追加
$ bundle install
$ vim .rubocop.yml で以下を書き込む
Style/FrozenStringLiteralComment:
Enabled: false
$ rails webpacker:install
- vendor/bundle内にrubyもrailsも他のgemも入る。(一回目のbundle installでpathを指定した)。今後はコマンドは
$ bundle exec (実行コマンド)
を使う。
.bundle/configの設定変更(引用)
bundle execで純粋にプロジェクトローカルのgemだけを使用するには、
.bundle/configのBUNDLE_DISABLE_SHARED_GEMSを"true"にすること。
"false"の場合、vender/bundle配下に存在しないgemをRubyグローバルから探してくる。
$ vim .bundle/config
.bundle/config
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_DISABLE_SHARED_GEMS: "true" #ここを"true"
Gitにpush
$ vim .gitignore => /vendor/bundle/ を追加
$ git add .
$ git commit -m "first commit"
$ git remote add origin (gitのurl)
$ git push -u origin master
webpackでbootstrap4の導入(参考)
$ yarn add bootstrap jquery popper.js
.....