Home Download Buy Blog Forum Support

Emulating the zend build

Emulating the zend build

Postby craigward on Wed Oct 05, 2011 9:10 am

Hi,

I have been using SublimeText2 on my Mac for about 6 months and love it. However I am now in a job where I am working with Zend and I can't get ST2 to emulate one of the tasks Zend Studio does.

In Zend Studio when I save a file it gets rsynced to a staging server using the inbuildt "Builders". I am sure ST2 can handle this but I am not sure how I can get it working.

This is what I need ST2 to do http://kb.zend.com/index.php?View=entry&EntryID=414

Any ideas?

Thanks in Advance,

Craig
craigward
 
Posts: 2
Joined: Wed Oct 05, 2011 9:05 am

Re: Emulating the zend build

Postby senzo on Wed Oct 05, 2011 11:17 am

I use something similar to sync modified files to an eclipse workspace. This is a stripped down version of the plugin i use. This would be executed after every save, even if the file you saved is not from the project! You could also make a build system. The authentication is not included in this sample.

Code: Select all
import sublime, sublime_plugin

class DeployOnSaveCommand(sublime_plugin.EventListener):
  def on_post_save(self, view):

    import subprocess
    # The shell script to deploy the project to the server
    syncProject = """rsync --recursive --times --perms --exclude ".*" /path/to/project/ /path/to/server/"""
    # execute the shell scripts
    subprocess.call([syncProject],shell=True)

    sublime.status_message("Project deployed")
   
senzo
 
Posts: 106
Joined: Tue May 24, 2011 9:17 am

Re: Emulating the zend build

Postby craigward on Wed Oct 05, 2011 12:53 pm

Hi, and thanks for the reply.

I am not sure how I get it to work on save, the arguments I need are:

-vcrz
--delete-after
--exclude-from=.rsync-exclude # <-- This is a list of file to exclude
.
<myusername>@10.0.0.248:projects/<project_name>

I am not even sure if the code is running, how do I check, I do not get the Project deployed message in the console.

Do you know how I can get this to run. I can't figure it out.

Thanks again.
craigward
 
Posts: 2
Joined: Wed Oct 05, 2011 9:05 am

Re: Emulating the zend build

Postby senzo on Thu Oct 06, 2011 6:50 am

Under your "Packages" Directory (Preferences > Browse Packages) create a Directory and give it the plugin name. Inside of it create a .py file and give it the plugin name. This code should than print Hello to your console on save:
Code: Select all
import sublime, sublime_plugin

class HelloOnSaveCommand(sublime_plugin.EventListener):
  def on_post_save(self, view):
    print("Hello")


Your rsync statement has to be the same as you would use in the Terminal. You can test it there first.
senzo
 
Posts: 106
Joined: Tue May 24, 2011 9:17 am


Return to General Discussion

Who is online

Users browsing this forum: danpyq, Exabot [Bot], Google [Bot] and 23 guests