Skip to content

Instantly share code, notes, and snippets.

@hungrymedia
Last active December 16, 2015 23:19
Show Gist options
  • Save hungrymedia/5512955 to your computer and use it in GitHub Desktop.
Save hungrymedia/5512955 to your computer and use it in GitHub Desktop.
Sublime Text 'restart rails' plugin
# mild modification of http://git.io/7oalcQ
# save in ~/Library/Application Support/Sublime Text 2/Packages/User/
import sublime, sublime_plugin
import os, time
class Restart_railsCommand(sublime_plugin.TextCommand):
"""Touch tmp/restart.txt file in the rails project to restart app"""
def run(self, edit):
for folder in self.view.window().folders():
fname = os.path.join(str(folder), 'tmp', 'restart.txt')
if os.path.exists(fname):
os.utime(fname, None)
sublime.status_message('Successfully restarted rails app')
""" add the following to your User key bindings
{ "keys": ["ctrl+shift+r"], "command": "restart_rails" }
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment