Last active
December 30, 2015 02:29
-
-
Save michaelglass/7763056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put this file in ~/Library/Application Support/Sublime Text 3/Packages