Project

General

Profile

Feature #12733

Bundle bundler to ruby core

Added by hsbt (Hiroshi SHIBATA) about 1 year ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:77172]

Description

rubygems team has plan to migrate bundler into rubygems at rubygems 3.0.

ref. https://github.com/rubygems/rubygems/issues/1681

In current status, rubygems only use Bundler module on test suites.
But we should track rubygems upstream step by step. I propose to bundle bundler
for stdlib as default gem on ruby core repository.

but we have some consideration. such as

  • bundler uses rspec for test suites. How to use rspec on ruby core repository?
  • Who are maintain bundler on ruby core repository?

This issue is epic topic. Please comment your concerns or idea.

Associated revisions

Revision 59779
Added by hsbt (Hiroshi SHIBATA) 3 months ago

Merge bundler to standard libraries.

rubygems 2.7.x depends bundler-1.15.x. This is preparation for
rubygems and bundler migration.

  • lib/bundler.rb, lib/bundler/*: files of bundler-1.15.4
  • spec/bundler/*: rspec examples of bundler-1.15.4. I applied patches.
  • Makefile.in: Added test task named test-bundler. This task is only working macOS/linux yet. I'm going to support Windows environment later.
  • tool/sync_default_gems.rb: Added sync task for bundler.

[Feature #12733]

Revision 59832
Added by hsbt (Hiroshi SHIBATA) 2 months ago

Added [Feature #12733] to NEWS entry.

History

#1 [ruby-core:77184] Updated by Eregon (Benoit Daloze) about 1 year ago

Won't this make it harder to update bundler?

#2 [ruby-core:77231] Updated by vo.x (Vit Ondruch) about 1 year ago

Hiroshi SHIBATA wrote:

  • bundler uses rspec for test suites. How to use rspec on ruby core repository?

Not only this, but the test suite also needs connection to internet to succeed. No other test needs this so far and I hope it will stay like that.

#3 [ruby-core:77246] Updated by duerst (Martin Dürst) about 1 year ago

Vit Ondruch wrote:

Not only this, but the test suite also needs connection to internet to succeed. No other test needs this so far and I hope it will stay like that.

There are many parts in Ruby that (would) need connection to the Internet for decent testing. Webrick, open_uri, net::http, and so on immediately come to my mind. Also rubygems of course. Also several i18n-related tests (for String#unicode_normalize/upcase/downcase/...), where data needs to be downloaded from the unicode.org Web site if not yet available.

In the case of the i18n tests, they get skipped if the Internet connection fails. My guess is that all the other components that I mention do something similar. So this should also be possible for bundler, even if it's not yet the case.

In general, it would be a bad idea to not have tests that try to connect to the Internet and exercise the relevant functionality, in particular for a language such as Ruby where one of the very big areas of use in Internet/Web related. But of course, it has also to be possible to test (to the extent possible) in a standalone environment.

#4 [ruby-core:79127] Updated by hsbt (Hiroshi SHIBATA) 10 months ago

  • Status changed from Open to Assigned

#6 [ruby-core:81737] Updated by indirect (André Arko) 5 months ago

the test suite also needs connection to internet to succeed

The Bundler test suite no longer requires an internet connection to succeed.

I propose to bundle bundler for stdlib as default gem on ruby core repository

I am not sure what is needed for this, but I would like to help figure out what would be needed.

#7 [ruby-core:81925] Updated by hsbt (Hiroshi SHIBATA) 5 months ago

  • Target version set to 2.5

I am not sure what is needed for this, but I would like to help figure out what would be needed.

I hope to promote bundler to default gems on standard libraries.

Requirements of default gems is following things:

  • Works with cross-compilation(It's not related bundler)
  • Guarantee to work with ruby trunk. So we need to test bundler with test suite of ruby core.

test suite is big problem. so bundler uses rspec. test suite of ruby core is customized test-unit/minitest.

We can choose some strategy.

  • Rewrite bundler's rspec to minitest/spec
  • Ruby core bundle rspec and integrate rspec and test suite of ruby core.
  • Prepare isolation environment for bundler and rspec without test suite of ruby core. We add new test task named "make test-bundler` and iinvoke it on rubyci.
  • etc...

These are only technical side problem.

I'm going to solve this problem used isolation environment as first.

#8 [ruby-core:81936] Updated by Eregon (Benoit Daloze) 5 months ago

hsbt (Hiroshi SHIBATA) wrote:

We can choose some strategy.

  • Rewrite bundler's rspec to minitest/spec
  • Ruby core bundle rspec and integrate rspec and test suite of ruby core.
  • Prepare isolation environment for bundler and rspec without test suite of ruby core. We add new test task named "make test-bundler` and iinvoke it on rubyci.
  • etc...

These are only technical side problem.

I'm going to solve this problem used isolation environment as first.

I think isolation environment is the best strategy (or the only reasonable).

Rewriting tests is not an option for upstream development and is very time-consuming/error-prone (minitest/spec is a tiny subset of RSpec).

I am not sure what you mean by bundling rspec, but rspec should not be available to normal Ruby users like default gems.
It's a private dependency needed to run tests, and it probably makes most sense to install it as a gem when running the tests.

I suspect it might also be difficult to run the tests in-tree.
In that case I think it makes sense to require an installed Ruby to run more integration-like tests.

#9 [ruby-core:81974] Updated by vo.x (Vit Ondruch) 5 months ago

The upstream version of minitest 4.7.5 supported spec syntax. It does not probably support all the RSpec features, but might be worth of considering ...

#10 [ruby-core:81996] Updated by hsbt (Hiroshi SHIBATA) 5 months ago

I added test-bundler task to my experimental branch.

https://github.com/ruby/ruby/pull/1536/commits/5aa6d9a4340f8e6a54c9411e56c835c7f026abe3

It install rspec under the $(srcdir)/.bundle directory and use it by bundler test.

But many of examples still failed. I'm going to investigate and fix it.

#11 [ruby-core:82109] Updated by indirect (André Arko) 4 months ago

I added test-bundler task to my experimental branch.

Thank you for your work on this. Please contact me in the Bundler slack if you have any questions or would like any help with this. I am happy to help fix the tests.

#12 [ruby-core:82190] Updated by hsbt (Hiroshi SHIBATA) 4 months ago

I've added make test-bundler task to the ruby core.

see https://github.com/ruby/ruby/pull/1536

Maybe, I tested this patch with macOS only. Probably the following task is not compatible all of the supported platform.

https://github.com/ruby/ruby/pull/1536/files#diff-7e056ddc530791272d363e50c1f25647R488

I found problems with bundler test suite before make installenvironment.

  1. Tests of bundle install with native extensions relied on installed ruby interpreter.
  2. Tests of “default gems” are failed. Because they are not installed before make install
  3. Tests of “bundler exec” with gem installed Gemfile relied on installed ruby interpreter.(ex. shebang of rack command use it)
  4. bundler tests require “groff” command for man verification. ruby core could not prepare it.
  5. Some tests depend on the directory structure of bundler/bundler.

I omitted or added workaround to theirs.

https://github.com/hsbt/ruby/blob/e16f39690e2e7843690f691e9f68e3371aba96f3/spec/bundler.patch

I have a happy news. make test-bundler results is here

2269 examples, 0 failures, 3 pending

I ignored 40 examples. but I got green results of most all of examples.

#13 [ruby-core:82395] Updated by shevegen (Robert A. Heiler) 3 months ago

I think that this is a pretty big undertaking, irrelevant of pros or cons
to it (which surely exist).

Bundler is popular, there is no doubt about this even though I myself do not
use it - at https://rubygems.org/stats bundler is ranked #1 by a fair margin
(rank #2 is multi_json and rank #3 is rake).

Since I myself am not using bundler, I feel it would be unjust to comment
on it pro or con, others can do so. But may I suggest something else,
actually - gemify the remaining stdlib parts first before prioritizing
on bundler integration into rubygems 3.x, which then will also be
distributed with the next ruby releases?

I am not sure what is missing aside from fileutils and strscan, if this
is up to date (I am not sure, sorry; I thought there may be more but
I can not find it right now - see the roadmap for 2.5 ... have there
been any ruby core meetings in 2017? Probably have not been added to
2.5 or perhaps the meetings discussed past 2.5 situation).

https://bugs.ruby-lang.org/projects/ruby-trunk/roadmap

#14 [ruby-core:82567] Updated by matz (Yukihiro Matsumoto) 3 months ago

It's OK as long as bundling bundler makes users happy (and I believe it would).

Matz.

#15 [ruby-core:82664] Updated by hsbt (Hiroshi SHIBATA) 3 months ago

I update my working branch.

https://github.com/ruby/ruby/pull/1536

Changes in this branch:

Directory Structure

I organized bundler integration like this:

  root -+- lib -+- bundler/*
        |       |
        |       +- bundler.gemspec
        |       |
        |       +- rubygems/*
        |       |
        |
        |
        +- spec -+- bundler/*
                 |
                 +- rubyspec
                 |

Differences from bundler repo are gemspec and rspec examples locations.
I'm going to send a pull request adopting Ruby core directory structure to bundler upstream.

Exclude some rspec examples for Ruby core.

Some of the bundler examples need to installed Ruby interpreter. But Ruby core test suite doesn't
use installed ruby interpreter. Therefore, It is necessary to exclude examples that require the
installed ruby interpreter.

I also send a pull request these exclusions used rspec filter condition to bundler repo.

Finally, We need to show results of "test-bundler" on Ruby CI (https://rubyci.org).
I will make patches for bundler integration to ruby/rubyci and ruby/chkbuild.

#16 [ruby-core:82666] Updated by vo.x (Vit Ondruch) 3 months ago

I don't understand it. Why is it not simple bundled gem similartly to minitest, test-unit, rake, etc? This gems broken to Ruby directories were always the worst idea. It could make sense when Ruby have not shipped with Rubygems, but nowadays?

#17 [ruby-core:82667] Updated by shyouhei (Shyouhei Urabe) 3 months ago

vo.x (Vit Ondruch) wrote:

I don't understand it. Why is it not simple bundled gem similartly to minitest, test-unit, rake, etc? This gems broken to Ruby directories were always the worst idea. It could make sense when Ruby have not shipped with Rubygems, but nowadays?

Rubygems itself is going to depend on bundler. It must exist beforehand. Bundled gem won't work.

#18 Updated by hsbt (Hiroshi SHIBATA) 3 months ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r59779.


Merge bundler to standard libraries.

rubygems 2.7.x depends bundler-1.15.x. This is preparation for
rubygems and bundler migration.

  • lib/bundler.rb, lib/bundler/*: files of bundler-1.15.4
  • spec/bundler/*: rspec examples of bundler-1.15.4. I applied patches.
  • Makefile.in: Added test task named test-bundler. This task is only working macOS/linux yet. I'm going to support Windows environment later.
  • tool/sync_default_gems.rb: Added sync task for bundler.

[Feature #12733]

Also available in: Atom PDF