commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
822 stars 74 forks source link

SortedSet extracted from set add sorted_set gem to runtime dependencies #98

Closed briancolfer-upstart closed 3 years ago

ggilder commented 3 years ago

I don't understand this issue, please provide some context on what problem you're seeing.

briancolfer-upstart commented 3 years ago

When I run the rspec tests I get:

commander git:(master) bundle exec rspec
......................................................F..................................................................................

Failures:

  1) Commander::Methods AskForClass defining methods implements "ask_for_*"
     Failure/Error: Object.const_get(const)

     RuntimeError:
       The `SortedSet` class has been extracted from the `set` library.You must use the `sorted_set` gem or other alternatives.
     # ./lib/commander/user_interaction.rb:347:in `require'
     # ./lib/commander/user_interaction.rb:347:in `const_get'
     # ./lib/commander/user_interaction.rb:347:in `block in method_missing'
     # ./lib/commander/user_interaction.rb:346:in `map'
     # ./lib/commander/user_interaction.rb:346:in `method_missing'
     # ./spec/methods_spec.rb:49:in `block (4 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # LoadError:
     #   cannot load such file -- sorted_set
     #   ./lib/commander/user_interaction.rb:347:in `require'

Finished in 0.1853 seconds (files took 0.2501 seconds to load)
137 examples, 1 failure

Failed examples:

rspec ./spec/methods_spec.rb:47 # Commander::Methods AskForClass defining methods implements "ask_for_*"

Coverage report generated for RSpec to /Users/brian.colfer/packages/commander/coverage. 399 / 473 LOC (84.36%) covered.
ggilder commented 3 years ago

Thank you, that helps. I don't think requiring the sorted_set gem is the ideal solution though — this AskForClass code has been problematic with a number of these constants that get deprecated over time, and it would be great to have a more permanent solution. Feel free to put together a PR if that makes sense, otherwise I will try to revise the logic.

ggilder commented 3 years ago

It looks like this issue only occurs on Ruby 3, per https://dev.to/aaronc81/removing-functionality-the-ruby-way-a-look-into-sortedset-on-ruby-3-clf

ggilder commented 3 years ago

Fixed in version 4.6.0 (just released). Thanks for flagging this!