Example #1
0
    reqs = ssl.CERT_OPTIONAL

ssl_opts = None
if tornado.options.options.secure:
    ssl_opts = dict(certfile="butterfly.crt", keyfile="butterfly.key",
                    cert_reqs=reqs, ca_certs="butterflyca.crt")

http_server = tornado.httpserver.HTTPServer(application, ssl_options=ssl_opts)
http_server.listen(
    tornado.options.options.port, address=tornado.options.options.host)

url = "http%s://%s:%d/*" % ("s" if tornado.options.options.secure else "",
                            tornado.options.options.host,
                            tornado.options.options.port)

# This is for debugging purpose
try:
    from wsreload.client import sporadic_reload, watch
except ImportError:
    log.debug('wsreload not found')
else:
    sporadic_reload({'url': url})

    files = ['butterfly/static/javascripts/',
             'butterfly/static/stylesheets/',
             'butterfly/templates/']
    watch({'url': url}, files, unwatch_at_exit=True)

log.info('Starting loop')
ioloop.start()
Example #2
0
File: dev.py Project: B-Rich/wdb
commands = [
    'coffee ' +
    ' -wc -o wdb_server/static/javascripts/ ' +
    ' '.join(glob('wdb_server/static/coffees/*.coffee')),
    'compass watch wdb_server/static'
]


process = {}
for cmd in commands:
    print('Lauching %s' % cmd)
    process[cmd] = Popen(shlex.split(cmd))

files = ['wdb_server/static/javascripts/', 'wdb_server/static/stylesheets/',
         'wdb_server/templates/']
watch({'url': 'http://localhost:1984/*'}, files, unwatch_at_exit=True)

call(['curl', 'http://localhost:1984/self'])

try:
    while len(process):
        for cmd, proc in list(process.items()):
            if proc.poll():
                print('%s has terminated.' % cmd)
                process.pop(cmd)
        time.sleep(0.1)
    print('All children are dead. Time to go.')

except KeyboardInterrupt:
    print('\nGot [ctrl]+[c]')
    for cmd, proc in process.items():
Example #3
0
elif tornado.options.options.secure:
    reqs = ssl.CERT_OPTIONAL

ssl_opts = None
if tornado.options.options.secure:
    ssl_opts = dict(certfile="butterfly.crt", keyfile="butterfly.key", \
	cert_reqs=reqs, ca_certs="butterflyca.crt")

http_server = tornado.httpserver.HTTPServer(application, ssl_options=ssl_opts)
http_server.listen(
    tornado.options.options.port, address=tornado.options.options.host)

url = "http%s://%s:%d/*" % ( "s" if tornado.options.options.secure else "",
    tornado.options.options.host, tornado.options.options.port)

# This is for debugging purpose
try:
    from wsreload.client import sporadic_reload, watch
except ImportError:
    log.debug('wsreload not found')
else:
    sporadic_reload({'url': url})

    files = ['butterfly/static/javascripts/',
             'butterfly/static/stylesheets/',
             'butterfly/templates/']
    watch({'url': url}, files, unwatch_at_exit=True)

log.debug('Starting loop')
ioloop.start()
Example #4
0
commands = [
    'coffee ' + ' -wc -o wdb_server/static/javascripts/ ' +
    ' '.join(glob('wdb_server/static/coffees/*.coffee')),
    'compass watch wdb_server/static'
]

process = {}
for cmd in commands:
    print('Lauching %s' % cmd)
    process[cmd] = Popen(shlex.split(cmd))

files = [
    'wdb_server/static/javascripts/', 'wdb_server/static/stylesheets/',
    'wdb_server/templates/'
]
watch({'url': 'http://localhost:1984/*'}, files, unwatch_at_exit=True)

call(['curl', 'http://localhost:1984/self'])

try:
    while len(process):
        for cmd, proc in list(process.items()):
            if proc.poll():
                print('%s has terminated.' % cmd)
                process.pop(cmd)
        time.sleep(0.1)
    print('All children are dead. Time to go.')

except KeyboardInterrupt:
    print('\nGot [ctrl]+[c]')
    for cmd, proc in process.items():
Example #5
0
    description='Reload all tabs matching query through websocket',
    prog='wsreload',
    parents=(chrome_parser,))

parser.add_argument('-H', '--host', dest='host', type=str, default='127.0.0.1')
parser.add_argument('-P', '--port', dest='port', type=int, default=50637)
parser.add_argument('-E', '--endpoint', dest='endpoint',
                    type=str, default='wsreload')

parser.add_argument(
    '--watch', dest='watch', nargs='+',
    help='Tell the server to watch files '
    'and reload according to the other options')

parser.add_argument(
    '--unwatch', dest='unwatch',  nargs='+',
    help='Tell the server to unwatch the following files')

query, _ = chrome_parser.parse_known_args()
query = dict(filter(lambda x: x[1] is not None, vars(query).items()))

opts = parser.parse_args()


if opts.watch:
    watch(query, opts.watch, opts.host, opts.port, opts.endpoint)
elif opts.unwatch:
    unwatch(opts.unwatch, opts.host, opts.port, opts.endpoint)
else:
    sporadic_reload(query, opts.host, opts.port, opts.endpoint)
Example #6
0
    description='Reload all tabs matching query through websocket',
    prog='wsreload',
    parents=(chrome_parser,))

parser.add_argument('-H', '--host', dest='host', type=str, default='127.0.0.1')
parser.add_argument('-P', '--port', dest='port', type=int, default=50637)
parser.add_argument('-E', '--endpoint', dest='endpoint',
                    type=str, default='wsreload')

parser.add_argument(
    '--watch', dest='watch', nargs='+',
    help='Tell the server to watch files '
    'and reload according to the other options')

parser.add_argument(
    '--unwatch', dest='unwatch',  nargs='+',
    help='Tell the server to unwatch the following files')

query, _ = chrome_parser.parse_known_args()
query = dict(filter(lambda x: x[1] is not None, vars(query).items()))

opts = parser.parse_args()


if opts.watch:
    watch(query, opts.watch, opts.host, opts.port, opts.endpoint)
elif opts.unwatch:
    unwatch(opts.unwatch, opts.host, opts.port, opts.endpoint)
else:
    sporadic_reload(query, opts.host, opts.port, opts.endpoint)