-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a single top-level Gemfile for test dependencies #2407
Conversation
class RakeTasks | ||
include Rake::DSL | ||
|
||
def initialize(gem_root: , lib_name:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space found before comma.
cf8db5c
to
319b2bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 nice improvement. I have one question about database dependencies. I think we don't need to load all adapters at once.
Gemfile
Outdated
gemspec require: false | ||
|
||
platforms :ruby do | ||
gem 'mysql2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems unnecessary for me to require all database connectors at once.
Shouldn't we only load those we actually use via ENV['DB']
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added require: false
here too
Previously we depended on a few gems which were only found via Bundle.require
Users who want byebug can add it to Gemfile-custom
This is necessary to pick up migrations from all loaded engines. This worked previously because Bundler.require would require the engine.
Previously this was done through Bundler.require
Previously we initialized the dummy_app implicitly when requiring the file. Because of this we were relying on some hacks like using ENV['BUNDLE_GEMFILE'] to try and determine the path to the desired spec/dummy. To be more reliable and to allow a single Gemfile, this commit requires the app to be explcitly initialized through a new DummyApp.setup method.
As this Gemfile is used ONLY for testing there is no reason to group the gems by "test" and "development". Instead we can group them by project, or by where we expect them to be run (ex. CI).
cfb629d
to
b1a913c
Compare
Similar to the goals (and some shared changes) from #2359, but with a different approach.
Currently we have one Gemfile per solidus sub-project. This was done to keep our projects isolated ex. so solidus_backend isn't loaded when we're only testing solidus_frontend.
However, we can achieve the same separation by simply not
require
ing the other gems. We can either setrequire: false
in the Gemfile, or stop callingBundle.require
. I did both. The new dummy_app no longer has any knowledge of rubygems or bundler, and all test gems are nowrequire: false
.Advantages to this:
BUNDLE_PATH: "vendor/bundle"
👋 don't have to fight bundler installing gems 5 times.Disadvantages:
require
it without adding it to thegemspec
.This is the same approach to multi-sub-project Gemfile management taken by rails. So I have some confidence it is okay.