How do I run a Rails7 app including the js and css watchers in Rubymine ? Follow
I've set up a skeleton Rails 7 app using `esbuild` and `bootstrap` via
rails new mojoknows7 -j esbuild -css bootstrap
I used ruby 3.1.0 and after a bit of wrangling I got the app to work. It is supposed to be run in terminal via
which in turn runs
if ! command -v foreman &> /dev/null
echo "Installing foreman..."
gem install foreman
foreman start -f Procfile.dev
which then runs the following components (web, js, css):
web: bin/rails server -p 3000
js: yarn build --watch
css: yarn build:css --watch
From what I can tell, when I run the Rails server from within Rubymine, it only does the web part - how can I control all 3 components from within rubymine, so that when I start the 'server' all 3 are started and when I stop it all 3 are stopped?
Please sign in to leave a comment.
You can create a corresponding Run configuration to run Foreman (https://www.jetbrains.com/help/ruby/debug-foreman.html#create_config), will it cover your needs?
Thank you Olga - I tried that but I got "Gem executable not found" - could that be because I am using rvm ?
I got it working using just a "Shell Script" configuration and running bin/dev directly that way.
Patrick, could you please try specifying the arguments (like `start`) in the corresponding field below the one with the executable name. How does it go?
You can just create new shell script and point executable to your `~/your-rails-project/bin/dev` script. That works as is intended by the rails team, since `./bin/dev` executable is a shell script, not a Gem command. I attached a screenshot.
Thank you all - got it working as a script now !
I have some problems configuring this shell script in Windows with the repo source in WSL 2.
I can't find a valid "interpreter path" to use, and the "script path" must be absolute unfortunately so that means that I have to use the full path to the WSL filesystem which doesn't seem to work...
Well, I solved with a "Gem command" configuration like in this guide: https://www.jetbrains.com/help/ruby/debug-foreman.html
I had to put foreman in the Gemfile though:
This is the configuration:
I got the shell script to work but the debugger doesn't seem to attach. How do I get this to work and enable debugging?
Jdstanhope, it'd be great if you could submit a report on our tracker https://youtrack.jetbrains.com/issues/RUBY specifying your steps and providing if possible a project sample for reproduce.
Jdstanhope If you use the shell script, it can't attach a debugger because it doesn't know if it is a ruby process. These 2 things made it work seamlessly (including attaching the debugger) for me
1. Add Foreman in group development
2. Add a Gem command as a run configuration with the following arguments