Skip to content

Instantly share code, notes, and snippets.

@b-turchyn
Created April 30, 2019 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b-turchyn/5ebaf893464bfa6eb635b7ed2df991f4 to your computer and use it in GitHub Desktop.
Save b-turchyn/5ebaf893464bfa6eb635b7ed2df991f4 to your computer and use it in GitHub Desktop.
Serve and automatically compile Sphinx documentation

Usage

  1. Create Gemfile and Guardfile in main directory
  2. Run bundle to install guard components
  3. Run guard to handle builds and server
source 'https://rubygems.org'
gem 'guard'
gem 'guard-shell'
gem 'guard-process'
# Compile changes; swap .md out for .rst if not running Markdown
guard :shell do
ignore /_build/
watch(/(.*).md/) {|m| `make html` }
end
# Serve the build directory using WEBrick
guard 'process', :name => 'server', :command => 'ruby -run -ehttpd _build/html/ -p8000', :stop_signal => "KILL" do
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment