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 raise unless system("python3", "setup.py", "build",
60 chdir: "../sdk/python", out: :err)
61 raise unless system("pdoc", "--html", "-o", "sdk/python", "../sdk/python/build/lib/arvados/",
64 puts "Warning: pdoc3 not found, Python documentation will not be generated".colorize(:light_red)
68 file "sdk/R/arvados/index.html" do |t|
69 if ENV['NO_SDK'] || File.exists?("no-sdk")
76 Dir.mkdir("sdk/R/arvados")
78 cp('css/R.css', 'sdk/R/arvados')
80 Dir.chdir("../sdk/R/") do
81 Dir.entries("man").each do |rd|
82 if rd[-3..-1] == ".Rd"
83 htmlfile = "#{rd[0..-4]}.html"
84 `R CMD Rdconv -t html man/#{rd} > #{tgt}/sdk/R/arvados/#{htmlfile}`
91 File.open("../sdk/R/README.md", "r") do |rd|
92 File.open("sdk/R/index.html.md", "w") do |fn|
98 title: "R SDK Overview"
107 File.open("sdk/R/arvados/index.html.textile.liquid", "w") do |fn|
116 Copyright (C) The Arvados Authors. All rights reserved.
118 SPDX-License-Identifier: CC-BY-SA-3.0
124 docfiles.sort.each do |d|
125 fn.write("* \"#{d[0..-6]}\":#{d}\n")
130 puts "Warning: R not found, R documentation will not be generated".colorize(:light_red)
134 file "sdk/java-v2/javadoc/index.html" do |t|
135 if ENV['NO_SDK'] || File.exists?("no-sdk")
142 puts "Warning: gradle not found, java sdk documentation will not be generated".colorize(:light_red)
146 Dir.chdir("../sdk/java-v2") do
147 STDERR.puts `gradle javadoc 2>&1`
149 puts `sed -i "s/@import.*dejavu.css.*//g" build/docs/javadoc/stylesheet.css`
152 cp_r("../sdk/java-v2/build/docs/javadoc", "sdk/java-v2")
156 puts "Warning: java not found, java sdk documentation will not be generated".colorize(:light_red)
160 task :linkchecker => [ :generate ] do
161 Dir.chdir(".site") do
164 # we need --check-extern to check relative links, weird but true
165 system "linkchecker index.html --check-extern --ignore-url='!file://'" or exit $?.exitstatus
167 puts "Warning: linkchecker not found, skipping run".colorize(:light_red)
172 task :import_vscode_training do
174 rm_rf "arvados-vscode-cwl-training"
175 `git clone https://github.com/arvados/arvados-vscode-cwl-training`
176 githash = `git --git-dir arvados-vscode-cwl-training/.git log -n1 --format=%H HEAD`
177 File.open("cwl/arvados-vscode-training.html.md.liquid", "w") do |fn|
178 File.open("arvados-vscode-cwl-training/README.md", "r") do |rd|
182 navsection: userguide
183 title: "Developing CWL Workflows with VSCode"
186 Copyright (C) The Arvados Authors. All rights reserved.
188 SPDX-License-Identifier: CC-BY-SA-3.0
190 Imported from https://github.com/arvados/arvados-vscode-cwl-training
199 rm_rf "arvados-vscode-cwl-training"
204 rm_rf "sdk/python/arvados"
206 rm_rf "sdk/java-v2/javadoc"
209 require "zenweb/tasks"
210 load "zenweb-textile.rb"
211 load "zenweb-liquid.rb"
212 load "zenweb-fix-body.rb"
214 task :extra_wirings do
215 $website.pages["sdk/python/python.html.textile.liquid"].depends_on("sdk/python/arvados/index.html")