Home Download Buy Blog Forum Support

calling SFTP method from Build System

calling SFTP method from Build System

Postby MartijnR on Fri Jun 15, 2012 4:00 pm

Hi,

I'm new to SublimeText but am liking what I've seen so far (was a Coda user before). My build processes are not very time-consuming and therefore I'd like to use a workflow where by I update documentation, minify js/css, etc upon each save. I'm using the onSaveBuild package for this.

I know I can set the SFTP package up to upload the current file on Save. However, since I'm also updating/creating other files upon save (documentation, minified js files), it would be great if I could call "Sync Local -> Remote..." as the final step in my Build process.

Is that possible and if so, can somebody please explain how?
MartijnR
 
Posts: 5
Joined: Thu Jun 14, 2012 11:34 pm

Re: calling SFTP method from Build System

Postby wbond on Sat Jun 16, 2012 12:27 am

If you look at the file Packages/SFTP/Side Bar.sublime-menu you will get info about the command names and how to pass paths to them. By default Sublime will fill in the paths parameter with an array of the selected paths.

We can then use this info combined with the API Reference to call any of the SFTP commands at any given time. Please note that the package uses sublime_plugin.WindowCommand as the base (as opposed to a TextCommand), so they need to be called from a window object and not a view object.

Here is some code that should do what you are looking for.

Code: Select all
sublime.active_window().run_command('sftp_sync_up', {paths: ['/path/to/your/folder']})
wbond
 
Posts: 528
Joined: Mon Feb 28, 2011 5:33 am

Re: calling SFTP method from Build System

Postby MartijnR on Sat Jun 16, 2012 1:28 am

Great! Thanks a lot. I'll delve into this.
MartijnR
 
Posts: 5
Joined: Thu Jun 14, 2012 11:34 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], TurnitinBot [Bot] and 24 guests