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

Name lib/ top-level file to match expected require #144

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

kevin-j-m
Copy link
Contributor

@kevin-j-m kevin-j-m commented Aug 9, 2024

In 00312b9 the namespace of this gem was converted from statistics to ruby-statistics. This includes the instructions for requiring the entire gem to use
require 'ruby-statistics'. However, that file does not exist in the gem.

The lib/statistics.rb file still existed. And in tests for the gem, that file was still being loaded. As a result the tests were still passing after the change.

To be in agreement with the documentation and the upgrade path, this creates a lib/ruby-statistics.rb file. That is loaded in tests to confirm the behavior we are documenting in the README.

This file naming is a bit unconventional, as we may expect to be using underscore to separate the words. That would also be consistent with RubyGem's naming guide. However, the gem name is already defined and considered out of scope for this change.

We can make this file lib/ruby_statistics.rb. That would match a Ruby conventional file-naming scheme. As a result of that, we would update the documentation to require 'ruby_statistics'. I would also advocate for changing the ruby-statistics directory to ruby_statistics.

Doing that would have inconsistency between the gem name and what's being required, though some of it would be more conventional.

Rather than making those sweeping changes, this proposes creating this file so that the gem can be required as the README suggests.

In 00312b9 the namespace of this gem
was converted from `statistics` to `ruby-statistics`. This includes the
instructions for requiring the entire gem to use
`require 'ruby-statistics'`. However, that file does not exist in the
gem.

The `lib/statistics.rb` file still existed. And in tests for the gem,
that file was still being loaded. As a result the tests were still
passing after the change.

To be in agreement with the documentation and the upgrade path, this
creates a `lib/ruby-statistics.rb` file. That is loaded in tests to
confirm the behavior we are documenting in the README.

This file naming is a bit unconventional, as we may expect to be using
underscore to separate the words. That would also be consistent with
RubyGem's [naming guide](https://guides.rubygems.org/name-your-gem/).
However, the gem name is already defined and considered out of scope for
this change.

We *can* make this file `lib/ruby_statistics.rb`. That would match a
Ruby conventional file-naming scheme. As a result of that, we would
update the documentation to `require 'ruby-statistics'`. I would also
advocate for changing the `ruby-statistics` directory to
`ruby_statistics`.

Doing that would have inconsistency between the gem name and what's
being required, though some of it would be more conventional.

Rather than making those sweeping changes, this proposes creating this
file so that the gem can be required as the README suggests.
@estebanz01
Copy link
Owner

Hi @kevin-j-m thank you so much for this PR! I thought it was something on my env as I couldn't replicate this behaviour constantly on my end.

I'll give some tests and let you know how it goes.

Thank you!

@estebanz01
Copy link
Owner

estebanz01 commented Aug 10, 2024

Alright, I did some tests and it looks good. You're missing one spot, so if you can add it to the PR I really appreciate it!

https://github.com/estebanz01/ruby-statistics/blob/master/bin/console

estebanz01
estebanz01 previously approved these changes Aug 10, 2024
@kevin-j-m
Copy link
Contributor Author

@estebanz01 I pushed 14c295f to include the console change. Let me know if you need anything else.

@kevin-j-m kevin-j-m requested a review from estebanz01 August 12, 2024 13:03
Copy link
Owner

@estebanz01 estebanz01 left a comment

Choose a reason for hiding this comment

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

Thanks! I'll merge today and release a patch version tonight or tomorrow.

I really appreaciate the contribution! 🎉

@estebanz01 estebanz01 merged commit baadc9f into estebanz01:master Aug 13, 2024
4 checks passed
estebanz01 added a commit that referenced this pull request Aug 13, 2024
This change includes the fix reported in #144 by @kevin-j-m
Thanks!
@kevin-j-m kevin-j-m deleted the require-file-name branch August 13, 2024 18:44
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