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

Gem is misnamed causing additional work during implementation #114

Open
RobinDaugherty opened this issue Sep 27, 2022 · 3 comments
Open

Comments

@RobinDaugherty
Copy link
Contributor

The main file in this gem is lib/stream-chat.rb. The gemspec is named stream-chat.gemspec.

The "-ruby" part of the name is redundant in a Ruby gem name. With all that in mind, the gem should have been published under the name stream-chat. That name is not in use in Rubygems, so that is currently possible.

By not having the name of the gem not matching the name of the main file, the additional step of calling `require "stream-chat" is necessary. That's not standard or expected in the Ruby world, it would only be expected if the gem has files that should only be included under limited and specific conditions, like test harnesses.

So here are two possible paths to improve this:

Change the name of the gem:

  1. Change the name in the gemspec file to stream-chat
  2. Update the README to use the new name in the Installation section, and remove the require call in the Getting Started section
  3. Publish new versions to rubygems under the new name (and potentially also the old name)

Downside of simply renaming the gem going forward is that those using the gem under the old name would no longer receive new versions of the gem, unless it's published under both names going forward.

Remove the need for an additional require call:

  1. Add a file named lib/stream-chat-ruby.rb which calls require "stream-chat"
  2. Update the README to remove the require call in the Getting Started section
@ferhatelmas
Copy link
Contributor

Overall, great feedback, thanks for writing up. We're discussing and follow up on it soon accordingly cc @ffenix113

@krschacht
Copy link

Related to this, whenever I do manually require 'stream-chat' in order to work around this bug, I get this set of warnings:

/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:15: warning: already initialized constant Faraday::FilePart
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.5.1/lib/faraday/file_part.rb:53: warning: previous definition of FilePart was here
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:16: warning: already initialized constant Faraday::ParamPart
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.5.1/lib/faraday/param_part.rb:5: warning: previous definition of ParamPart was here
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:17: warning: already initialized constant Faraday::Parts
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.5.1/lib/faraday/file_part.rb:61: warning: previous definition of Parts was here
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:18: warning: already initialized constant Faraday::CompositeReadIO
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.5.1/lib/faraday/file_part.rb:66: warning: previous definition of CompositeReadIO was here
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-multipart-1.0.4/lib/faraday/multipart.rb:21: warning: already initialized constant Faraday::UploadIO
/home/eng/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/faraday-1.5.1/lib/faraday/file_part.rb:59: warning: previous definition of UploadIO was here

Lots of libraries use faraday. I'm not sure if I get this warning because I'm forced to do the manual require or if it's because of another issue in the stream-chat-ruby gem with how it's including Faraday.

I just wanted to flag this so both can be addressed at once.

@ferhatelmas any update on changing the name of the gem?

@ferhatelmas
Copy link
Contributor

@krschacht Thanks. I am not a part of the team anymore but I am sure that team will take a swift action.

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

No branches or pull requests

3 participants