summaryrefslogtreecommitdiff
path: root/spec/bundler/install
AgeCommit message (Collapse)Author
12 days[ruby/rubygems] Fix dependency source bug in bundlereileencodes
I stumbled across a bundler bug that had me scratching my head for awhile, because I hadn't experienced it before. In some cases when changing the source in a gemfile from a `Source::Gemspec` to either a `Source::Path` or `Source::Git` only the parent gem will have it's gem replaced and updated and the child components will retain the original version. This only happens if the gem version of the `Source::Gemspec` and `Source::Git` are the same. It also requires another gem to share a dependency with the one being updated. For example if I have the following gemfile: ``` gem "rails", "~> 8.1.1" gem "propshaft" ``` Rails has a component called `actionpack` which `propshaft` depends on. If I change `rails` to point at a git source (or path source), only the path for `rails` gets updated: ``` gem "rails", github: "rails/rails", branch: "8-1-stable" gem "propshaft" ``` Because `actionpack` is a dependency of `propshaft`, it will remain in the rubygems source in the lock file WHILE the other gems are correctly pointing to the git source. Gemfile.lock: ``` GIT remote: https://github.com/rails/rails.git revision: https://github.com/ruby/rubygems/commit/9439f463e0ef branch: 8-1-stable specs: actioncable (8.1.1) ... actionmailbox (8.1.1) ... actionmailer (8.1.1) ... actiontext (8.1.1) ... activejob (8.1.1) ... activemodel (8.1.1) ... activerecord (8.1.1) ... activestorage (8.1.1) ... rails (8.1.1) ... railties (8.1.1) ... GEM remote: https://rubygems.org/ specs: action_text-trix (2.1.15) railties actionpack (8.1.1) <===== incorrectly left in Rubygems source ... ``` The gemfile will contain `actionpack` in the rubygems source, but will be missing in the git source so the path will be incorrect. A bundle show on Rails will point to the correct place: ``` $ bundle show rails /Users/eileencodes/.gem/ruby/3.4.4/bundler/gems/rails-9439f463e0ef ``` but a bundle show on actionpack will be incorrect: ``` $ bundle show actionpack /Users/eileencodes/.gem/ruby/3.4.4/gems/actionpack-8.1.1 ``` This bug requires the following to reproduce: 1) A gem like Rails that contains components that are released as their own standalone gem is added to the gemfile pointing to rubygems 2) A second gem is added that depends on one of the gems in the first gem (like propshaft does on actionpack) 3) The Rails gem is updated to use a git source, pointing to the same version that is being used by rubygems (ie 8.1.1) 4) `bundle` will only update the path for Rails component gems if no other gem depends on it. This incorrectly leaves Rails (or any gem like it) using two different codepaths / gem source code. https://github.com/ruby/rubygems/commit/dff76ba4f6
2025-12-23Merge RubyGems 4.0.3 and Bundler 4.0.3Hiroshi SHIBATA
2025-11-20[ruby/rubygems] Add support for BUNDLE_LOCKFILE environment variableJeremy Evans
This specifies the lockfile location. This allows for easy support of different lockfiles per Ruby version or platform. https://github.com/ruby/rubygems/commit/b54d65bc0a Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Co-authored-by: Colby Swandale <996377+colby-swandale@users.noreply.github.com>
2025-11-20[ruby/rubygems] Improve error messages and handling in testseileencodes
This is a first pass to improve the way errors are handled and raised in bundler's tests. The goal is to clean up tests and modernize them - these were some obvious areas that could be cleaned up. - Instead of raising "ZOMG" in the load error tests, it now tests for the actual error and gem raising. - Improve error messages where applicable. - All errors raise a specific error class, rather than falling back to a default and just setting a message. - Removed arguments and `bundle_dir` option from `TheBundle` class as it wasn't actually used so therefore we don't need to raise an error for extra arguments. - Removed error from `BundlerBuilder`, as it won't work if it's not `bundler`, also it never uses `name`. The only reaon `name` is passed in is because of metaprogramming on loading the right builder. I think that should eventually be refactored. - Replaced and removed `update_repo3` and `update_repo4` in favor of just `build_repo3` and `build_repo4`. Rather than tell someone writing tests to use a different method, automatically use the right method. https://github.com/ruby/rubygems/commit/68c39c8451
2025-11-14[ruby/rubygems] Fix triple spacing when generating lockfileJimmy Lin
https://github.com/ruby/rubygems/commit/d3baf4110e
2025-11-10[ruby/rubygems] Hide patchlevel from lockfileHiroshi SHIBATA
https://github.com/ruby/rubygems/commit/9b169c700f
2025-11-07[ruby/rubygems] Replace Pathname#rmtree to FileUtils.rm_rf directlyHiroshi SHIBATA
https://github.com/ruby/rubygems/commit/33c7a9a565
2025-10-15[rubygems/rubygems] Use `default_cache_path` helper for brevityDavid Rodríguez
https://github.com/rubygems/rubygems/commit/29a12c3d46
2025-10-09[rubygems/rubygems] Removed obsoleted exampleHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/b9960f2c6a Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
2025-09-19[rubygems/rubygems] Switch `cache_all` to be `true` by defaultDavid Rodríguez
And make it a standard setting. https://github.com/rubygems/rubygems/commit/17e356fa94
2025-09-19[rubygems/rubygems] Fix parallel installation issueDavid Rodríguez
If using a gem with precompiled versions having different dependencies than the generic version from a path source, and with a lockfile including a precompiled version, we would materialize the generic version, but end up using dependencies for the precompiled version. That will result in the parallel installer missing the specifications for the extra dependencies of the generic version, causing a crash. If we are materializing for installation, make sure we use the materialized specification when traversing dependencies. https://github.com/rubygems/rubygems/commit/5f75d75de7
2025-09-16[rubygems/rubygems] Completely remove multisources supportDavid Rodríguez
https://github.com/rubygems/rubygems/commit/8f9d6c54a1
2025-09-16[rubygems/rubygems] Remove `allow_offline_install` settingDavid Rodríguez
And let the feature always be enabled, so I'm not sure why we'd need this configurable. https://github.com/rubygems/rubygems/commit/5a27f0c1e3
2025-09-11[rubygems/rubygems] Complete remembered options removalDavid Rodríguez
https://github.com/rubygems/rubygems/commit/573ffad3ea
2025-08-18[rubygems/rubygems] Enforce checksums strictly for registry gemsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/05199ae0c1
2025-08-18[rubygems/rubygems] Refactor git specsDavid Rodríguez
To save some unnecessary `bundle install` commands. https://github.com/rubygems/rubygems/commit/61e7d9d09a
2025-08-18[rubygems/rubygems] Remove unnecessary rubygems filtersDavid Rodríguez
Since the lowest supported version is now 3.4.1. https://github.com/rubygems/rubygems/commit/d00e03c52e
2025-07-30[rubygems/rubygems] Fix truffleruby failing to install sorbet-static when ↵David Rodríguez
there's no lockfile The generic Ruby platform was getting unconditionally added in truffleruby, preventing resolution in situations where there's no generic ruby version (sorbet-static). Instead, the generic platform should be considered per dependency, not globally. https://github.com/rubygems/rubygems/commit/a96afc5351
2025-07-28[rubygems/rubygems] Remove unnecessary branchingDavid Rodríguez
We now run specs against a single version, so I prefer to keep a single branch. Once we bump the major version, this will need very little updates, and that seems fine. https://github.com/rubygems/rubygems/commit/3866d25a00
2025-07-25[rubygems/rubygems] Build bundler gem just once for specsDavid Rodríguez
When we need to reset system gems during specs, there's no need to rebuild bundler, we can copy over the original gem home. https://github.com/rubygems/rubygems/commit/7b4f80747b
2025-07-25[rubygems/rubygems] Don't create an empty bundled_app when setting up depsDavid Rodríguez
Running everything in `bundled_app` by default causes the `bundled_app` helper to be used everytime, and that will create a scoped bundled_app folder if it does not exist. That causes `bin/rake spec:deps` to create an empty `tmp/2.1/bundled_app` folder which is a bit weird. This commit changes specs to not switch to a (possibly empty) bundled_app directory when not necessary (for example, when running `gem` commands in order to setup test dependencies). https://github.com/rubygems/rubygems/commit/4bf89c0705
2025-07-17Cancel `--force` deprecation in favor of `--redownload`David Rodríguez
I realized `--redownload` is not a good name, because it does not necessarily redownloads gems. It only forces reinstallation even if gem is already installed. So I believe `--force` is actually a better name and the introduction of `--force` was a misunderstanding of what the `--force` flag did at the time. Let's cancel the deprecation of `--force`. For now the `--redownload` alias is left around until we decide what to do with it.
2025-07-07[rubygems/rubygems] Cancel `path_relative_to_cwd` changeDavid Rodríguez
It only affected the `--path` flag which is actually getting removed, so I don't think it makes sense to make such change. The current behavior is reasonable and I tried to codify it with a few more specs. https://github.com/rubygems/rubygems/commit/6f520eb146
2025-07-07[rubygems/rubygems] Remove unnecessary nesting from standalone specsDavid Rodríguez
Originally, all the specs in this file were put inside a shared examples block, and since then all specs were run only changing the cwd (either from root, or a subdirectory). This was in https://github.com/rubygems/rubygems/commit/d7291700d016, to cover a fix in the `bundler_path` method. However, reverting that fix does not make any of the specs in either of the main blocks fail! Only an unrelated spec of `bundle install --standalone --local` fails. The reason is that all specs set `path` to an absolute path, making the fix essentially uncovered. In order to simplify the file structure and improve runtime, I completely removed the shared examples block, and only run main specs for the root directory. Then I added a couple of extra specs to cover the original bug fix. This cuts runtime of this spec file in half, from 1m30s to 45s on my laptop. https://github.com/rubygems/rubygems/commit/cc506f17e0
2025-07-03Sync RubyGemsDavid Rodríguez
2025-07-02[rubygems/rubygems] Migrate all remaining specs to run offlineDavid Rodríguez
Also removed the helper to install real gems during specs to avoid the temptation of introducing network stuff again. https://github.com/rubygems/rubygems/commit/a1ab5e319a
2025-07-02[rubygems/rubygems] Verify specs still using realworld gems still pass with ↵David Rodríguez
latest versions https://github.com/rubygems/rubygems/commit/9da44ade24
2025-07-02[rubygems/rubygems] Realworld optparse gem should be no longer necessaryDavid Rodríguez
Optparse was vendored a while ago. https://github.com/rubygems/rubygems/commit/d7afd43756
2025-07-02[rubygems/rubygems] Don't use currently configured value for default branchDavid Rodríguez
https://github.com/rubygems/rubygems/commit/1ae8533690
2025-07-02[rubygems/rubygems] Logger realworld gem is no longer necessaryDavid Rodríguez
https://github.com/rubygems/rubygems/commit/6e6288a496
2025-07-02[rubygems/rubygems] Realworld tsort gem should be no longer necessaryDavid Rodríguez
https://github.com/rubygems/rubygems/commit/93d9b97182
2025-07-02[rubygems/rubygems] These specs need stringio only for old versionsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/a44cdf4c21
2025-06-30[rubygems/rubygems] Remove "double CI" for testing Bundler 4 modeDavid Rodríguez
Since now every functionality that changes in Bundler 4 is under a setting, we can enable that setting to test the new functionality, without having to run our full CI twice. This can actually be seen as increasing coverage, because Bundler 4 functionality will now be tested on Windows, MacOS, or any other environment where previously "Bundler 4 mode" was not running. https://github.com/rubygems/rubygems/commit/1cb3e009fc
2025-06-30Rewrite specs to not start local dev serversDavid Rodríguez
They cause flakies when different tests start them in parallel, and also make the specs more complicated.
2025-06-25[rubygems/rubygems] Remove unnecessary loading of fileutils from path specsDavid Rodríguez
These specs load artifice before Bundler boots because of their global rubygems source. Artifice in turn loads `rack`, `rack-test`, and `tmpdir` which in turn load `fileutils`. Because of this, a missing `require` of `fileutils` in RubyGems would not be caught by specs. Loading artifice is not necessary for most of these specs, so remove the global source to avoid it. https://github.com/rubygems/rubygems/commit/aad871c997
2025-06-25[rubygems/rubygems] Remove message long gone from the code base from ↵David Rodríguez
expectations https://github.com/rubygems/rubygems/commit/2eaada3508
2025-06-24[rubygems/rubygems] Cleanup now unnecessary RUBYOPT handlingDavid Rodríguez
https://github.com/rubygems/rubygems/commit/ac83c78635
2025-06-23[rubygems/rubygems] Fix flaky test failures in mirror probing specsDavid Rodríguez
The mirror probing spec file was moved to our regular suite, which runs in parallel, recently. These specs rely on starting and stopping actual servers in localhost, but this does not play nice with parallelization, because a spec may kill the webserver another spec has created. This commit moves mirror probing specs to not need to start servers in localhost and do something more similar to what the other specs do. https://github.com/rubygems/rubygems/commit/ca9a19706f
2025-06-19Skip to Bundler 4 directlyDavid Rodríguez
2025-06-19[rubygems/rubygems] Normalize Bundler version spec filtersDavid Rodríguez
https://github.com/rubygems/rubygems/commit/28b6a7cf5e
2025-06-19[rubygems/rubygems] Never ignore gems from path sources during activationDavid Rodríguez
The "ignore" attribute is a RubyGems thing to mark when a installed gem should be ignored for activation because its extensions are not properly compiled. In the case of gems from path sources, the warning is not accurate because extensions are compiled into the local lib path, which is not where RubyGems leaves its sentinel `gem.build_complete` file. Also, there's a single version of each gem in the path source available to Bundler, so we always certainly want to consider that for activation and never makes sense to ignore it. https://github.com/rubygems/rubygems/commit/ec5d33695e
2025-06-17[rubygems/rubygems] Reword a couple of specs to further clarify themDavid Rodríguez
https://github.com/rubygems/rubygems/commit/e28b5e306f
2025-06-17[rubygems/rubygems] Migrate mirror probe specs to use the compact index APIDavid Rodríguez
Could potentially fix some flakies we're using and make the specs more "modern" and simplifies them because less fallbacks are involved. https://github.com/rubygems/rubygems/commit/30da9a1a93
2025-06-17[rubygems/rubygems] Consistently use instance variables directlyDavid Rodríguez
I don't think the indirection improve things. https://github.com/rubygems/rubygems/commit/b408b28844
2025-06-17[rubygems/rubygems] Cleanup dead code, RubyGems 3.3 is no longer supportedDavid Rodríguez
https://github.com/rubygems/rubygems/commit/945a29a477
2025-06-06[rubygems/rubygems] Extract stdboth spec helperDavid Rodríguez
https://github.com/rubygems/rubygems/commit/bb13f4e702
2025-06-05[rubygems/rubygems] Fix git source unlocking for multi-gem repositories like ↵David Rodríguez
Rails If you have ``` gem "rails", git: "https://github.com/rails/rails" ``` and then explicitly pin to an older ref, like ``` gem "rails", git: "https://github.com/rails/rails", ref: "https://github.com/rubygems/rubygems/commit/99bacb5aa8e5" ``` Then `bundle install` fails, because locked sources fail to be updated to use the new source. This commit fixes the problem by making sure get their source properly replaced. https://github.com/rubygems/rubygems/commit/5de8c2e0cf
2025-06-03[rubygems/rubygems] Partially phase out x64-mingw32 in favour of ↵Nicholas La Roux
x64-mingw-ucrt (platforms) - the x64-mingw32 platform has been superseded by x64-mingw-ucrt - the mingw-ucrt platform is present as of Windows 10, which was released 10 years ago in 2015 and all versions prior to 10 are end-of-life and 10 will be by mid October 2025 - newer rubies use the mingw-ucrt platform instead of the mingw32 platform, meaning using the deprecated platform can cause issues during gem installation https://github.com/rubygems/rubygems/commit/b9d871022e
2025-05-19[rubygems/rubygems] Fix test warnings introduced by recent CGI changesDavid Rodríguez
They read like this: ``` /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty /opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape /home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape ``` The problem is that `rspec` loads `erb` for its configuration, which loads `cgi/util` from system gems. Then our tests change the `$LOAD_PATH` to make test gems installed in tmp visible to `require`, and then they all require `cgi` as a transitive dependency of `rack-test`, this time from `tmp` gems. This causes system and test specific copies to be mixed together and these warnings to be printed, but we have also observed failures in some tests with errors like > class variable @@accept_charset of CGI::Util is overtaken by CGI::Escape This changes should also fix those failures. The fix is to require all of `rack-test` (including `cgi`) before we have changed the `$LOAD_PATH`. Because the `$LOAD_PATH` is unchanged, RubyGems respects the version of `cgi` activated by RSpec, avoiding the double loads. https://github.com/rubygems/rubygems/commit/34e75465c6
2025-05-19Rename a couple of spec filesDavid Rodríguez
Generally are "realworld" specs are the ones using VCR cassettes of real requests. These files don't use that, so I moved them to a different place.