Skip to content

Instantly share code, notes, and snippets.

@michaelglass
Last active December 30, 2015 02:29
Show Gist options
  • Save michaelglass/7763056 to your computer and use it in GitHub Desktop.
Save michaelglass/7763056 to your computer and use it in GitHub Desktop.
import sublime_plugin
import os
class RemoteTouch(sublime_plugin.EventListener):
def on_post_save(self, view):
file_name = view.file_name()
needle = "PATH_FOR_YOUR_APP" # change this
if needle in file_name:
project_root = view.window().folders()[0]
relative_path = file_name.replace(project_root + '/', "")
print("[RemoteTouch] file_name: " + file_name)
print("[RemoteTouch] project_root: " + project_root)
print("[RemoteTouch] relative_path: " + relative_path)
command = "ssh example.com 'cd /sites/your_site && touch " + relative_path + "'" # change this
print("[RemoteTouch] command: " + command)
print(os.system(command))
@michaelglass
Copy link
Author

put this file in ~/Library/Application Support/Sublime Text 3/Packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment