# 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', '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]
end
`which pdoc`
if $? == 0
- STDERR.puts `pdoc --html -o sdk/python ../sdk/python/arvados/ 2>&1`
- raise if $? != 0
+ raise unless system("python3", "setup.py", "build",
+ chdir: "../sdk/python", out: :err)
+ raise unless system("pdoc", "--html", "-o", "sdk/python", "../sdk/python/build/lib/arvados/",
+ out: :err)
else
puts "Warning: pdoc3 not found, Python documentation will not be generated".colorize(:light_red)
end
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`
Dir.entries("man").each do |rd|
if rd[-3..-1] == ".Rd"
htmlfile = "#{rd[0..-4]}.html"
end
raise if $? != 0
- File.open("sdk/R/README.md", "r") do |rd|
+ File.open("../sdk/R/README.md", "r") do |rd|
File.open("sdk/R/index.html.md", "w") do |fn|
fn.write(<<-EOF
---
title: "R SDK Overview"
...
-#{rd.read.gsub(/^```$/, "~~~").gsub(/^```(\w)$/, "~~~\\1")}
+#{rd.read}
EOF
)
end
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
---
layout: default
navsection: userguide
-title: "Developing Workflows with VSCode"
+title: "Developing CWL Workflows with VSCode"
...
{% comment %}
Copyright (C) The Arvados Authors. All rights reserved.