diff --git a/.codespellignore b/.codespellignore index 2b565a90..befdeae9 100644 --- a/.codespellignore +++ b/.codespellignore @@ -19,5 +19,6 @@ (0x5655, "Shenzhen CAS VU Technologies Co., Ltd."), (function($){var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};$.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';} return'{'+pairs.join(',')+'}';}};$.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(src){return eval('('+src+')');};$.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(src){var filtered=src.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered)){return eval('('+src+')');}else{throw new SyntaxError('Error parsing JSON, source is not valid.');}};$.quoteString=function(string){if(string.match(escapeable)){return'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;} + - provider: gae --passin \ 'link': 'http://www.ljusdesign.se/produkt/styrning/adhoc-dmx-splitter-din/', diff --git a/.gitignore b/.gitignore index 7cc28a30..e6251c38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ +*rdm*.json *.bak *.old *.pyc *.save *.swp +api_key.py +credentials.tar.gz node_modules -index.yaml .idea static/libs static/js/rdm.js diff --git a/.travis-ci.sh b/.travis-ci.sh index 57aae890..60830b8e 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -73,4 +73,7 @@ elif [[ $TASK = 'pychecker-wip' ]]; then PYTHONPATH=./:$PYTHONPATH export PYTHONPATH pychecker --quiet --limit 500 --blacklist $PYCHECKER_BLACKLIST $(find ./ -name "*.py" | xargs) +elif [[ $TASK = 'deploy' ]]; then + grunt --verbose bower + grunt --verbose compress fi diff --git a/.travis.yml b/.travis.yml index 72dff21f..cbecbfb5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,13 @@ cache: - $HOME/.npm - $HOME/.cache/pip +before_install: + - if [[ "$TASK" == "deploy" ]]; then openssl aes-256-cbc -K $encrypted_7eede60d6b12_key -iv $encrypted_7eede60d6b12_iv -in credentials.tar.gz.enc -out credentials.tar.gz -d && tar -xzf credentials.tar.gz; fi + install: - if [ "$TASK" = "nosetests" -o "$TASK" = "flake8" -o "$TASK" = "flake8-wip" ]; then pip install json-spec; fi - - if [ "$TASK" = "karma" -o "$TASK" = "lint" -o "$TASK" = "closure-compiler" ]; then npm install -g grunt-cli; fi - - if [ "$TASK" = "karma" -o "$TASK" = "lint" -o "$TASK" = "closure-compiler" ]; then npm install; fi + - if [ "$TASK" = "karma" -o "$TASK" = "lint" -o "$TASK" = "closure-compiler" -o "$TASK" = "deploy" ]; then npm install -g grunt-cli; fi + - if [ "$TASK" = "karma" -o "$TASK" = "lint" -o "$TASK" = "closure-compiler" -o "$TASK" = "deploy" ]; then npm install; fi - if [ "$TASK" = "flake8" -o "$TASK" = "flake8-wip" ]; then pip install flake8; fi # If this causes SSL errors, then Sourceforge is probably in disaster recovery mode and needing Javascript. Could switch to a specific mirror, e.g. kent.dl.sourceforge.net - if [ "$TASK" = "pychecker" -o "$TASK" = "pychecker-wip" ]; then pip install http://sourceforge.net/projects/pychecker/files/pychecker/0.8.19/pychecker-0.8.19.tar.gz/download; fi @@ -82,6 +85,21 @@ matrix: arch: arm64 python: "2.7" env: TASK='pychecker-wip' + - stage: deploy + os: linux + dist: trusty + env: TASK='deploy' + deploy: + - provider: gae + edge: true + keyfile: peter-ola-rdm-app-51be81f8c2c3.json + project: peter-ola-rdm-app + config: + - app.yaml + - index.yaml + on: + all_branches: true + allow_failures: - os: linux dist: trusty diff --git a/README.md b/README.md index ce284f62..c5b09e6a 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ respective file in the `data/` directory. ### Deploying to App Engine -Before deploying to App Engine run: +Before deploying to App Engine run (grunt bower if you hadn't already, and): ```bash grunt compress ``` diff --git a/app.yaml b/app.yaml index 81179a72..bb7e457a 100644 --- a/app.yaml +++ b/app.yaml @@ -1,6 +1,6 @@ -application: "olp-rdm-staging" +#application: "olp-rdm-staging" #application: "rdmprotocol-hrd" -version: 1 +#version: 1 runtime: python27 api_version: 1 threadsafe: no diff --git a/common.py b/common.py index 487f4126..b6245166 100644 --- a/common.py +++ b/common.py @@ -22,6 +22,7 @@ import logging import memcache_keys import textwrap +from google.appengine.api import app_identity from google.appengine.api import mail from google.appengine.api import memcache from google.appengine.ext import webapp @@ -136,15 +137,20 @@ def MaybeSendEmail(new_responder_count): query = UploadedResponderInfo.all() query.filter('processed = ', False) if query.count() == new_responder_count: + is_live_site = (app_identity.get_application_id() == "rdmprotocol-hrd") message = mail.EmailMessage( - sender='RDM Site ', + sender=('%sRDM Site ' % + (("" if is_live_site else ( + app_identity.get_application_id() + " ")), + app_identity.get_application_id())), subject='Pending Moderation Requests', to='', ) message.body = textwrap.dedent("""\ There are new responders in the moderation queue. - Please visit http://rdm.openlighting.org/admin/moderate_responder_data - """) + Please visit http://%s/admin/moderate_responder_data + """ % ("rdm.openlighting.org" if is_live_site else ( + app_identity.get_application_id() + ".appspot.com"))) message.send() diff --git a/credentials.tar.gz.enc b/credentials.tar.gz.enc new file mode 100644 index 00000000..8563a622 Binary files /dev/null and b/credentials.tar.gz.enc differ diff --git a/index.yaml b/index.yaml new file mode 100644 index 00000000..4e5738e3 --- /dev/null +++ b/index.yaml @@ -0,0 +1,49 @@ +indexes: + +# AUTOGENERATED + +# This index.yaml is automatically updated whenever the dev_appserver +# detects that a new type of query is run. If you want to manage the +# index.yaml file manually, remove the above marker line (the line +# saying "# AUTOGENERATED"). If you want to manage some indexes +# manually, move them above the marker line. The index.yaml file is +# automatically uploaded to the admin console when you next deploy +# your application using appcfg.py. + +- kind: Pid + properties: + - name: draft + - name: manufacturer + - name: pid_id + +- kind: Pid + properties: + - name: manufacturer + - name: name + +- kind: Product + properties: + - name: class + - name: image_url + direction: desc + +- kind: Product + properties: + - name: class + - name: manufacturer + - name: name + +- kind: ProductTag + properties: + - name: product_type + - name: label + +- kind: Responder + properties: + - name: manufacturer + - name: device_model_id + +- kind: Responder + properties: + - name: manufacturer + - name: model_description