evanphx / benchmark-ips

Provides iteration per second benchmarking for Ruby
MIT License
1.72k stars 97 forks source link

NoMethodError: gem install --user-install benchmark-ips -v 2.8.0 #100

Closed junaruga closed 4 years ago

junaruga commented 4 years ago

I faced the following error for the version 2.8.0 that was released today. I am using Ruby 2.7.1 on Fedora 31.

$ which ruby
/usr/local/ruby-2.7.1/bin/ruby

$ which gem
/usr/local/ruby-2.7.1/bin/gem

$ gem -v
3.1.2

$ gem install --user-install benchmark-ips
Fetching benchmark-ips-2.8.0.gem
Successfully installed benchmark-ips-2.8.0
Parsing documentation for benchmark-ips-2.8.0

RDoc::Parser::Ruby failure around line 176 of
lib/benchmark/ips.rb

end

Before reporting this, could you check that the file you're documenting
has proper syntax:

  /home/root/local/ruby-2.7.1/bin/ruby -c lib/benchmark/ips.rb

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

    (NoMethodError) undefined method `[]' for nil:NilClass

ERROR:  While executing gem ... (NoMethodError)
    undefined method `[]' for nil:NilClass
$ gem install --user-install benchmark-ips -v 2.8.0
Successfully installed benchmark-ips-2.8.0
Parsing documentation for benchmark-ips-2.8.0

RDoc::Parser::Ruby failure around line 176 of
lib/benchmark/ips.rb

end

Before reporting this, could you check that the file you're documenting
has proper syntax:

  /home/root/local/ruby-2.7.1/bin/ruby -c lib/benchmark/ips.rb

RDoc is not a full Ruby parser and will fail when fed invalid ruby programs.

The internal error was:

    (NoMethodError) undefined method `[]' for nil:NilClass

ERROR:  While executing gem ... (NoMethodError)
    undefined method `[]' for nil:NilClass

It is okay for the 2.7.2.

$ gem install --user-install benchmark-ips -v 2.7.2
Successfully installed benchmark-ips-2.7.2
Parsing documentation for benchmark-ips-2.7.2
Done installing documentation for benchmark-ips after 0 seconds
1 gem installed
nateberkopec commented 4 years ago

Seeing the same.

nateberkopec commented 4 years ago

This should be a simple fix if anyone wants to dig in and figure it out, I'll hotline a new release.

junaruga commented 4 years ago

It seems the error comes from rdoc command in the process of gem install.

$ rdoc lib/benchmark/ips.rb
Parsing sources...
100% [ 1/ 1]  lib/benchmark/ips.rb
RDoc::Parser::Ruby failure around line 176 of
lib/benchmark/ips.rb
...
junaruga commented 4 years ago

After removing the following 1 line for ##, the rdoc lib/benchmark/ips.rb command finished successfully. I do not know why.

$ git diff
diff --git a/lib/benchmark/ips.rb b/lib/benchmark/ips.rb
index 673b80c..cb1a81c 100644
--- a/lib/benchmark/ips.rb
+++ b/lib/benchmark/ips.rb
@@ -109,7 +109,6 @@ module Benchmark
     end
   end

-  ##
   # :singleton-method: ips
   #
   #     require 'benchmark/ips'
junaruga commented 4 years ago

I was testing it on the commit d96988c213bd9e945128f22ec305c5f5032d10bd. On the commit, rdoc lib/benchmark/ips.rb is error.

But on the current latest master (3dba7bea8d0284a0385cdf7d2abeb59eb14730ac), rdoc lib/benchmark/ips.rb is okay.

By the way, there is no tag for v2.8.0. You might forget to push the tag info to the repository.

$ git tag
v2.0.0
v2.2.0
v2.3.0
v2.4.0
v2.4.1
v2.5.0
v2.6.0
v2.6.1
v2.7.0
v2.7.1
v2.7.2
eregon commented 4 years ago

There is also another issue in 2.8.0:

$ gem i benchmark-ips
Successfully installed benchmark-ips-2.8.0
1 gem installed

$ ruby -e 'require "benchmark/ips"'
Traceback (most recent call last):
    2: from -e:1:in `<main>'
    1: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- benchmark/ips (LoadError)
    6: from -e:1:in `<main>'
    5: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
    4: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
    3: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
    2: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/benchmark-ips-2.8.0/lib/benchmark/ips.rb:4:in `<top (required)>'
    1: from /home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/eregon/.rubies/ruby-2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- benchmark/ips/stats/stats_metric (LoadError)
eregon commented 4 years ago

https://github.com/evanphx/benchmark-ips/blob/3dba7bea8d0284a0385cdf7d2abeb59eb14730ac/Manifest.txt seems to be missing lib/benchmark/ips/stats/stats_metric.rb.

nateberkopec commented 4 years ago

Tagged the 2.8.0 release

nateberkopec commented 4 years ago

This issue was fixed on master