TextMate Tip: Fix the 'Run'-Command and Bundler

Recently, today to be precise, one team member got a Bundler::PathError while running any test cases from within TextMate. Running tests from the command line didn't caused any errors, though. Eventually this is really annoying as pressing ⌘-R is just too convenient to not use it. Digging deeper in the problem I remembered fixing that problem for me a while ago. Okay, that's great! So if you ever stumble across that problem here are the both snippets I used to fix this up:

#!/bin/sh

export RUBYLIB="$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}"
export TM_RUBY=$(type -p "${TM_RUBY:-ruby}")

cd "${TM_PROJECT_DIRECTORY:-$TM_DIRECTORY}"

"${TM_RUBY}" -KU -- "$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb"

The one above is to fix the Run-Command. Just open the Bundle Editor and select Commands in the drop down (or just use the ⌃⌥⌘-C shortcut to jump right there). Find the Run-Command and replace the content with the one above.

Eh, you're right, I talked about "both snippets" so here is the other one to fix the Run Focused Unit Test-Command (which is quite handy, at least for me). You should find that command entry right below the Run-Command. Just replace its content with the following code.

#!/bin/sh

export RUBYLIB="$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}"
export TM_RUBY=$(type -p "${TM_RUBY:-ruby}")

cd "${TM_PROJECT_DIRECTORY:-$TM_DIRECTORY}"

export RUBYLIB="$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}"
export TM_RUBY=$(type -p "${TM_RUBY:-ruby}")

"${TM_RUBY}" -KU -- "$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb" --name=

That's it. Now you're ready to go. Hope that helped. At least I will remember that one faster the next time, hopefully.

BTW: If you're using RVM be sure to have read their guide to integrate it with TextMate or you will just run right into the next problem ;-).

See you Space Cowboy ...
blog comments powered by Disqus
 
Fork me on GitHub