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

Fix NoMethodError: undefined method 'verbose' #118

Closed

Conversation

adangel
Copy link

@adangel adangel commented May 1, 2024

With rake 13.2.0, Rake.application.options is not an OpenStruct anymore and contains only valid options. The verbose flag can be queried with Rake.verbose.

See also ruby/rake#545

With rake 13.2.0, Rake.application.options is not an OpenStruct
anymore and contains only valid options. The verbose flag can be
queried with Rake.verbose.
@mtasaka
Copy link

mtasaka commented May 5, 2024

Without this patch, now hoe 4.2.0 testsuite fails with rake 13.2.1 as:

+ rake test -v --trace
** Invoke test (first_time)
** Execute test
/usr/bin/ruby -I:lib:test:. -w -e 'require "minitest/autorun"; require "test/test_hoe_gemcutter.rb"; require "test/test_hoe_publish.rb"; require "test/test_hoe_test.rb"; require "test/test_hoe_debug.rb"; require "test/test_hoe_package.rb"; require "test/test_hoe_test.rb"; require "test/test_hoe.rb"' -- 
Run options: --seed 9946

# Running:

................................EEF...

Finished in 0.184689s, 205.7513 runs/s, 541.4508 assertions/s.

  1) Error:
TestHoeDebug#test_check_manifest:
NoMethodError: undefined method `verbose' for an instance of #<Class:0x00007f62695982b0>
    lib/hoe/debug.rb:89:in `block in check_manifest'
    test/test_hoe_debug.rb:98:in `with_config'
    lib/hoe/debug.rb:76:in `check_manifest'
    test/test_hoe_debug.rb:35:in `block (2 levels) in test_check_manifest'
    test/test_hoe_debug.rb:23:in `block in assert_subprocess_silent'

  2) Error:
TestHoeDebug#test_check_manifest_generated:
NoMethodError: undefined method `verbose' for an instance of #<Class:0x00007f62695982b0>
    lib/hoe/debug.rb:89:in `block in check_manifest'
    test/test_hoe_debug.rb:98:in `with_config'
    lib/hoe/debug.rb:76:in `check_manifest'
    test/test_hoe_debug.rb:47:in `block (2 levels) in test_check_manifest_generated'
    test/test_hoe_debug.rb:23:in `block in assert_subprocess_silent'

  3) Failure:
TestHoeDebug#test_check_manifest_missing [test/test_hoe_debug.rb:61]:
[RuntimeError] exception expected, not
Class: <NoMethodError>
Message: <"undefined method `verbose' for an instance of #<Class:0x00007f62695982b0>">
---Backtrace---
/home/tasaka1/rpmbuild/fedora-specific/MY-PKG/rubygem-hoe/rawhide/hoe-4.2.0/usr/share/gems/gems/hoe-4.2.0/lib/hoe/debug.rb:89:in `block in check_manifest'
/home/tasaka1/rpmbuild/fedora-specific/MY-PKG/rubygem-hoe/rawhide/hoe-4.2.0/usr/share/gems/gems/hoe-4.2.0/test/test_hoe_debug.rb:98:in `with_config'
/home/tasaka1/rpmbuild/fedora-specific/MY-PKG/rubygem-hoe/rawhide/hoe-4.2.0/usr/share/gems/gems/hoe-4.2.0/lib/hoe/debug.rb:76:in `check_manifest'
/home/tasaka1/rpmbuild/fedora-specific/MY-PKG/rubygem-hoe/rawhide/hoe-4.2.0/usr/share/gems/gems/hoe-4.2.0/test/test_hoe_debug.rb:62:in `block (3 levels) in test_check_manifest_missing'
---------------

38 runs, 100 assertions, 1 failures, 2 errors, 0 skips

@zenspider
Copy link
Member

Good find! But... did I want verbose or did I mean trace?

Hrm... I guess I didn't know the difference between the two... verbose will print out the commands much like trace but it doesn't output a full stack trace on error. I usually use trace because I'm trying to see how rake is working through dependencies, but verbose is kinda nice!

I think in this case the more correct thing is to enable verbose with either option.

I've also opened up ruby/rake#564 because I think the output is a bit confusing.

@zenspider
Copy link
Member

Also fixed my minitest/test_task to go verbose using either. Thanks!

@zenspider
Copy link
Member

Ok. This is in w/ my adjustment. Thanks!

@zenspider zenspider closed this May 5, 2024
@seattlerb seattlerb locked and limited conversation to collaborators Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants