Home Download Buy Blog Forum Support

Send to Transmit on Save for ST2

Send to Transmit on Save for ST2

Postby dmatarazzo on Sun Apr 10, 2011 2:03 pm

I use the DockSend feature of Transmit (a Mac FTP client) to mirror local files to the server, so I whipped up a little script to automatically send the current file to Transmit after a save.

Sometimes I work without a connection and don't want Transmit to start throwing errors, so the script first checks to see if I have Transmit running.

I keep all my mirrored projects in a specific folder, so it also checks if the file is inside that folder. You'd have to change this value to suit your needs, and you could also remove the checks if you wanted. You could also, of course, change Transmit to Interarchy or any other client with similar functionality.

It uses AppleScript so it's Mac-only.

This is my first time using Python, so forgive any sloppy coding.

Just past the code into a file called send_to_transmit.py and save it to Packages/User/

Code: Select all
import sublime, sublime_plugin
import os

class SendToTransmit(sublime_plugin.EventListener):
    def on_post_save(self, view):
        cmd = "ps ax | grep -v grep | grep Transmit"
        if os.system(cmd) == 0:
            if view.file_name().count('/Users/dmatarazzo/Mirrors/') > 0:
                cmd = """osascript -e 'tell app "Transmit" to open POSIX file """ + '"' + view.file_name() + '"' + "'"
                os.system(cmd)
                print "Sent file to Transmit"
dmatarazzo
 
Posts: 7
Joined: Sun Apr 10, 2011 1:43 pm

Re: Send to Transmit on Save for ST2

Postby jbrooksuk on Tue Apr 12, 2011 8:32 am

Awesome!

I need something like this for Windows, using Filezilla.

Omnomnom.
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Send to Transmit on Save for ST2

Postby brickattack on Fri Apr 22, 2011 5:20 pm

@n00ge and I worked on this a bit and have come up with one that runs on a key command and is directory independent

check it out here

https://github.com/brickattack/st2-send_to_transmit
@brickattack ST2 OS X
brickattack
 
Posts: 14
Joined: Fri Apr 22, 2011 5:19 pm

Re: Send to Transmit on Save for ST2

Postby Woodwater on Mon Jun 13, 2011 1:27 pm

Sweet! I've been looking for that. Thanks!
Woodwater
 
Posts: 22
Joined: Fri May 27, 2011 2:22 pm

Re: Send to Transmit on Save for ST2

Postby norman784 on Fri Jul 01, 2011 6:23 pm

It doesnt work for me on the version 2, I just clone the git to ~/Library/Application Support/Sublime Text 2/Packages/ i see all the files on the folder st2-send_to_transmit but when I press ctrl+super+f it doesnt upload (but with textmate it works).
norman784
 
Posts: 1
Joined: Fri Jul 01, 2011 6:20 pm

Re: Send to Transmit on Save for ST2

Postby charlesroper on Sun Jul 03, 2011 10:13 pm

jbrooksuk wrote:I need something like this for Windows, using Filezilla.


Take a look at the Keep Remote Directory up to Date feature of WinSCP (which, despite the name, also does FTP).
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 8 guests