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

Relax dependent thor version to fix CI #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyanny
Copy link

@kyanny kyanny commented Feb 25, 2022

Hi @kenn,

sunzi's CI failed with ruby-head (3.2.0dev).
https://github.com/kenn/sunzi/pull/45/checks?check_run_id=5319265537

That's because sunzi depends on older thor (v0.20.x), thor at that version uses open-uri internally, but open-uri was removed since Ruby 3.x release.
https://github.com/ruby/ruby/blob/v3_0_0/NEWS.md#compatibility-issues

thor v1.x uses URI.open so that it is compatible with Ruby 3.x.
rails/thor#677

This pull request removes dependent thor version from the gemspec file, so that sunzi will use newer thor and it works fine with Ruby 3.x.


Before this patch:

ruby-2.7.2: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux] 
Run options: --seed 7920

# Running:

....

Finished in 0.241189s, 16.5845 runs/s, 132.6760 assertions/s.

4 runs, 32 assertions, 0 failures, 0 errors, 0 skips


ruby-3.0.0: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] 
Run options: --seed 40040

# Running:

...E

Finished in 0.031828s, 125.6742 runs/s, 628.3711 assertions/s.

  1) Error:
TestCommand#test_compile:
Errno::ENOENT: No such file or directory @ rb_sysopen - https://raw.github.com/kenn/sunzi-recipes/master/ruby/rvm.sh
    /usr/local/rvm/gems/ruby-3.0.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:89:in `initialize'
    /usr/local/rvm/gems/ruby-3.0.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:89:in `open'
    /usr/local/rvm/gems/ruby-3.0.0/gems/thor-0.20.3/lib/thor/actions/file_manipulation.rb:89:in `get'
    /usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `get'
    /root/sunzi/lib/sunzi/command.rb:69:in `block in compile'
    /usr/local/rvm/gems/ruby-3.0.0/gems/hashugar-1.0.1/lib/hashugar.rb:36:in `each'
    /usr/local/rvm/gems/ruby-3.0.0/gems/hashugar-1.0.1/lib/hashugar.rb:36:in `each'
    /root/sunzi/lib/sunzi/command.rb:66:in `compile'
    /root/sunzi/test/command_test.rb:34:in `block in test_compile'

4 runs, 20 assertions, 0 failures, 1 errors, 0 skips

After this patch (bundle install && bundle update):

ruby-2.7.2: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux] 
Run options: --seed 21643

# Running:

....

Finished in 0.260584s, 15.3501 runs/s, 122.8011 assertions/s.

4 runs, 32 assertions, 0 failures, 0 errors, 0 skips


ruby-3.0.0: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] 
Run options: --seed 26678

# Running:

....

Finished in 0.080398s, 49.7524 runs/s, 398.0196 assertions/s.

4 runs, 32 assertions, 0 failures, 0 errors, 0 skips

Thor as of v0.20.x relied on `open-uri` that was deprecated since Ruby version 3.
https://github.com/ruby/ruby/blob/v3_0_0/NEWS.md#compatibility-issues

Thor v1.x uses `URI.open` so that it is compatible with Ruby 3.x.
rails/thor#677
@kyanny kyanny mentioned this pull request Feb 25, 2022
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

Successfully merging this pull request may close these issues.

1 participant