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.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.html" do |t|
54 if ENV['NO_SDK'] || File.exist?("no-sdk")
57 # pysdk_pdoc.py is a wrapper around the pdoc CLI. `which pdoc` is an easy
58 # and good-enough test to check whether it's installed at all.
61 raise unless system("python3", "setup.py", "build",
62 chdir: "../sdk/python", out: :err)
63 raise unless system("python3", "pysdk_pdoc.py",
66 puts "Warning: pdoc not found, Python documentation will not be generated".colorize(:light_red)
70 file "sdk/R/arvados/index.html" do |t|
71 if ENV['NO_SDK'] || File.exist?("no-sdk")
78 Dir.mkdir("sdk/R/arvados")
80 cp('css/R.css', 'sdk/R/arvados')
82 Dir.chdir("../sdk/R/") do
83 Dir.entries("man").each do |rd|
84 if rd[-3..-1] == ".Rd"
85 htmlfile = "#{rd[0..-4]}.html"
86 `R CMD Rdconv -t html man/#{rd} > #{tgt}/sdk/R/arvados/#{htmlfile}`
93 File.open("../sdk/R/README.md", "r") do |rd|
94 File.open("sdk/R/index.html.md", "w") do |fn|
100 title: "R SDK Overview"
109 File.open("sdk/R/arvados/index.html.textile.liquid", "w") do |fn|
118 Copyright (C) The Arvados Authors. All rights reserved.
120 SPDX-License-Identifier: CC-BY-SA-3.0
126 docfiles.sort.each do |d|
127 fn.write("* \"#{d[0..-6]}\":#{d}\n")
132 puts "Warning: R not found, R documentation will not be generated".colorize(:light_red)
136 file "sdk/java-v2/javadoc/index.html" do |t|
137 if ENV['NO_SDK'] || File.exist?("no-sdk")
144 puts "Warning: gradle not found, java sdk documentation will not be generated".colorize(:light_red)
148 Dir.chdir("../sdk/java-v2") do
149 STDERR.puts `gradle javadoc 2>&1`
151 puts `sed -i "s/@import.*dejavu.css.*//g" build/docs/javadoc/stylesheet.css`
154 cp_r("../sdk/java-v2/build/docs/javadoc", "sdk/java-v2")
158 puts "Warning: java not found, java sdk documentation will not be generated".colorize(:light_red)
162 task :linkchecker => [ :generate ] do
163 Dir.chdir(".site") do
166 # we need --check-extern to check relative links, weird but true
167 system "linkchecker index.html --check-extern --ignore-url='!file://'" or exit $?.exitstatus
169 puts "Warning: linkchecker not found, skipping run".colorize(:light_red)
174 task :import_vscode_training do
176 rm_rf "arvados-vscode-cwl-training"
177 `git clone https://github.com/arvados/arvados-vscode-cwl-training`
178 githash = `git --git-dir arvados-vscode-cwl-training/.git log -n1 --format=%H HEAD`
179 File.open("cwl/arvados-vscode-training.html.md.liquid", "w") do |fn|
180 File.open("arvados-vscode-cwl-training/README.md", "r") do |rd|
184 navsection: userguide
185 title: "Developing CWL Workflows with VSCode"
188 Copyright (C) The Arvados Authors. All rights reserved.
190 SPDX-License-Identifier: CC-BY-SA-3.0
192 Imported from https://github.com/arvados/arvados-vscode-cwl-training
201 rm_rf "arvados-vscode-cwl-training"
206 rm_rf "sdk/python/arvados"
207 rm_f "sdk/python/arvados.html"
208 rm_f "sdk/python/index.html"
210 rm_rf "sdk/java-v2/javadoc"
213 require "zenweb/tasks"
214 load "zenweb-textile.rb"
215 load "zenweb-liquid.rb"
216 load "zenweb-fix-body.rb"
218 task :extra_wirings do
219 $website.pages["sdk/python/python.html.textile.liquid"].depends_on("sdk/python/arvados.html")