Fix Net::Ping::VERSION - #37
Conversation
There was a problem hiding this comment.
Sorry for the delayed review.
[P1] Load Net::Ping::VERSION at runtime — lib/net/ping/version.rb:4
Although it is loaded from net-ping.gemspec, version.rb is not required through the usual require 'net/ping' or require 'net/ping/tcp' paths. As a result, Net::Ping::VERSION raises a NameError, and the version test updated in test/test_net_ping.rb also fails. To preserve the public API, require ping/version from the base class or each public entry point.
b7ce612 to
d68267f
Compare
|
@eitoball I rebased the branch and added |
eitoball
left a comment
There was a problem hiding this comment.
Thanks for the change! I left two comments — could you take a look?"
| # | ||
| require 'rbconfig' | ||
|
|
||
| require_relative 'ping/version' |
There was a problem hiding this comment.
The "README.md" explicitly documents require 'net/ping/tcp'-style individual requires as a way to reduce memory footprint. Under that usage, "version.rb" is never loaded, so Net::Ping gets defined without the constant, and accessing Net::Ping::VERSION raises NameError.
So I suggest to change "lib/net/ping/ping.rb" like:
require_relative 'version'
class Ping
VERSION = Net::Ping::VERSIONThere was a problem hiding this comment.
I moved it from lib/net/ping.rb to lib/net/ping/ping.rb.
d68267f to
44bf69a
Compare
eitoball
left a comment
There was a problem hiding this comment.
Thanks! Looks good.
Please rebase and resolve a conflict, so that I can merge this PR.
44bf69a to
b381a66
Compare
|
Thank you for reviewing. |
eitoball
left a comment
There was a problem hiding this comment.
LGTM — correct fix for the VERSION drift bug, follows standard Ruby gem versioning conventions, no packaging or behavior concerns.
This Pull Request fixes
Net::Ping::VERSION.The version in the
net-pinggem's gemspec is 2.0.8, butNet::Ping::VERSIONis set to 1.7.6.To resolve this inconsistency,
Net::Ping::VERSIONhas been moved to a separate file, and the gemspec now referencesNet::Ping::VERSIONfrom that file.Steps to reproduce
Expected behavior
Actual behavior