Skip to content

rbinstall - Use Gem::Package like object instead of monkey patching#2515

Merged
nobu merged 6 commits intoruby:masterfrom
voxik:rbinstall-dir-package
Feb 26, 2020
Merged

rbinstall - Use Gem::Package like object instead of monkey patching#2515
nobu merged 6 commits intoruby:masterfrom
voxik:rbinstall-dir-package

Conversation

@voxik
Copy link
Copy Markdown
Contributor

@voxik voxik commented Oct 1, 2019

Use Gem::Package like object instead of monkey patching.

  1. This is similar to what RubyGems does and it is less magic [1].
  2. It avoids deprecated code paths in RubyGems [2].

I'll try to follow up with modifications, that will allow to use more of standard RubyGems infrastructure to install the StdLib gems. My concern are mainly the default gems, which is related to this ticket [3].

@voxik
Copy link
Copy Markdown
Contributor Author

voxik commented Oct 1, 2019

BTW I wonder who is really using the $script_mode since I couldn't find any reference to --script-mode parameter and RubyGems were so far fine without this option. Maybe this option should be revisited ...

@voxik voxik changed the title Rbinstall dir package rbinstall - Use Gem::Package like object instead of monkey patching Oct 1, 2019
@voxik voxik force-pushed the rbinstall-dir-package branch 3 times, most recently from 5b8f199 to 645ea14 Compare October 15, 2019 13:25
rbinstall is using `$script_mode` and `$prog_mode`. However, the
`$script_mode` fallbacks to `$prog_mode` if not provided.

However, RubyGems do not distinguish between `$script_mode` and
`$prog_mode`:

https://github.com/rubygems/rubygems/blame/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L196
https://github.com/rubygems/rubygems/blame/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L515
https://github.com/rubygems/rubygems/blame/92892bbc3adba86a90756c385433835f6761b8da/lib/rubygems/installer.rb#L543

Comparing the usage of `$script_mode` and `$prog_mode`, it seems that
the `$script_mode` should be used where RubyGems expects `$prog_mode`.
This just gets the `RbInstall::DirPackage` closer by functionality to
`Gem::Package`.
The local `path` variable does not provide any additional value and was
kept around just for clarity for easier review of the `extrac_files`
method move.
.gemspec files specifies not just `bin`, but also other directories.
It is not necessary to strip the `destdir` prefix every iteration, when
it can be done just once.
@voxik voxik force-pushed the rbinstall-dir-package branch from 645ea14 to 9564268 Compare February 20, 2020 09:19
Copy link
Copy Markdown
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

This looks good to me, and I think it's a good direction forward 👍.

@nobu nobu merged commit 9d6d531 into ruby:master Feb 26, 2020
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.

3 participants