chown venv dir in install script

set default ace editor options
lower font size on editor
This commit is contained in:
Matthew Scragg 2014-09-08 12:49:37 -05:00
parent f2f1e3f51e
commit 6459d6b842
5 changed files with 19 additions and 16 deletions

View file

@ -2,6 +2,7 @@
# Provision script created for Ubuntu 14.04 # Provision script created for Ubuntu 14.04
APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" APP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_USER="$( stat -c '%U' ${APP_DIR} )"
echo "Provisioning..." echo "Provisioning..."
@ -9,7 +10,7 @@ add-apt-repository -y ppa:chris-lea/node.js
apt-get update apt-get update
apt-get install -y python build-essential git libpcre3-dev python-software-properties \ apt-get install -y python build-essential git libpcre3-dev python-software-properties \
python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \ python-pip python-virtualenv python-dev pkg-config curl libxml2-dev libxslt1-dev zlib1g-dev \
libffi-dev nodejs screen node-cleancss libyaml-dev libffi-dev nodejs screen libyaml-dev
# Default cache is memoization # Default cache is memoization
@ -40,7 +41,9 @@ virtualenv .venv
source .venv/bin/activate source .venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
chown -R ${APP_USER}.${APP_USER} .venv
echo "Installing start scripts"
cat << EOF > /usr/local/bin/realms-wiki cat << EOF > /usr/local/bin/realms-wiki
#!/bin/bash #!/bin/bash
${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@" ${APP_DIR}/.venv/bin/python ${APP_DIR}/manage.py "\$@"

View file

@ -178,7 +178,10 @@ class Wiki():
meta_end = re.search("\n(\.{3}|\-{3})", content) meta_end = re.search("\n(\.{3}|\-{3})", content)
if not meta_end: if not meta_end:
return None return None
return yaml.safe_load(content[0:meta_end.start()]) try:
return yaml.safe_load(content[0:meta_end.start()])
except Exception as e:
return {'error': e.message}
def compare(self, name, old_sha, new_sha): def compare(self, name, old_sha, new_sha):
old = self.get_page(name, sha=old_sha) old = self.get_page(name, sha=old_sha)

View file

@ -87,7 +87,7 @@ body {
right: 0; right: 0;
bottom: 0; bottom: 0;
font-family: Inconsolata, monospace; font-family: Inconsolata, monospace;
font-size: 1.2em; font-size: 1.1em;
line-height: 1.3em; line-height: 1.3em;
} }

View file

@ -267,6 +267,9 @@ $(function () {
function initAce() { function initAce() {
editor = ace.edit("editor"); editor = ace.edit("editor");
editor.focus(); editor.focus();
editor.setOptions({
enableBasicAutocompletion: true
});
} }
function initUi() { function initUi() {
@ -274,9 +277,13 @@ $(function () {
fetchTheme(profile.theme, function () { fetchTheme(profile.theme, function () {
$theme.find('li > a[data-value="' + profile.theme + '"]').addClass('selected'); $theme.find('li > a[data-value="' + profile.theme + '"]').addClass('selected');
editor.setBehavioursEnabled(true);
editor.getSession().setUseWrapMode(true); editor.getSession().setUseWrapMode(true);
editor.setShowPrintMargin(false); editor.setShowPrintMargin(false);
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setShowInvisibles(true);
editor.renderer.setShowGutter(false);
editor.getSession().setMode('ace/mode/markdown'); editor.getSession().setMode('ace/mode/markdown');
editor.getSession().setValue(profile.currentMd || editor.getSession().getValue()); editor.getSession().setValue(profile.currentMd || editor.getSession().getValue());

View file

@ -3,7 +3,6 @@ Handlebars.registerHelper('well', function(options) {
return '<div class="well">' + options.fn(this) + '</div>'; return '<div class="well">' + options.fn(this) + '</div>';
}); });
Handlebars.registerPartial('item', '<table class="table table-bordered"><tr><td>{{ name }}<td><td></tr></table>')
/* © 2013 j201 /* © 2013 j201
* https://github.com/j201/meta-marked */ * https://github.com/j201/meta-marked */
@ -82,7 +81,7 @@ var MDR = {
return id; return id;
}); });
} }
//html = this.hook(html); this.hook();
return html; return html;
}, },
@ -98,15 +97,6 @@ var MDR = {
} }
}, },
hook: function(html) { hook: function() {
if (!this.doc.meta) {
return html;
}
try {
var template = Handlebars.compile(html);
return template(this.doc.meta);
} catch(e) {
return html;
}
} }
}; };