voterunner

quick and dirty votes and discussions
git clone https://git.ce9e.org/voterunner.git

commit
977af245e2e7ed20baddc9bc5cd230eec7922aea
parent
f6bf15f4ea2078e3e4edaf57d54ad2700ace9b5e
Author
Tobias Bengfort <tobias.bengfort@liqd.de>
Date
2016-09-15 14:41
strip watch.py to only watch static files

this should remove the python3 incompatibility

Diffstat

M bin/watch.py 41 ++++++++++-------------------------------
M watch_requirements.txt 1 -

2 files changed, 10 insertions, 32 deletions


diff --git a/bin/watch.py b/bin/watch.py

@@ -6,47 +6,26 @@
    6     6 from __future__ import print_function
    7     7 
    8     8 from livereload import Server, shell
    9    -1 import formic
   10     9 
   11    -1 EXCLUDES = ['**/vendor/**', '**/node_modules/**', '**/data/**']
   12    -1 UNCOMPILED_FILES = formic.FileSet(include=['**.css', '**.html', '**.md'], exclude=EXCLUDES)
   13    -1 JS_APP_FILES = formic.FileSet(include=['**.js'], exclude=EXCLUDES +['/app.js', '/static/voterunner.js'])
   14    -1 COMBINED_JS_APP_FILES = formic.FileSet(include=['/static/voterunner.js'])
   15    -1 NODE_APP_FILES = formic.FileSet(include=['app.js'])
   16    -1 SCSS_FILES = formic.FileSet(include=['**.scss'], exclude=EXCLUDES)
   17    -1 CSS_FILES = formic.FileSet(include=['**.css'], exclude=EXCLUDES)
   -1    10 UNCOMPILED_FILES = ['static/*.js', 'static/*.css', 'README.md']
   -1    11 JS_SRC_FILES = ['static/src/*.js']
   -1    12 CSS_SRC_FILES = ['static/scss/*.scss']
   18    13 
   19    14 server = Server()
   20    15 
   -1    16 
   21    17 def watch(file_set, shell_command=None, delay=None):
   22    18     for path in file_set:
   23    19         server.watch(path, shell_command, delay=delay)
   24    20 
   -1    21 
   25    22 def show(file_set):
   26    23     map(print, file_set)
   27    24 
   28    -1 # show(NODE_APP_FILES)
   29    -1 
   30    -1 watch(JS_APP_FILES, shell('echo FIXME: how does the combining work? dependency missing?'), delay='forever')
   31    -1 watch(COMBINED_JS_APP_FILES)
   32    -1 watch(UNCOMPILED_FILES)
   33    -1 watch(SCSS_FILES, shell('echo FIXME: which scss compilere shold be used? dependency missing?'), delay='forever')
   34    -1 watch(CSS_FILES)
   35    -1 
   36    -1 shell('pg_ctl start -w -D data/postgres -o "-h localhost" -l /dev/null')()
   37    -1 
   38    -1 import os
   39    -1 SERVER_SETTINGS = dict(
   40    -1     PORT='5000',
   41    -1     DATABASE_URL='postgresql://%s:@localhost/voterunner' % os.environ['USER'],
   42    -1 )
   43    -1 ENV = ' '.join(map('='.join, SERVER_SETTINGS.items()))
   44    -1 NODE_COMMAND = shell('killall node; %(ENV)s nohup node app.js > /dev/null 2>&1 &' % locals(), shell='/bin/sh')
   45    -1 NODE_COMMAND()
   46    -1 watch(NODE_APP_FILES, NODE_COMMAND, delay=1)
   47    25 
   48    -1 server.serve(liveport=35729)
   -1    26 if __name__ == '__main__':
   -1    27     watch(JS_SRC_FILES, shell('make static/voterunner.js static/markdown.js'))
   -1    28     watch(CSS_SRC_FILES, shell('make static/style.css'))
   -1    29     watch(UNCOMPILED_FILES)
   49    30 
   50    -1 # Killing happens automatically
   51    -1 # shell('pg_ctl stop -D data/postgres')()
   52    -1 # shell('killall node')()
   -1    31     server.serve(liveport=35729)

diff --git a/watch_requirements.txt b/watch_requirements.txt

@@ -1,2 +1 @@
    1    -1 formic  # only python2 compatibile
    2     1 livereload