Merge branch '17353-install-warnings'
[arvados.git] / doc / Rakefile
index 623dbd033be6880cb31f436823cea8f604bbcc14..ee87062f7ec275716f454c298db96eb9239e0e0a 100644 (file)
@@ -20,6 +20,15 @@ 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]
@@ -35,12 +44,12 @@ file "sdk/python/arvados/index.html" do |t|
   if ENV['NO_SDK'] || File.exists?("no-sdk")
     next
   end
-  `which epydoc`
+  `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
 
@@ -148,6 +157,37 @@ task :linkchecker => [ :generate ] do
   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"