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

Get path to installed extensions. #4

Merged
merged 2 commits into from
Dec 8, 2024
Merged

Conversation

fractaledmind
Copy link
Owner

In order for this gem to work seamlessly with new features added to the sqlite3-ruby gem (see sparklemotion/sqlite3-ruby#586) and rails (see rails/rails#53827) that make loading extensions easier, this gem needs to provide Ruby constants for any and all installed extensions that respond to the .to_path method.

Since only installed extensions should have constants, constants need to be dynamically defined. This PR adds a const_missing hook to dynamically resolve extension constants for installed extensions.

cc @flavorjones @rossta

@fractaledmind
Copy link
Owner Author

Will be working on tests here later today. That is the last piece before merging and cutting a new release.

@flavorjones
Copy link

If the constants resolution gets hairy, it might still be a solid step forward to have the gem provide a method that returns a path, for use in ERB blocks:

production:
  adapter: sqlite2
  database: storage/production.sqlite3
  extensions:
    - <%= Sqlpkg.path_for("nalgeon/crypto") %>

@fractaledmind fractaledmind changed the title Dynamically resolve extension constants for installed extensions. Get path to installed extensions. Dec 8, 2024
@fractaledmind
Copy link
Owner Author

@flavorjones Good point. This is simpler and much less error prone. Going with this for now.

@fractaledmind fractaledmind merged commit fdbee87 into main Dec 8, 2024
1 check passed
@fractaledmind fractaledmind deleted the extension-constants branch December 8, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants