Add new livereload server for docs

This commit is contained in:
Adrian Sampson 2016-01-25 13:19:26 -08:00
parent 5f8e710e07
commit 4634c7a9b8
3 changed files with 5 additions and 23 deletions

View file

@ -38,10 +38,6 @@ help:
@echo " linkcheck to check all external links for integrity" @echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " doctest to run all doctests embedded in the documentation (if enabled)"
# My magical rebuilding, Safari-reloading auto target.
auto:
watchmedo shell-command --patterns='*.rst' --ignore-pattern='_build/*' --recursive --command='if [ "$${watch_event_type}" == "created" -o "$${watch_event_type}" == "modified" ]; then make html ; osascript -l JavaScript refresh_safari.js; fi' --wait
clean: clean:
-rm -rf $(BUILDDIR)/* -rm -rf $(BUILDDIR)/*

View file

@ -1,19 +0,0 @@
var safari = Application('com.apple.Safari');
for (var i = 0; i < safari.windows.length; ++i) {
var win = safari.windows[i];
var tabs = win.tabs;
if (Object.keys(tabs).length) {
for (var j = 0; j < win.tabs.length; ++j) {
var tab = win.tabs[j];
var url = tab.url();
if (url.indexOf("file:") == 0) {
// A local file URL.
safari.doJavaScript("location.reload();", { in: tab });
console.log(url);
}
}
}
}
'done';

5
docs/serve.py Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env python
from livereload import Server, shell
server = Server()
server.watch('*.rst', shell('make html'))
server.serve(root='_build/html')