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

# --- Develop and public documentation ---
desc "Invoke sphinx 'make build' to generate docs."
Julian Arni committed
5 6 7
task :builddocs, [:type, :quiet] do |t, args|
    args.with_defaults(:quiet => "quiet")
    if args.type == 'dev'
8
        path = "docs/developers"
Julian Arni committed
9
    elsif args.type == 'author'
10
        path = "docs/course_authors"
Julian Arni committed
11
    elsif args.type == 'data'
12 13 14 15 16 17
        path = "docs/data"
    else
        path = "docs"
    end

    Dir.chdir(path) do
Julian Arni committed
18 19 20
        if args.quiet == 'verbose'
            sh('make html quiet=false')
        else
21
            sh('make html quiet=true')
Julian Arni committed
22
        end
23
    end
24 25 26 27
end

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

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

desc "Build docs and show them in browser"
Julian Arni committed
42 43
task :doc, [:type, :quiet] =>  :builddocs do |t, args|
    Rake::Task["showdocs"].invoke(args.type, args.quiet)
44 45
end
# --- Develop and public documentation ---