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
12 # To generate and view the documentation locally, run this command
14 # rake && sensible-browser .site/index.html
18 # baseurl=http://localhost:8000 rake && rake run
20 # and then visit http://localhost:8000 in a browser.
27 @binary_files = %w[png jpg gif eot svg ttf woff2? ico pdf m4a t?gz xlsx]
31 task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html', 'sdk/java-v2/javadoc/index.html' ] do
32 vars = ['baseurl', 'arvados_cluster_uuid', 'arvados_api_host', 'arvados_workbench_host']
33 if ! ENV.key?('baseurl') || ENV['baseurl'] == ""
34 if !ENV.key?('WORKSPACE') || ENV['WORKSPACE'] == ""
35 puts "The `baseurl` variable was not specified and the `WORKSPACE` environment variable is not set. Defaulting `baseurl` to file://#{pwd}/.site"
36 ENV['baseurl'] = "file://#{pwd}/.site/"
38 puts "The `baseurl` variable was not specified, defaulting to a value derived from the `WORKSPACE` environment variable"
39 ENV['baseurl'] = "file://#{ENV['WORKSPACE']}/doc/.site/"
44 website.config.h[v] = ENV[v]
49 file ["install/new_cluster_checklist_Azure.xlsx", "install/new_cluster_checklist_AWS.xlsx"] do |t|
53 file "sdk/python/arvados/index.html" do |t|
54 if ENV['NO_SDK'] || File.exists?("no-sdk")
59 STDERR.puts `pdoc --html -o sdk/python ../sdk/python/arvados/ 2>&1`
62 puts "Warning: pdoc3 not found, Python documentation will not be generated".colorize(:light_red)
66 file "sdk/R/arvados/index.html" do |t|
67 if ENV['NO_SDK'] || File.exists?("no-sdk")
74 Dir.mkdir("sdk/R/arvados")
76 cp('css/R.css', 'sdk/R/arvados')
78 Dir.chdir("../sdk/R/") do
79 STDERR.puts `Rscript createDoc.R README.Rmd #{tgt}/sdk/R/README.md 2>&1`
80 Dir.entries("man").each do |rd|
81 if rd[-3..-1] == ".Rd"
82 htmlfile = "#{rd[0..-4]}.html"
83 `R CMD Rdconv -t html man/#{rd} > #{tgt}/sdk/R/arvados/#{htmlfile}`
90 File.open("sdk/R/README.md", "r") do |rd|
91 File.open("sdk/R/index.html.md", "w") do |fn|
97 title: "R SDK Overview"
100 #{rd.read.gsub(/^```$/, "~~~").gsub(/^```(\w)$/, "~~~\\1")}
106 File.open("sdk/R/arvados/index.html.textile.liquid", "w") do |fn|
115 Copyright (C) The Arvados Authors. All rights reserved.
117 SPDX-License-Identifier: CC-BY-SA-3.0
123 docfiles.sort.each do |d|
124 fn.write("* \"#{d[0..-6]}\":#{d}\n")
129 puts "Warning: R not found, R documentation will not be generated".colorize(:light_red)
133 file "sdk/java-v2/javadoc/index.html" do |t|
134 if ENV['NO_SDK'] || File.exists?("no-sdk")
141 puts "Warning: gradle not found, java sdk documentation will not be generated".colorize(:light_red)
145 Dir.chdir("../sdk/java-v2") do
146 STDERR.puts `gradle javadoc 2>&1`
148 puts `sed -i "s/@import.*dejavu.css.*//g" build/docs/javadoc/stylesheet.css`
151 cp_r("../sdk/java-v2/build/docs/javadoc", "sdk/java-v2")
155 puts "Warning: java not found, java sdk documentation will not be generated".colorize(:light_red)
159 task :linkchecker => [ :generate ] do
160 Dir.chdir(".site") do
163 # we need --check-extern to check relative links, weird but true
164 system "linkchecker index.html --check-extern --ignore-url='!file://'" or exit $?.exitstatus
166 puts "Warning: linkchecker not found, skipping run".colorize(:light_red)
171 task :import_vscode_training do
173 rm_rf "arvados-vscode-cwl-training"
174 `git clone https://github.com/arvados/arvados-vscode-cwl-training`
175 githash = `git --git-dir arvados-vscode-cwl-training/.git log -n1 --format=%H HEAD`
176 File.open("cwl/arvados-vscode-training.html.md.liquid", "w") do |fn|
177 File.open("arvados-vscode-cwl-training/README.md", "r") do |rd|
181 navsection: userguide
182 title: "Developing CWL Workflows with VSCode"
185 Copyright (C) The Arvados Authors. All rights reserved.
187 SPDX-License-Identifier: CC-BY-SA-3.0
189 Imported from https://github.com/arvados/arvados-vscode-cwl-training
198 rm_rf "arvados-vscode-cwl-training"
203 rm_rf "sdk/python/arvados"
205 rm_rf "sdk/java-v2/javadoc"
208 require "zenweb/tasks"
209 load "zenweb-textile.rb"
210 load "zenweb-liquid.rb"
211 load "zenweb-fix-body.rb"
213 task :extra_wirings do
214 $website.pages["sdk/python/python.html.textile.liquid"].depends_on("sdk/python/arvados/index.html")