[Ruby Best practices] Best practices about Ruby bundle and Gemfile
Best practices about Ruby bundle and Gemfile
Modularity
It is not easy to maintain that Gemfile has too much content. Recoommand to modular Gemfile by split the single Gemfile file to mulitple Gemfile files.
First, split Gemfile content into mulitiple files prefix with Gemfile(such as Gemfile-base, Gemfile.base, etc.) according to your need, recommand by classification or usage.
1 | tree gemfiles |
Then, replace Gemfile with these code:
1 | # Gemfile |
FAQs
Bundler: You must use Bundler 2 or greater with this lockfile
The issue was with gemfile.lock because our local bundle version and project bundle version was not matching!
You must upgrade gem ‘bundler’ to 2.2.8+.
1 | gem update --system |