X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0b8f1f94be9f49e7a65f5ca84fe563918861be24..da8714584a1649fb128e0f13718c2507c518a210:/doc/Rakefile diff --git a/doc/Rakefile b/doc/Rakefile index 811ca67c2c..079f7da27f 100644 --- a/doc/Rakefile +++ b/doc/Rakefile @@ -1,9 +1,12 @@ #!/usr/bin/env rake +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: CC-BY-SA-3.0 require "rubygems" require "colorize" -task :generate => [ :realclean, 'sdk/python/arvados/index.html' ] do +task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html' ] do vars = ['baseurl', 'arvados_api_host', 'arvados_workbench_host'] vars.each do |v| if ENV[v] @@ -15,12 +18,75 @@ end file "sdk/python/arvados/index.html" do |t| `which epydoc` if $? == 0 - `epydoc --html --parse-only -o sdk/python/arvados ../sdk/python/arvados/` + STDERR.puts `epydoc --html --parse-only -o sdk/python/arvados ../sdk/python/arvados/ 2>&1` + raise if $? != 0 else puts "Warning: epydoc not found, Python documentation will not be generated".colorize(:light_red) end end +file "sdk/R/arvados/index.html" do |t| + `which R` + if $? == 0 + tgt = Dir.pwd + Dir.mkdir("sdk/R") + Dir.mkdir("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" + `R CMD Rdconv -t html man/#{rd} > #{tgt}/sdk/R/arvados/#{htmlfile}` + docfiles << htmlfile + end + end + end + raise if $? != 0 + + File.open("sdk/R/README.md", "r") do |rd| + File.open("sdk/R/index.html.md", "w") do |fn| + fn.write(<<-EOF +--- +layout: default +navsection: sdk +navmenu: R +title: "R SDK Overview" +... + +#{rd.read.gsub(/^```$/, "~~~").gsub(/^```(\w)$/, "~~~\\1")} +EOF + ) + end + end + + File.open("sdk/R/arvados/index.html.textile.liquid", "w") do |fn| + fn.write(<<-EOF +--- +layout: default +navsection: sdk +navmenu: R +title: "R Reference" +... +{% comment %} +Copyright (C) The Arvados Authors. All rights reserved. + +SPDX-License-Identifier: CC-BY-SA-3.0 +{% endcomment %} + +EOF + ) + + docfiles.sort.each do |d| + fn.write("* \"#{d[0..-6]}\":#{d}\n") + end + + end + else + puts "Warning: R not found, R documentation will not be generated".colorize(:light_red) + end +end + task :linkchecker => [ :generate ] do Dir.chdir(".site") do `which linkchecker` @@ -34,6 +100,7 @@ end task :clean do rm_rf "sdk/python/arvados" + rm_rf "sdk/R" end require "zenweb/tasks"