Restarting thin or passenger Rails server from Vim
I've set up Nginx with Phusion Passenger to run my Rails apps in a development environment, as opposed to running
rails server in a terminal every time. Setting the rails environment variable to "development" means that many code changes can be automatically integrated without a server restart, but every so often a full restart is required.
This involves touching the _tmp/restart.txt _file in the rails app directory. As I spend all my time working in Vim, I created a handy function to do it for me:
All you do is run
:RestartRails, and it touches the restart file. It assumes that your rails app directory is the current working directory in vim (
:pwd gives you that, and
:cd ... changes it). If you want to restart a different rails app, run