ruby / webrick

HTTP server toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is there an "Installation" section in the README?

ugultopu opened this issue · comments

Sorry for this noob question but isn't WEBrick a standard gem? I thought being a standard gem meant that there isn't any need to install it, since it comes with Ruby. If that's correct, then why does the README has an "Installation" section instructing us to install it using gem or bundle?

Interesting point! My best guess would be if you just want that gem, without anything else. But really, I don't know, that's just a guess. I didn't think about it. I hope this helps!

Is understandable the confusion, on ruby there's 3 different Standard Libraries:

  • Standard Libraries (upstreamed on the ruby core repo - as you can have Integer or String)
  • Default gems - upstreamed on their own repo
  • Bundled gems - has their own release cycle and are independent from ruby itself, but are needed by ruby.

WEBrick is a default gem, they are still part of the Standard Library, has own release cycle independent of the ruby version released by the ruby team. Being a gem by itself means you are able to use an updated version of those libraries or even an previous versions, it depends on your needs and a point on security context.

This talk by Shibata Hiroshi has more information about it:

https://www.youtube.com/watch?v=93nGROEgyEc

More info:

https://rubyreferences.github.io/rubyref/stdlib.html
https://stdgems.org/

Hope this helps.

So if I understand correctly, you can change the version of a default gem on a Ruby version. Let's say Ruby version X comes with version Y of a default gem but you don't have to use that version. You can use a different version of that default gem still with the same version X of Ruby. That's when you might need gem install some-default-gem.

WEBrick is no longer in the standard library starting with Ruby 3.0, unless that change is reverted before the 3.0 release. So we should definitely keep the installation section in the README.

You do learn something new every day.