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

NameError: uninitialized constant StimulusReflex::Installer::Thor when running rake tasks #701

Closed
TanookiMario opened this issue May 15, 2024 · 1 comment · Fixed by #705

Comments

@TanookiMario
Copy link

Bug Report

Describe the bug

Our dependabot instance recently opened a pull request to bump stimulus_reflex from 3.5.0-rc4 to 3.5.1. the specs passed but the deployment to our staging environment in heroku failed with the error NameError: uninitialized constant StimulusReflex::Installer::Thor (NameError). We attempted to run rake tasks locally with the stimulus_reflex upgrade and get the same error.

To Reproduce

  • ensure you are on stimulus_reflex v3.5.1
  • run bundle exec rake -P

Expected behavior

You should see a list of available rake tasks

Screenshots or reproduction

full output:

> bundle exec rake -P
rake aborted!
NameError: uninitialized constant StimulusReflex::Installer::Thor (NameError)

    include Thor::Base
                ^^^^^^
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/stimulus_reflex-3.5.1/lib/stimulus_reflex/installer.rb:5:in `<class:Installer>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/stimulus_reflex-3.5.1/lib/stimulus_reflex/installer.rb:4:in `<module:StimulusReflex>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/stimulus_reflex-3.5.1/lib/stimulus_reflex/installer.rb:3:in `<main>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/zeitwerk-2.6.14/lib/zeitwerk/kernel.rb:34:in `require'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/stimulus_reflex-3.5.1/lib/tasks/stimulus_reflex/stimulus_reflex.rake:3:in `<main>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine.rb:661:in `load'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine.rb:661:in `block in run_tasks_blocks'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine.rb:661:in `each'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine.rb:661:in `run_tasks_blocks'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/application.rb:500:in `block in run_tasks_blocks'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine/railties.rb:15:in `each'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine/railties.rb:15:in `each'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/application.rb:500:in `run_tasks_blocks'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8.1/lib/rails/engine.rb:464:in `load_tasks'
/Users/ciccio/projects/boost/Rakefile:8:in `<top (required)>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/Users/ciccio/.rvm/gems/ruby-3.2.2/bin/ruby_executable_hooks:22:in `eval'
/Users/ciccio/.rvm/gems/ruby-3.2.2/bin/ruby_executable_hooks:22:in `<main>'
(See full trace by running task with --trace)

Versions

StimulusReflex

  • Gem: [3.5.1]
  • Node package: [3.5.1]

External tools

  • Ruby: 3.2.2p53
  • Rails: 7.0.8.1
  • Node: 18.19.0
@marcoroth
Copy link
Member

Hey @TanookiMario, thanks for opening this issue! We'll get #705 merged and get this sorted in a new patch release, thank you!

marcoroth pushed a commit that referenced this issue May 24, 2024
Rake tasks were failing in projects because the required Thor dependency
was not always required, depending on the way it was called.

The fix also needed to explicitly require the thor gem in the installer
file that used it as a mixin.

Fixes #701

Why should this be added:
Rake tasks in Rails applications were no longer working with the latest
version of this Gem.
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 a pull request may close this issue.

2 participants