stimulusreflex / stimulus_reflex

Build reactive applications with the Rails tooling you already know and love.

Home Page:https://docs.stimulusreflex.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installer [development] aborts under certain circumstances.

fig opened this issue · comments

commented

Bug Report

Describe the bug

The installer will abort during the [developer] task when config.session_store is defined and defined to other than redis_session_store.

To Reproduce

  • In config/environments/development.rb define
config.session_store :cache_store

n.b The Manual Configuration still recommends :cache_store. Should it be changed to recommend ``redis_session_store`?

  • run the install task rails stimulus_reflex:install

  • The [development] task will abort with

rails aborted!
NoMethodError: undefined method `match?' for #<Pathname: ...

Expected behavior

The expected behavoir is for the installer to write a recommendation to config/environments/development.rb and append

          # StimulusReflex recommends using Redis for session storage
          # gem "redis-session-store", "0.11.5"

to the Gemfile

Versions

StimulusReflex

  • Gem: 3.5.0.pre10
  • Node package: 3.5.0.pre10

External tools

  • Ruby: 3.2.1
  • Rails: 7.0.4.2
  • Node: 18.14.1

The Fix

This bug is due to the PathName of the Gemfile being passed to #write_redis_recommendation at

def write_redis_recommendation(development_working, lines, index, gemfile)

which is expecting the actual String text of the Gemfile.

This method is being called with the incorrect argument from two sites:

write_redis_recommendation(development_working_path, lines, index, gemfile_path)

write_redis_recommendation(development_working_path, lines, index, gemfile_path)

Thanks for the detailed bug report and fix!

The Manual Configuration still recommends :cache_store. Should it be changed to recommend redis_session_store?

Yeah, you are right! We haven't updated the Manual configuration page in the docs. The whole page needs to be updated for the new 3.5 release. I just opened #642 to rework this. Thank you!