RubyMine can also be used as the merge tool. To make that work on my macOS Monterey system, I created a new Bash script at /usr/local/bin/rubymine-merge
(based in part on the rubymine
script provided by JetBrains Toolbox) with the following code:
#!/usr/bin/env bash
declare -- wait="-W"
bundle exec rubocop --server -A "$1"
open -na "$HOME/Library/Application Support/JetBrains/Toolbox/apps/RubyMine/ch-0/222.3739.56/RubyMine 2022.2 EAP.app/Contents/MacOS/rubymine" $wait --args merge "$2" "$1" "$2"
After this, I was able to invoke the Rails update script as follows:
THOR_MERGE=rubymine-merge bin/rails app:update
This is working as of RubyMine 2022.2.1 in mid-August of 2022.
The Rails update script seems to require that the merge tool behave as if it had received a --wait
parameter, because after the last merge the script deletes all temporary files. Passing --wait
as a command-line parameter seems problematic with the 2022.2 version of the command-line script, so I hard-coded the -W
on line 3.
I also inserted a call to rubocop on line 5 so that the proposed changes from the Rails app:update script would already be aligned with the standards for this project. Skip that part if it's not meeting your needs. I had to use bundle exec rubocop
instead of bin/rubocop
because the Rails app:update script is not always running in the context of the root directory of your project.
It is suboptimal for this script be separate from the /usr/local/bin/rubymine
script that is generated by JetBrains Toolbox. Every time a new version of RubyMine is installed, the path to the actual RubyMine application can change.