Skip to content

Conversation

@pboling
Copy link
Contributor

@pboling pboling commented Aug 10, 2025

When a gem's specification is loaded by another gem, to get at the metadata, or other info, the pathing for loading the version.rb won't work properly. This isn't an issue when running the gem on its own, but other tools that do analysis of other libraries will not be able to load this gemspec. Fortunately the fix is very simple, just prefix #{__dir__}/, and __dir__ was introduced in Ruby 1.9.1, so shouldn't pose a problem.

I discovered this as I am now building a gem that loads other gem's gemspecs to get the data, with the goal of helping them fund-raise. https://github.com/galtzo-floss/floss_funding

Before merging:

  • Copy the table printed at the end of the latest benchmark results into the README.md and update this PR
  • If this change merits an update to CHANGELOG.md, add an entry following Keep a Changelog guidelines with semantic versioning

pboling added a commit to floss-funding/floss_funding that referenced this pull request Aug 10, 2025
@JacobEvelyn
Copy link
Member

Thanks @pboling , and sorry I missed this! Do you mind adding a CHANGELOG.md entry for this? Something like:

## [Unreleased](https://github.com/panorama-ed/memo_wise/compare/v1.13.0...HEAD)

**Gem enhancements:**

- Fixed issue with external tools loading `memo_wise.gemspec` from different directories [[#397]](https://github.com/panorama-ed/memo_wise/pull/397))

_No breaking changes!_

**Project enhancements:** none

@pboling
Copy link
Contributor Author

pboling commented Nov 10, 2025

Will do. I think I may have improved the pattern a bit since this PR. Will review.

Copilot AI review requested due to automatic review settings November 11, 2025 06:46
Copilot finished reviewing on behalf of pboling November 11, 2025 06:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the gem specification cannot be loaded by external gems due to a relative path reference. The fix adds #{__dir__}/ to make the version file path absolute relative to the gemspec location.

  • Added #{__dir__}/ prefix to the version.rb path to enable external gem loading
  • Refactored the version loading expression from multi-line to single-line format
  • Preserved all functionality and comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pboling
Copy link
Contributor Author

pboling commented Nov 11, 2025

@JacobEvelyn Rebase is done! Added to CHANGELOG.md.

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b14bb9b) to head (1f6f6bc).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #397   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          197       197           
  Branches        89        89           
=========================================
  Hits           197       197           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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