2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: CC-BY-SA-3.0
6 # As a convenience to the documentation writer, you can touch a file
7 # called 'no-sdk' in the 'doc' directory and it will suppress
8 # generating the documentation for the SDKs, which (the R docs
9 # especially) take a fair bit of time and slow down the edit-preview
15 task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html', 'sdk/java-v2/javadoc/index.html' ] do
16 vars = ['baseurl', 'arvados_cluster_uuid', 'arvados_api_host', 'arvados_workbench_host']
19 website.config.h[v] = ENV[v]
24 file "sdk/python/arvados/index.html" do |t|
25 if File.exists? "no-sdk"
30 STDERR.puts `epydoc --html --parse-only -o sdk/python/arvados ../sdk/python/arvados/ 2>&1`
33 puts "Warning: epydoc not found, Python documentation will not be generated".colorize(:light_red)
37 file "sdk/R/arvados/index.html" do |t|
38 if File.exists? "no-sdk"
45 Dir.mkdir("sdk/R/arvados")
47 cp('css/R.css', 'sdk/R/arvados')
49 Dir.chdir("../sdk/R/") do
50 STDERR.puts `Rscript createDoc.R README.Rmd #{tgt}/sdk/R/README.md 2>&1`
51 Dir.entries("man").each do |rd|
52 if rd[-3..-1] == ".Rd"
53 htmlfile = "#{rd[0..-4]}.html"
54 `R CMD Rdconv -t html man/#{rd} > #{tgt}/sdk/R/arvados/#{htmlfile}`
61 File.open("sdk/R/README.md", "r") do |rd|
62 File.open("sdk/R/index.html.md", "w") do |fn|
68 title: "R SDK Overview"
71 #{rd.read.gsub(/^```$/, "~~~").gsub(/^```(\w)$/, "~~~\\1")}
77 File.open("sdk/R/arvados/index.html.textile.liquid", "w") do |fn|
86 Copyright (C) The Arvados Authors. All rights reserved.
88 SPDX-License-Identifier: CC-BY-SA-3.0
94 docfiles.sort.each do |d|
95 fn.write("* \"#{d[0..-6]}\":#{d}\n")
100 puts "Warning: R not found, R documentation will not be generated".colorize(:light_red)
104 file "sdk/java-v2/javadoc/index.html" do |t|
105 if File.exists? "no-sdk"
112 puts "Warning: gradle not found, java sdk documentation will not be generated".colorize(:light_red)
116 Dir.chdir("../sdk/java-v2") do
117 STDERR.puts `gradle javadoc 2>&1`
119 puts `sed -i "s/@import.*dejavu.css.*//g" build/docs/javadoc/stylesheet.css`
122 cp_r("../sdk/java-v2/build/docs/javadoc", "sdk/java-v2")
126 puts "Warning: java not found, java sdk documentation will not be generated".colorize(:light_red)
130 task :linkchecker => [ :generate ] do
131 Dir.chdir(".site") do
134 system "linkchecker index.html --ignore-url='!file://'" or exit $?.exitstatus
136 puts "Warning: linkchecker not found, skipping run".colorize(:light_red)
142 rm_rf "sdk/python/arvados"
144 rm_rf "sdk/java-v2/javadoc"
147 require "zenweb/tasks"
148 load "zenweb-textile.rb"
149 load "zenweb-liquid.rb"
151 task :extra_wirings do
152 $website.pages["sdk/python/python.html.textile.liquid"].depends_on("sdk/python/arvados/index.html")