1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
Dustin e1df8d201c ci: Add Jenkins pipeline 2018-07-26 18:28:43 -05:00
Dustin ed39f974dc Add requirements.txt 2018-07-26 18:21:36 -05:00
Dustin 190c63c594 site: Specify UTF-8 encoding for songquotes
In some cases, the default codec used by PyYAML is not UTF-8, so loading
the song quotes database fails. Using the `codecs.open` helper function
ensures that the contents of the file are always read with the correct
character set.
2018-07-26 18:19:52 -05:00
5 changed files with 31 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/dist/

16
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,16 @@
pipeline {
agent any
environment {
PUBLISH_HOST = 'web0.pyrocufflink.blue'
PUBLISH_USER = 'webapp.dchwww'
}
stages {
stage('Publish') {
steps {
sh '. ci/publish.sh'
}
}
}
}

8
ci/publish.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
rsync -rti . ${PUBLISH_USER}@${PUBLISH_HOST}: \
--exclude dist/ --exclude .git
rsync -rti dist/ ${PUBLISH_USER}@${PUBLISH_HOST}:wheelhouse \
--include '*.whl' --exclude '**'
ssh ${PUBLISH_USER}@${PUBLISH_HOST} \
venv/bin/pip install --no-index -f wheelhouse -r requirements.txt

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
Milla>=0.3
Jinja2>=2.9
PyYAML>=3.10

View File

@ -1,5 +1,6 @@
from milla.dispatch import routing
from webob import acceptparse
import codecs
import jinja2
import milla
import os
@ -24,7 +25,8 @@ env = jinja2.Environment(
)
with open(os.path.join(os.path.dirname(__file__), 'songquotes.yml')) as f:
songquotes = os.path.join(os.path.dirname(__file__), 'songquotes.yml')
with codecs.open(songquotes, 'r', encoding='utf-8') as f:
songquotes = yaml.load(f, Loader=YamlLoader)