X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0059f6dd744f49e20c2abe9b8bf2c4a3c3a1ace3..f42ee7c19b794e25db30051b1dfc4bee83929bcd:/doc/Rakefile diff --git a/doc/Rakefile b/doc/Rakefile index 855b829855..4427f7822e 100644 --- a/doc/Rakefile +++ b/doc/Rakefile @@ -3,11 +3,42 @@ # # SPDX-License-Identifier: CC-BY-SA-3.0 +# As a convenience to the documentation writer, you can touch a file +# called 'no-sdk' in the 'doc' directory and it will suppress +# generating the documentation for the SDKs, which (the R docs +# especially) take a fair bit of time and slow down the edit-preview +# cycle. +# +# To generate and view the documentation locally, run this command +# +# rake && sensible-browser .site/index.html +# +# Or alternatively: +# +# baseurl=http://localhost:8000 rake && rake run +# +# and then visit http://localhost:8000 in a browser. + require "rubygems" require "colorize" -task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html' ] do - vars = ['baseurl', 'arvados_api_host', 'arvados_workbench_host'] +module Zenweb + class Site + @binary_files = %w[png jpg gif eot svg ttf woff2? ico pdf m4a t?gz xlsx] + end +end + +task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html', 'sdk/java-v2/javadoc/index.html' ] do + vars = ['baseurl', 'arvados_cluster_uuid', 'arvados_api_host', 'arvados_workbench_host'] + if ! ENV.key?('baseurl') || ENV['baseurl'] == "" + if !ENV.key?('WORKSPACE') || ENV['WORKSPACE'] == "" + puts "The `baseurl` variable was not specified and the `WORKSPACE` environment variable is not set. Defaulting `baseurl` to file://#{pwd}/.site" + ENV['baseurl'] = "file://#{pwd}/.site/" + else + puts "The `baseurl` variable was not specified, defaulting to a value derived from the `WORKSPACE` environment variable" + ENV['baseurl'] = "file://#{ENV['WORKSPACE']}/doc/.site/" + end + end vars.each do |v| if ENV[v] website.config.h[v] = ENV[v] @@ -15,22 +46,34 @@ task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/ end end +file ["install/new_cluster_checklist_Azure.xlsx", "install/new_cluster_checklist_AWS.xlsx"] do |t| + cp(t, t) +end + file "sdk/python/arvados/index.html" do |t| - `which epydoc` + if ENV['NO_SDK'] || File.exists?("no-sdk") + next + end + `which pdoc` if $? == 0 - STDERR.puts `epydoc --html --parse-only -o sdk/python/arvados ../sdk/python/arvados/ 2>&1` + STDERR.puts `pdoc --html -o sdk/python ../sdk/python/arvados/ 2>&1` raise if $? != 0 else - puts "Warning: epydoc not found, Python documentation will not be generated".colorize(:light_red) + puts "Warning: pdoc3 not found, Python documentation will not be generated".colorize(:light_red) end end file "sdk/R/arvados/index.html" do |t| + if ENV['NO_SDK'] || File.exists?("no-sdk") + next + end `which R` if $? == 0 tgt = Dir.pwd Dir.mkdir("sdk/R") Dir.mkdir("sdk/R/arvados") + puts("tgt", tgt) + cp('css/R.css', 'sdk/R/arvados') docfiles = [] Dir.chdir("../sdk/R/") do STDERR.puts `Rscript createDoc.R README.Rmd #{tgt}/sdk/R/README.md 2>&1` @@ -54,7 +97,7 @@ navmenu: R title: "R SDK Overview" ... -#{rd.read.gsub("```", "\n~~~\n").gsub(/^[ ]+/, "")} +#{rd.read.gsub(/^```$/, "~~~").gsub(/^```(\w)$/, "~~~\\1")} EOF ) end @@ -87,25 +130,85 @@ EOF end end +file "sdk/java-v2/javadoc/index.html" do |t| + if ENV['NO_SDK'] || File.exists?("no-sdk") + next + end + `which java` + if $? == 0 + `which gradle` + if $? != 0 + puts "Warning: gradle not found, java sdk documentation will not be generated".colorize(:light_red) + else + tgt = Dir.pwd + docfiles = [] + Dir.chdir("../sdk/java-v2") do + STDERR.puts `gradle javadoc 2>&1` + raise if $? != 0 + puts `sed -i "s/@import.*dejavu.css.*//g" build/docs/javadoc/stylesheet.css` + raise if $? != 0 + end + cp_r("../sdk/java-v2/build/docs/javadoc", "sdk/java-v2") + raise if $? != 0 + end + else + puts "Warning: java not found, java sdk documentation will not be generated".colorize(:light_red) + end +end + task :linkchecker => [ :generate ] do Dir.chdir(".site") do `which linkchecker` if $? == 0 - system "linkchecker index.html --ignore-url='!file://'" or exit $?.exitstatus + # we need --check-extern to check relative links, weird but true + system "linkchecker index.html --check-extern --ignore-url='!file://'" or exit $?.exitstatus else puts "Warning: linkchecker not found, skipping run".colorize(:light_red) end end end +task :import_vscode_training do + Dir.chdir("user") do + rm_rf "arvados-vscode-cwl-training" + `git clone https://github.com/arvados/arvados-vscode-cwl-training` + githash = `git --git-dir arvados-vscode-cwl-training/.git log -n1 --format=%H HEAD` + File.open("cwl/arvados-vscode-training.html.md.liquid", "w") do |fn| + File.open("arvados-vscode-cwl-training/README.md", "r") do |rd| + fn.write(<<-EOF +--- +layout: default +navsection: userguide +title: "Developing CWL Workflows with VSCode" +... +{% comment %} +Copyright (C) The Arvados Authors. All rights reserved. + +SPDX-License-Identifier: CC-BY-SA-3.0 + +Imported from https://github.com/arvados/arvados-vscode-cwl-training +git hash: #{githash} +{% endcomment %} + +EOF + ) + fn.write(rd.read()) + end + end + rm_rf "arvados-vscode-cwl-training" + end +end + task :clean do rm_rf "sdk/python/arvados" rm_rf "sdk/R" + rm_rf "sdk/java-v2/javadoc" end require "zenweb/tasks" load "zenweb-textile.rb" load "zenweb-liquid.rb" +load "zenweb-fix-body.rb" task :extra_wirings do $website.pages["sdk/python/python.html.textile.liquid"].depends_on("sdk/python/arvados/index.html")