-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Problem with inline gemfiles in 1.16.0.pre2 #6072
Comments
I tried again, with v1.16.0.pre.3:
Environment:
|
@olleolleolle Yes, it's fixed in 1.16.0.pre3. But more complicated cases still fail... test.rbrequire "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin', require: false
gem 'activerecord-jdbcsqlite3-adapter',
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
branch: 'rails-5',
platform: :jruby
end With bundler 1.15.4
With bundler 1.16.0.pre.3
Can you reproduce it? |
Out of curiosity, what is the output of |
@deivid-rodriguez Yes, I got the same output you did on that example. (Follow-up: The install works when run without the last gem:) gem 'activerecord-jdbcsqlite3-adapter',
git: 'https://github.com/jruby/activerecord-jdbc-adapter',
branch: 'rails-5',
platform: :jruby |
@segiddins Here it goes Environment
Bundler Build Metadata
Bundler settings
GemfileGemfilesource 'https://rubygems.org'
# Trick to use https without warnings and without having to specify full URLs
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Optional dependencies
gem 'cancan'
gem 'pundit'
# Utility gems used in both development & test environments
gem 'rake'
gem 'parallel_tests'
# Debugging
gem 'pry' # Easily debug from your console with `binding.pry`
# Code style
gem 'rubocop', '0.49.1'
gem 'mdl', '0.4.0'
# Translations
gem 'i18n-tasks'
# Documentation
gem 'yard' # Documentation generator
gem 'redcarpet', platforms: :mri # Markdown implementation (for yard)
gem 'kramdown', platforms: :jruby # Markdown implementation (for yard)
group :development do
# Debugging
gem 'better_errors' # Web UI to debug exceptions. Go to /__better_errors to access the latest one
gem 'binding_of_caller', platforms: :mri # Retrieve the binding of a method's caller
# Performance
gem 'rack-mini-profiler' # Inline app profiler. See ?pp=help for options.
end
group :test do
gem 'capybara'
gem 'simplecov', require: false # Test coverage generator. Go to /coverage/ after running tests
gem 'codecov', require: false # Test coverage website. Go to https://codecov.io
gem 'cucumber-rails', require: false
gem 'cucumber'
gem 'database_cleaner'
gem 'jasmine'
gem 'launchy'
gem 'rails-i18n' # Provides default i18n for many languages
gem 'rspec-rails'
gem 'i18n-spec'
gem 'shoulda-matchers', '<= 2.8.0'
gem 'sqlite3', platforms: :mri
gem 'poltergeist'
end Gemfile.lock
|
Thanks — I’m guessing is the problem is the inline install is somehow picking up the lockfile |
@segiddins Just tried on a clean folder and same thing happens... |
I can reproduce this issue without the Gemfile as well |
Hmm, when I throw this into a test it passes: diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb
index dcaba3ab9..bfccb9955 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -267,4 +267,23 @@ RSpec.describe "bundler/inline#gemfile" do
expect(last_command).to be_success
expect(last_command.stdout).to eq "1.0.0"
end
+
+ it "installs complicated gemfiles with conditionals" do
+ script(<<-RUBY)
+ require "bundler/inline"
+ gemfile(true) do
+ source "https://rubygems.org"
+
+ gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin', require: false
+
+ gem 'activerecord-jdbcsqlite3-adapter',
+ git: 'https://github.com/jruby/activerecord-jdbc-adapter',
+ branch: 'rails-5',
+ platform: :jruby
+ end
+ RUBY
+
+ puts(out)
+ expect(last_command).to be_success
+ end
end
|
@colby-swandale I'm tempted to remove this as a blocker for 1.16.0 unless someone can add a failing test for it |
@segiddins yea lets do it. I can't replicate this under test conditions |
It's causing bug report template tests to fail. https://travis-ci.org/rails/rails/jobs/295520851 This seems an issue of bundler. Ref: rubygems/bundler#6072
I encountered the same error when I specified path to inline gem in bundler 1.16.0. require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "arel", path: "/path/to/arel/"
gem "rails", path: "/path/to/rails/"
end
The problem seems to occur only if the gem is already installed and the following test fails. diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb
index dcaba3a..8e14a0b 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -267,4 +267,30 @@ RSpec.describe "bundler/inline#gemfile" do
expect(last_command).to be_success
expect(last_command.stdout).to eq "1.0.0"
end
+
+ it "use local path in inline gem" do
+ script(<<-RUBY)
+ require "bundler/inline"
+ gemfile(true) do
+ source "https://rubygems.org"
+ gem "arel", path: "/path/to/arel/"
+ gem "rails", path: "/path/to/rails/"
+ end
+ RUBY
+
+ puts(out)
+ expect(last_command).to be_success
+
+ script(<<-RUBY)
+ require "bundler/inline"
+ gemfile(true) do
+ source "https://rubygems.org"
+ gem "arel", path: "/path/to/arel/"
+ gem "rails", path: "/path/to/rails/"
+ end
+ RUBY
+
+ puts(out)
+ expect(last_command).to be_success
+ end
end
|
…em" error when tested with ruby-head This pull request attempts to ignore the following error when tested with ruby-head which has bundler as a default gem. ```ruby $ rvm @global do gem uninstall bundler --all --ignore-dependencies --executables ERROR: While executing gem ... (Gem::InstallError) gem "bundler" cannot be uninstalled because it is a default gem The command "rvm @global do gem uninstall bundler --all --ignore-dependencies --executables" failed and exited with 1 during . ``` Refer https://travis-ci.org/rails/rails/jobs/295600391 This workaround should be removed once rubygems/bundler#6072 is addressed.
Related with rails/rails#31039 $ ruby -v ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux] $ bundler -v Bundler version 1.16.0 $ ```ruby $ cd guides/bug_report_templates/ $ ruby active_record_gem.rb ... snip ... /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:28:in `block in setup': rake-12.2.1 is missing. Run `bundle install` to get it. (Bundler::GemNotFound) from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `map' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `setup' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/inline.rb:70:in `gemfile' from active_record_gem.rb:10:in `<main>' $ ``` ```ruby $ ruby active_record_gem_spec.rb ... snip ... /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:28:in `block in setup': rake-12.2.1 is missing. Run `bundle install` to get it. (Bundler::GemNotFound) from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `map' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `setup' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/inline.rb:70:in `gemfile' from active_record_gem_spec.rb:10:in `<main>' $ ```
Related to rails/rails#31039 $ ruby -v ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux] $ bundler -v Bundler version 1.16.0 $ ```ruby $ cd guides/bug_report_templates/ $ ruby active_record_gem.rb ... snip ... /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:28:in `block in setup': rake-12.2.1 is missing. Run `bundle install` to get it. (Bundler::GemNotFound) from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `map' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `setup' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/inline.rb:70:in `gemfile' from active_record_gem.rb:10:in `<main>' $ ``` ```ruby $ ruby active_record_gem_spec.rb ... snip ... /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:28:in `block in setup': rake-12.2.1 is missing. Run `bundle install` to get it. (Bundler::GemNotFound) from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/2.4.0/forwardable.rb:229:in `each' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `map' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/runtime.rb:26:in `setup' from /home/yahonda/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/lib/bundler/inline.rb:70:in `gemfile' from active_record_gem_spec.rb:10:in `<main>' $ ```
Use Bundler 1.15 to workaround rubygems/bundler#6072
@y-yagi thank you for the failing spec! |
This fixes my test-case reproduction of #6072. I’m pretty sure it’s because the double-check was overriding the locally installed index specs with specs fetched from the RubyGems API, causing Bundler to conclude that the gems aren’t installed, even though they are.
Refer travis-ci.org/rails/rails/jobs/295600391#L1801 This workaround should be removed once rubygems/bundler#6072 is addressed.
Stop overriding specs during double-checks This fixes my test-case reproduction of #6072. I’m pretty sure it’s because the double-check was overriding the locally installed index specs with specs fetched from the RubyGems API, causing Bundler to conclude that the gems aren’t installed, even though they are. @deivid-rodriguez @y-yagi can you verify that this patch fixes the issues with `inline` that you were seeing?
Stop overriding specs during double-checks This fixes my test-case reproduction of #6072. I’m pretty sure it’s because the double-check was overriding the locally installed index specs with specs fetched from the RubyGems API, causing Bundler to conclude that the gems aren’t installed, even though they are. @deivid-rodriguez @y-yagi can you verify that this patch fixes the issues with `inline` that you were seeing?
Stop overriding specs during double-checks This fixes my test-case reproduction of rubygems#6072. I’m pretty sure it’s because the double-check was overriding the locally installed index specs with specs fetched from the RubyGems API, causing Bundler to conclude that the gems aren’t installed, even though they are. @deivid-rodriguez @y-yagi can you verify that this patch fixes the issues with `inline` that you were seeing?
Stop overriding specs during double-checks This fixes my test-case reproduction of #6072. I’m pretty sure it’s because the double-check was overriding the locally installed index specs with specs fetched from the RubyGems API, causing Bundler to conclude that the gems aren’t installed, even though they are. @deivid-rodriguez @y-yagi can you verify that this patch fixes the issues with `inline` that you were seeing? (cherry picked from commit 953acf7)
This should be fixed by #6188. |
This reverts commit 33caae0.
This reverts commit 33caae0.
Revert "Use Bundler 1.15 to workaround rubygems/bundler#6072"
## 1.16.1 (2017-12-12) Bugfixes: - avoid hanging on complex resolver errors ([#6114](rubygems/bundler#6114), @halfbyte) - avoid an error when running `bundle update --group` ([#6156](rubygems/bundler#6156), @mattbrictson) - ensure the resolver prefers non-pre-release gems when possible ([#6181](rubygems/bundler#6181), @greysteil) - include bundler's gemspec in the built gem ([#6165](rubygems/bundler#6165), @dr-itz) - ensure locally installed specs are not overriden by those in remote sources during dependency resolution ([#6072](rubygems/bundler#6072), @indirect) - ensure custom gemfiles are respected in generated binstubs (@pftg) - fail gracefully when loading a bundler-generated binstub when `bin/bundle` was not generated by bundler ([#6149](rubygems/bundler#6149), @hsbt) - allow `bundle init` to be run even when a parent directory contains a gemfile ([#6205](rubygems/bundler#6205), @colby-swandale) ## 1.16.0 (2017-10-31) Bugfixes: - avoid new RubyGems warning about unsafe YAML loading (to keep output consistent) (@segiddins) - load digest subclasses in a thread-safe manner (@segiddins, @colby-swandale) - avoid unusued variable warnings under ruby 2.5 (@amatsuda) - fix printing the same message twice in verbose mode ([#6028](rubygems/bundler#6028), @akhramov) - allow `SignalException`s to bubble up to the interpreter during `bundle exec` ([#6090](rubygems/bundler#6090), @dekellum) - avoid activating stdlib digest under Ruby 2.5 (@segiddins) - prioritise explicitly requested gems in dependency resolution sort order (@segiddins) - reduce memory usage during dependency resolution ([#6114](rubygems/bundler#6114), @greysteil) - ensure that the default bundler gem is not accidentally activated on ruby 2.5 when using local git overrides (@segiddins) ## 1.16.0.pre.3 (2017-10-04) Features: - the output from `bundle env` includes more information, particularly both the compiled & loaded versions of OpenSSL (@indirect) Bugfixes: - fix a bug where installing on FreeBSD would accidentally raise an error (#6013, @olleolleolle) - fix a regression in 1.16 where pre-release gems could accidentally be resolved even when the gemfile contained no pre-release requirements (@greysteil) - bundler will avoid making unnecessary network requests to fetch dependency data, fixing a regression introduced in 1.16 (@segiddins) - the outdated bundler version message is disabled by default until the message has been fine-tuned (#6004, @segiddins) ## 1.16.0.pre.2 (2017-09-06) Bugfixes: - handle when a connection is missing a socket when warning about OpenSSL version (@greysteil) - the description for the `rake release` task now reflects `$RUBYGEMS_HOST` (@wadetandy) - fix a bug where `bundle update` would regress transitive dependencies (@greysteil) ## 1.16.0.pre.1 (2017-09-04) Features: - allow using non-branch symbolic refs in a git source (#4845, @segiddins) - allow absolute paths in the `cache path` setting (#5627, @mal) - gems created via `bundle gem` with rspec have `--require spec_helper` in their `.rspec` file (@koic) - `bundle env` includes `Gem.ruby` and the `bundle` binstub shebang when they don't match (#5616, @segiddins) - allow passing gem names to `bundle pristine` (@segiddins) - `bundle version` and `bundle env` include the commit and build date for the bundler gem (#5049, @segiddins) - add the `--shebang` option to `bundle binstubs` (#4070, @segiddins, @zorbash) - gemfiles are `eval`ed one fewer time when running `bundle install` (#4952, #3096, #4417, @segiddins) - the `fileutils` gem is now vendored so different versions of the gem can be activated (@segiddins) - speed up no-op installations (#5842, @segiddins) - default to keeping the lockfile in the default gem template (@deivid-rodriguez) - add a special bundler binstub that ensures the correct version of bundler is activated (#5876, @segiddins) - speed up dependency resolution and ensure that all resolvable gemfiles can be installed (@segiddins, @greysteil) - add a `bundle list` command that prints the gems in use (#4754, @colby-swandale) - allow adding credentials to a gem source during deployment when `allow_deployment_source_credential_changes` is set (@adrian-gomez) - making an outdated (and insecure) TLS connection to rubygems.org will print a warning (@segiddins) Bugfixes: - allow configuring a mirror fallback timeout without a trailing slash (#4830, @segiddins) - fix handling of mirrors for file: urls that contain upper-case characters (@segiddins) - list the correct gem host for `rake release` when `allowed_push_host` has been set (@mdeering) - ensure `Bundler.original_env` preserves all env keys that bundler sets (#5700, @segiddins) - ensure `bundle pristine` removes files added to a git gem (@segiddins) - load plugin files from path gems before gem installation (#5429, @segiddins) - ensure gems containing manpages are properly set up (#5730, @segiddins) - avoid fetching remote specs when all effected gems are in groups that are not being installed (@segiddins) - allow `BUNDLE_GEMFILE` to be a relative path (#5712, @gxespino) - show a more helpful error message when a gem fails to install due to a corrupted lockfile (#5846, @segiddins) - add a process lock to allow multiple concurrent `bundle install`s (#5851, @stefansedich) - ensure that specifications always return an array for `#extensions` (@greysteil) - print a helpful error message when using a gem in the Gemfile with an empty name (@colby-swandale) - ensure that all gemfiles are included in `bundle env` (@segiddins) - use ssl client cert and ca cert settings from gem configuration as fallbacks (@stan3) - avoid global namespace pollution when loading gems (#5958, @shyouhei) - avoid running a complete re-resolve on `bundle update --bundler` (@segiddins) - allow `bundle binstubs --standalone` to work without `path` being set (@colby-swandale) - fix support for bundle paths that include jars or wars on jruby (#5975, @torcido)
test.rb
With bundler 1.15.4
With bundler 1.16.0.pre.2
The text was updated successfully, but these errors were encountered: