Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Need a Gem::Version: nil (ArgumentError)" on multiple defined sources. #79

Open
junaruga opened this issue Oct 19, 2021 · 1 comment
Open

Comments

@junaruga
Copy link

junaruga commented Oct 19, 2021

I am trying to bundler with the private gem repository run by the gemirro. However with the following config with the "private-repo", the gemirro update fails with "Need a Gem::Version: nil (ArgumentError)" on Ruby 2.7.4 on Fedora 34.

Could you tell me what's wrong? Thank you.

$ ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]

$ bundle -v
Bundler version 2.1.4

$ ./test.sh
++ command -v ruby
/usr/local/ruby-2.7.4/bin/ruby
++ ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
++ command -v gemirro
/home/jaruga/.gem/ruby/2.7.0/bin/gemirro
++ gemirro --version
gemirro v1.3.0 on ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
+++ pwd
++ gemirro init /home/jaruga/git/report-gemirro-bundler-error
Initialized empty mirror in /home/jaruga/git/report-gemirro-bundler-error
++ cp -p fixtures/gems/a/a-0.0.1.gem public/gems/
++ sleep 1
++ gemirro update
I, [2021-10-19T17:26:49.162182 #116314]  INFO -- : Fetching specs.4.8.gz on private-repo (http://127.0.0.1:8801)
I, [2021-10-19T17:26:49.164595 #116314]  INFO -- : Fetching prerelease_specs.4.8.gz on private-repo (http://127.0.0.1:8801)
Traceback (most recent call last):
	13: from /home/jaruga/.gem/ruby/2.7.0/bin/gemirro:23:in `<main>'
	12: from /home/jaruga/.gem/ruby/2.7.0/bin/gemirro:23:in `load'
	11: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/bin/gemirro:7:in `<top (required)>'
	10: from /home/jaruga/.gem/ruby/2.7.0/gems/slop-3.6.0/lib/slop.rb:211:in `parse'
	 9: from /home/jaruga/.gem/ruby/2.7.0/gems/slop-3.6.0/lib/slop.rb:235:in `parse!'
	 8: from /home/jaruga/.gem/ruby/2.7.0/gems/slop-3.6.0/lib/slop.rb:260:in `parse!'
	 7: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/cli/update.rb:19:in `block (2 levels) in <top (required)>'
	 6: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:29:in `fetch'
	 5: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:29:in `each'
	 4: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:30:in `block in fetch'
	 3: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:30:in `each'
	 2: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:40:in `block (2 levels) in fetch'
	 1: from /home/jaruga/.gem/ruby/2.7.0/gems/gemirro-1.3.0/lib/gemirro/gems_fetcher.rb:106:in `fetch_gem'
/usr/local/ruby-2.7.4/lib/ruby/2.7.0/rubygems/requirement.rb:249:in `satisfied_by?': Need a Gem::Version: nil (ArgumentError)

I created the reproducer here.
https://github.com/junaruga/report-gemirro-bundler-error

Here is the full log.
https://gist.github.com/junaruga/5cb4a88e4daf16b4d4d14380ba30304c

Using this config.

$ cat config.rb 
Gemirro.configuration.configure do
  ...

  define_source 'rubygems', 'https://rubygems.org' do
    gem 'gem2rpm', '>= 1.0.1'
  end

  # If this block is commented, the `gemirro update` works.
  define_source 'private-repo', 'http://127.0.0.1:8801' do
    gem 'a', '>= 0.0.1'
  end
end

If I comment out the block, the gemirro update does not show the error.

  define_source 'private-repo', 'http://127.0.0.1:8801' do
    gem 'a', '>= 0.0.1'
  end

But the bundle install using the Gemfile using the private repo fails.
Here is the log: https://gist.github.com/junaruga/f411d422624bc0c462d59e4973e952b3 .

++ gemirro list
a: (0.0.1)
gem2rpm: (1.0.1, 1.0.2)
...
++ bundle install --standalone
Fetching gem metadata from http://127.0.0.1:8801/..
Could not find gem 'a' in rubygems repository http://127.0.0.1:8801/ or installed locally.
The source does not contain any versions of 'a'
@PierreRambaud
Copy link
Owner

Hi,

You don't have to define source for the repository itself.
The source is "where you want to download gems you don't have".
So, if you want to add your custom gem, just put them with "gem push" after changing your gem target.

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

No branches or pull requests

2 participants