Ejemplo n.º 1
0
    def on_message(self, message):
        """Handshake with livereload.js

        1. client send 'hello'
        2. server reply 'hello'
        3. client send 'info'

        http://help.livereload.com/kb/ecosystem/livereload-protocol
        """
        message = ObjectDict(escape.json_decode(message))
        if message.command == 'hello':
            handshake = {}
            handshake['command'] = 'hello'
            protocols = message.protocols
            protocols.append(
                'http://livereload.com/protocols/2.x-remote-control')
            handshake['protocols'] = protocols
            handshake['serverName'] = 'livereload-tornado'
            self.send_message(handshake)

        if message.command == 'info' and 'url' in message:
            logging.info('Browser Connected: %s' % message.url)
            LiveReloadHandler.waiters.add(self)
            if not LiveReloadHandler._last_reload_time:
                if os.path.exists('Guardfile'):
                    logging.info('Reading Guardfile')
                    execfile('Guardfile', {})
                else:
                    logging.info('No Guardfile')
                    Task.add(os.getcwd())

                LiveReloadHandler._last_reload_time = time.time()
                logging.info('Start watching changes')
                if not Task.start(self.watch_tasks):
                    ioloop.PeriodicCallback(self.poll_tasks, 800).start()
Ejemplo n.º 2
0
    def on_message(self, message):
        """Handshake with livereload.js

        1. client send 'hello'
        2. server reply 'hello'
        3. client send 'info'

        http://help.livereload.com/kb/ecosystem/livereload-protocol
        """
        message = ObjectDict(escape.json_decode(message))
        if message.command == "hello":
            handshake = {}
            handshake["command"] = "hello"
            protocols = message.protocols
            protocols.append("http://livereload.com/protocols/2.x-remote-control")
            handshake["protocols"] = protocols
            handshake["serverName"] = "livereload-tornado"
            self.send_message(handshake)

        if message.command == "info" and "url" in message:
            logging.info("Browser Connected: %s" % message.url)
            LiveReloadHandler.waiters.add(self)
            if not LiveReloadHandler._last_reload_time:
                if os.path.exists("Guardfile"):
                    logging.info("Reading Guardfile")
                    execfile("Guardfile")
                else:
                    logging.info("No Guardfile")
                    Task.add(os.getcwd())

                LiveReloadHandler._last_reload_time = time.time()
                logging.info("Start watching changes")
                ioloop.PeriodicCallback(self.watch_tasks, 800).start()
Ejemplo n.º 3
0
    def on_message(self, message):
        """Handshake with livereload.js

        1. client send 'hello'
        2. server reply 'hello'
        3. client send 'info'

        http://help.livereload.com/kb/ecosystem/livereload-protocol
        """
        message = ObjectDict(escape.json_decode(message))
        if message.command == 'hello':
            handshake = {}
            handshake['command'] = 'hello'
            protocols = message.protocols
            protocols.append(
                'http://livereload.com/protocols/2.x-remote-control'
            )
            handshake['protocols'] = protocols
            handshake['serverName'] = 'livereload-tornado'
            self.send_message(handshake)

        if message.command == 'info' and 'url' in message:
            logging.info('Browser Connected: %s' % message.url)
            LiveReloadHandler.waiters.add(self)
            if not LiveReloadHandler._last_reload_time:
                if os.path.exists('Guardfile'):
                    logging.info('Reading Guardfile')
                    execfile('Guardfile')
                else:
                    logging.info('No Guardfile')
                    Task.add(os.getcwd())

                LiveReloadHandler._last_reload_time = time.time()
                logging.info('Start watching changes')
                ioloop.PeriodicCallback(self.watch_tasks, 800).start()
Ejemplo n.º 4
0
    def on_message(self, message):
        """Handshake with livereload.js

        1. client send 'hello'
        2. server reply 'hello'
        3. client send 'info'

        http://help.livereload.com/kb/ecosystem/livereload-protocol
        """
        message = ObjectDict(escape.json_decode(message))
        if message.command == 'hello':
            handshake = {}
            handshake['command'] = 'hello'
            protocols = message.protocols
            protocols.append(
                'http://livereload.com/protocols/2.x-remote-control'
            )
            handshake['protocols'] = protocols
            handshake['serverName'] = 'livereload-tornado'
            self.send_message(handshake)

        if message.command == 'info' and 'url' in message:
            send_notify('Browser Connected: %s' % message.url)
            LiveReloadHandler.waiters.add(self)
            if not LiveReloadHandler._watch_running:
                try:
                    execfile('Guardfile')
                except:
                    Task.add(os.getcwd())

                LiveReloadHandler._watch_running = True
                logging.info('Start watching changes')
                tornado.ioloop.PeriodicCallback(self.watch_tasks, 500).start()
Ejemplo n.º 5
0
#!/usr/bin/env python
from livereload.task import Task

Task.add('static/css/*.css')
Task.add('*.py')
Task.add('static/css/third_party/*.css')
Task.add('static/js/third_party/*.js')
Task.add('static/js/*.js')
Task.add('templates/*.html')
Task.add('templates/webpagetest/*.html')
Task.add('templates/gae-stats/*.html')

Ejemplo n.º 6
0
#!/usr/bin/env python
from livereload.task import Task

files = [
    '*.css',
    '*.less',
    '*.coffee',
    '*.js',
    '*.java',
    '*.scala.html',
    'conf/application.conf',
    'conf/routes',
    'project/Build.scala',
    'project/plugins.sbt',
    'project/build.properties',
]

for file in files:
    Task.add(file)
Ejemplo n.º 7
0
#!/usr/bin/env python
from livereload.task import Task
from livereload.compiler import shell

# You may have a different path, e.g. _source/
Task.add('source/', shell('make html'))

Ejemplo n.º 8
0
#!/usr/bin/env python
from livereload.task import Task

Task.add('static')
Task.add('templates')
Ejemplo n.º 9
0
#!/usr/bin/env python
from livereload.task import Task
 
Task.add('*.html')
Ejemplo n.º 10
0
#!/usr/bin/env python
from livereload.task import Task

Task.add('static/css/*.css')
Task.add('*.py')
Task.add('static/css/third_party/*.css')
Task.add('static/js/third_party/*.js')
Task.add('static/js/*.js')
Task.add('templates/*.html')
Task.add('templates/gae-stats/*.html')