diff --git a/toys/release/build-rad.rb b/toys/release/build-rad.rb index 7d37d07..a45df7c 100644 --- a/toys/release/build-rad.rb +++ b/toys/release/build-rad.rb @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +require "yaml" + desc "Build cloud-rad yardoc" flag :bundle @@ -38,6 +40,10 @@ def run gem "yard", "~> 0.9", ">= 0.9.26" gem "redcarpet", "~> 3.5", ">= 3.5.1" end + + if gem_name == "help" + return build_help + end yardopts_content = File.read yardopts cmd = ["yard", "doc", "--no-yardopts"] + build_options(yardopts_content) cmd = ["bundle", "exec"] + cmd if bundle @@ -73,8 +79,38 @@ def build_options yardopts_content final_options end +def build_help + mkdir "doc" + custom_names = { + "index.md" => "Getting started", + "occ_for_iam.md" => "OCC for IAM" + } + guides = { + "./../README.md" => "index.md" + } + Dir.glob("*.md").each do |file| + guides[file] = File.basename(file).downcase + end + toc_items = [] + guides.each do |path, filename| + cp path, "doc/#{filename}" + toc_items << { + "name" => custom_names[filename] || File.basename(filename, ".*").tr("_-", " ").capitalize, + "href" => filename + } + end + toc_data = [ + { + "uid" => "product-neutral-guides", + "name" => "Client library help", + "items" => toc_items + } + ] + File.write "doc/toc.yaml", YAML.dump(toc_data) + sanity_check +end + def sanity_check - require "yaml" Dir.glob "doc/*.yml" do |path| YAML.load_file path end diff --git a/toys/release/perform.rb b/toys/release/perform.rb index bbe629d..347b858 100644 --- a/toys/release/perform.rb +++ b/toys/release/perform.rb @@ -361,7 +361,7 @@ def run force_republish: false, end transformation_info = transform_links begin - publish_gem dry_run: dry_run + publish_gem dry_run: dry_run unless @gem_name == "help" publish_docs dry_run: dry_run if enable_docs publish_rad dry_run: dry_run if enable_rad ensure