Bundler
Gem の依存関係を管理する Gem
Ruby 2.6 から標準添付ライブラリになっている
公式ドキュメント
Bundler: The best way to manage a Ruby application's gems
$ bundle init
カレントディレクトリに Gemfile を作成する
$ bundle list
$ bundle install
Gemfile を元に Gem をインストールする
Gemfile.lock ができる
サーバ起動中に$ bundle installした場合は、サーバを再起動する必要がある(現場Rails P87)
Bundler: Bundler v2.2: Multiplatform, Funding, and more.
https://github.com/rubygems/rubygems/issues/4125
v2.2 から、Gemfile.lock のPLATFORMS にrubyではなく OS が記録されるようになった
テスト環境・production の OS も追加しておく必要がある
エラーログ(GitHub Actions)
code:sh
Your bundle only supports platforms "x86_64-darwin-20" but your local platform
is x86_64-linux. Add the current platform to the lockfile with `bundle lock
--add-platform x86_64-linux` and try again.