docs.rake 1.06 KB
Newer Older
1 2 3 4 5
require 'launchy'

# --- Develop and public documentation ---
desc "Invoke sphinx 'make build' to generate docs."
task :builddocs, [:options] do |t, args|
6 7 8 9 10 11 12 13 14 15 16 17 18
    if args.options == 'dev'
        path = "docs/developer"
    elsif args.options == 'author'
        path = "docs/course_authors"
    elsif args.options == 'data'
        path = "docs/data"
    else
        path = "docs"
    end

    Dir.chdir(path) do
        sh('make html')
    end
19
    path = "docs"
20 21 22 23 24 25 26 27

    Dir.chdir(path) do
        sh('make html')
    end
end

desc "Show docs in browser (mac and ubuntu)."
task :showdocs, [:options] do |t, args|
28 29 30 31 32 33 34 35 36
    if args.options == 'dev'
        path = "docs/developer"
    elsif args.options == 'author'
        path = "docs/course_authors"
    elsif args.options == 'data'
        path = "docs/data"
    else
        path = "docs"
    end
37

38
    Launchy.open("#{path}/build/html/index.html")
39 40 41 42 43 44 45
end

desc "Build docs and show them in browser"
task :doc, [:options] =>  :builddocs do |t, args|
    Rake::Task["showdocs"].invoke(args.options)
end
# --- Develop and public documentation ---