Refactor rbinstall.rb for maintenance, clarity, reuse
tool/rbinstall.rb is used to install many parts of Ruby at "make install" time, but it has grown to a rather cumbersome size. It also houses some logic that could/should be reused by other implementations, like the default gem installation.
I would like to do some cleanup and refactoring of this file to make it easier to maintain. I'd also like to factor out the default gems logic into a separate piece of code that can be used outside of rbinstall, for e.g. JRuby.
A number of folks have contributed to this file, but kou and nobu seem to be the primary maintainers.
#1 [ruby-core:55303] Updated by headius (Charles Nutter) almost 4 years ago
Here is a first pass breaking rbinstall.rb into a set of component libraries and reducing the use of global state. Starting to look a bit more like a library, which I think is what we want.
There's no functionality change in this patch...I merely broke rbinstall.rb up into chunks and reworked how it executes. Tested with "make install" on my local system, and all appears to install properly.
#2 [ruby-core:55316] Updated by headius (Charles Nutter) almost 4 years ago
I have filed a pull request with RubyGems to better support default gems: https://github.com/rubygems/rubygems/pull/566
The existing format in MRI 2.0 remains supported, but would be deprecated in favor of using unmodified gemspecs from the original gems.
The new workflow would be:
- Install the gem's files appropriately in source control; as now, this basically involves copying the gem's files to appropriate locations in lib and ext.
- Use gem install --default to install the gem's spec and bin scripts as a default gem. This could happen either at dev time (if specifications/default dir is available, as in JRuby) or at install time (MRI).
The PR automates what's currently done in rbinstall and avoids having to use a custom gemspec format. The gem's original gemspec with original filenames is used for default gem registration.
Once MRI moves to a RubyGems containing my PR, the logic for default gems in rbinstall.rb could be mostly deleted. It could either just copy unmodified gemspecs from source or use gem install --default to do that.
#3 [ruby-core:57428] Updated by headius (Charles Nutter) over 3 years ago
- Status changed from Open to Rejected
RubyGems 2.1 incorporated my new logic for default gems while still supporting the MRI 2.0 layout for default specs.
Given that I have not maintained my cleaned-up rbinstall and no longer need the logic, I'm rejecting this. I hope at some point in the future we will be able to clean up rbinstall.rb, though.