How to run Hanami in RubyMine

Tetiana Chupryna
2 min readJan 2, 2017

--

I love RubyMine, I’m loyal fan since a version 4. RubyMine is great. It intelligent, helpful and comfortable. I can sing its praises for a very long time but as you’re reading this tutorial, I guess you come for something else.
Hanami is great too. Especially, for those developers, who want to discover how much Ruby on Rails is doing for them. So let’s find out how to befriend those both wonderful tools (if I can say so).

To be able to run and debug Hanami application in RubyMine, firstly, you have to create a run configuration. (Run -> Edit Configuration or ⌃⌥R -> 0 if you use OSX keymap.)

By default, RubyMine doesn’t provide run configuration for Hanami. It’s not a problem because we can create it ourselves with Gem configuration template. The first thing to do is to create a new Gem Command configuration:

New Gem configuration

Next thing is to set up our configuration. It’s pretty simple. Firstly, you have to enter a name of a gem. In our case it’s hanami. Don’t forget to install it first. RubyMine will show you if this gem is available in your current gemset.

Choose Hanami from available gems

Executable name rests the same as a name of a gem. In arguments field type server. I prefer to run it on 3000 port if you want it to, just add -p 3000 to arguments. Working directory should be prefilled, but if it’s not — just write there a path to directory with your current project. Next thing to do (the most important) it to give a name for your configuration. With my lack of imagination, I’m just typing a name of a project.

Final configuration

Then press OK and it’s done. You are ready to run and debug. Literally.

Choose Run/Debug ‘your configuration’ in menu or use hotkeys to access Run/Debug popup (⌃⌥R / ⌃⌥D accordingly).

Now all power of RubyMine debugger is available in your Hanami project. Sweet!

--

--