Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion toys/release/build-rad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion toys/release/perform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading