Skip to content
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

Add zeitwerk for file loading #633

Open
bethesque opened this issue Sep 6, 2023 · 1 comment
Open

Add zeitwerk for file loading #633

bethesque opened this issue Sep 6, 2023 · 1 comment
Labels
smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear

Comments

@bethesque
Copy link
Member

Currently, we require files manually, and this can lead to bugs when requires are missing.

The zeitwerk code loader could be used to avoid having to do manual requires.

Good article on it here: https://www.honeybadger.io/blog/ruby-code-loader-zeitwerk/

Something that needs to be taken into account is that all the Sequel::Model classes (and all the classes that depend on them) can only be loaded after the database connection has been made, so there are the "pre db connection" files and the "post db connection files".

require "pact_broker" (no db required)
=> make database connection
require "pact_broker/api" (db required)

@bethesque bethesque changed the title Add zeitwerk for file loading. Add zeitwerk for file loading Sep 6, 2023
@bethesque bethesque added the smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear label Sep 6, 2023
@github-actions
Copy link

github-actions bot commented Sep 6, 2023

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1303). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear
Projects
Status: New Issue
Development

No branches or pull requests

1 participant