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

Use Irb as default engine for hanami console. #92

Closed
wants to merge 1 commit into from

Conversation

nashby
Copy link

@nashby nashby commented Aug 25, 2023

without this fix I'm getting following error when running hanami console:

From: /usr/local/bundle/gems/hanami-cli-2.0.3/lib/hanami/cli/commands/app/console.rb:49 Hanami::CLI::Commands::App::Command::Environment#call:

    44:               err.puts "`#{engine}' is not bundled. Please run `bundle add #{engine}' and retry."
    45:               exit(1)
    46:             end
    47:
    48:             console_engine.start
 => 49:           end
    50:
    51:           private
    52:
    53:           def resolve_engine(engine, opts)
    54:             if engine

@timriley
Copy link
Member

timriley commented Aug 26, 2023

Thanks for the report, @nashby! However, could you please provide some precise steps about how to replicate this? As well as a fuller error message, if possible?

I've tried myself by doing the following:

  1. Generating a new Hanami app
  2. Comment out "hanami-reloader" and "guard-puma" from the Gemfile
  3. Run bundle again
  4. Run gem uninstall pry to make sure that pry is not installed
  5. Then inside the new app, run bundle exec hanami console

In this case, it successfully loads the console using IRB. Could you please let me know how I can get to this particular error you found?

Possibly sharing your installed gems would help here too.

My understanding is that irb is a default gem and cannot be uninstalled, so in Hanami::CLI::Commands::App::Console#resolve_engine, we should always be able to rely on the final entry in the ENTRIES hash, which is irb.

@timriley
Copy link
Member

Depending on what we learn here, we may possible want to remove that DEFAULT_ENGINE constant, which is as of now unused (@jodosha, it looks like you added this in #53 — do you recall what your intention was here?)

@nashby
Copy link
Author

nashby commented Aug 30, 2023

@timriley yep, sorry, false alarm. pry-byebug gem is the issue here. Not sure why but when hanami-cli starts pry this line is executed https://github.com/deivid-rodriguez/pry-byebug/blob/4eb7421103985215d404d42d3ed74cfec15f0102/lib/pry-byebug/pry_ext.rb#L12 Looks like they fixed this issue for Rails deivid-rodriguez/pry-byebug#392

I'll try to investigate more but this PR is not relevant for sure, closing.

@nashby nashby closed this Aug 30, 2023
@nashby nashby deleted the default-console-engine branch August 30, 2023 18:56
@timriley
Copy link
Member

Wow, what an obscure combination of factors! Thanks so much for clarifying the cause, @nashby, and I'm glad to see it looks like the pry-byebug issue is being fixed too.

Please do feel free to loop back here if for any reason you think we might need to take mitigating measures inside Hanami 🙇🏼

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.

None yet

2 participants