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

Error: #<Gem::Requirement::BadRequirementError: Illformed requirement [">=>= 0"]> on startup using -RubyStartupArgs setup #233

Closed
Alex-Tsvetanov opened this issue Jun 18, 2024 · 3 comments

Comments

@Alex-Tsvetanov
Copy link

Alex-Tsvetanov commented Jun 18, 2024

The following line is causing Ruby Error on run_tests_without_gui:

gem gem_name, ">=#{version}"

The fix would have to be applied for line 27 as well:

gem gem_name, ">=#{version}"

The error is as follows:

Error: #<Gem::Requirement::BadRequirementError: Illformed requirement [">=>= 0"]>
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:108:in `parse'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:140:in `block in initialize'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:140:in `map!'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:140:in `initialize'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:70:in `new'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/requirement.rb:70:in `create'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/dependency.rb:60:in `initialize'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:56:in `new'
/Applications/SketchUp 2023/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:56:in `gem'
/Users/alextsvetanov/Library/Application Support/SketchUp 2023/SketchUp/Plugins/testup/gem_helper.rb:17:in `require'
<main>:in `<main>'
SketchUp:in `eval'

This is caused because the default value of the keyword argument version is Gem::Requirement.default which is #<Gem::Requirement:0x00000002bf5d7688 @requirements=[[">=", #<Gem::Version "0">]]>. Therefore when the ">=" is added manually on lines 17 and 27 it becomes ">=>= 0" which causes the error.

This is reproducible with the latest release (2.5.1 using the .rbz file) on both Sketchup 2023 and Sketchup 2024 using Ruby 2.7 and Ruby 3.2 respectively.

Found while running the testup-2 using -RubyStartupArgs setup from the ReadMe. Apparently run_tests_without_gui is being called and it reaches line 17 where it all goes down. Confirmed the source by doing TestUp::GemHelper.require('minitest-reporters-json_reporter', 'minitest/reporters/json_reporter') (as written here

GemHelper.require('minitest-reporters-json_reporter',
required here
require 'testup/json_ci_reporter'
)

@Alex-Tsvetanov
Copy link
Author

Alex-Tsvetanov commented Jun 18, 2024

Original Ruby console logs on startup:

Error: #<Gem::Requirement::BadRequirementError: Illformed requirement [">=>= 0"]>
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:106:in `parse'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `block in initialize'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `map!'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `initialize'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:68:in `new'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:68:in `create'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/dependency.rb:56:in `initialize'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_gem.rb:51:in `new'
/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_gem.rb:51:in `gem'
/Users/alextsvetanov/Library/Application Support/SketchUp 2024/SketchUp/Plugins/testup/gem_helper.rb:17:in `require'
/Users/alextsvetanov/Library/Application Support/SketchUp 2024/SketchUp/Plugins/testup/json_ci_reporter.rb:13:in `<module:TestUp>'
/Users/alextsvetanov/Library/Application Support/SketchUp 2024/SketchUp/Plugins/testup/json_ci_reporter.rb:11:in `<top (required)>'
<internal:/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/Applications/SketchUp 2024/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
/Users/alextsvetanov/Library/Application Support/SketchUp 2024/SketchUp/Plugins/testup/api.rb:49:in `run_suite_without_gui'

Dev setup:

file(GENERATE OUTPUT Run_Tests.rb CONTENT "require 'testup'
TestUp::API.run_suite_without_gui('${CMAKE_CURRENT_BINARY_DIR}')")

add_custom_target(Tests ALL)
add_dependencies(Tests ${tests})
set_target_properties(Tests PROPERTIES 
	VS_DEBUGGER_COMMAND "C:/Program Files/SketchUp/SketchUp ${SKETCHUP_VERSION}/SketchUp.exe"
	VS_DEBUGGER_COMMAND_ARGUMENTS "-RubyStartup \"${CMAKE_CURRENT_BINARY_DIR}/Run_Tests.rb\""
	XCODE_SCHEME_EXECUTABLE "/Applications/SketchUp ${SKETCHUP_VERSION}/SketchUp.app"
	XCODE_SCHEME_ARGUMENTS  "-RubyStartup '${CMAKE_CURRENT_BINARY_DIR}/Run_Tests.rb'"
)

@thomthom
Copy link
Member

This should be fixed by this hotfix: #234

@thomthom
Copy link
Member

Released 2.5.2 that should fix this.
https://github.com/SketchUp/testup-2/releases

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