Skip to content

Commit

Permalink
add manage.py command for runclient
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham42 committed Feb 22, 2014
1 parent 76b73ff commit 9210385
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
Empty file added client/__init__.py
Empty file.
16 changes: 2 additions & 14 deletions client/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import atexit

from service import Service
from watcher import Watcher
from client.service import Service
from client.watcher import Watcher
from utils import zip_paths


Expand Down Expand Up @@ -32,13 +30,3 @@ def on_change(self):
"""
stream = zip_paths(self.directory)
self.s.send(stream)


if __name__ == "__main__":
c = Client("less", ".")
c.start_watching()

@atexit.register
def on_exit():
if c:
c.stop_watching()
15 changes: 15 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from flask.ext.script import Manager
from precomp import app
import atexit


manager = Manager(app)
Expand All @@ -19,6 +20,20 @@ def hello():
"""This command says hello"""
print('hello')

@manager.command
def runclient(service, directory="."):
"""Runs the client for a type of processor on a given directory"""
from client.client import Client
print ("service arg: " + service)
if service is not None:
c = Client(service, directory)
c.start_watching()

@atexit.register
def on_exit():
print ("in after thing")
if c:
c.stop_watching()

if __name__ == '__main__':
manager.run()

0 comments on commit 9210385

Please sign in to comment.