Skip to content
Snippets Groups Projects

Update build to use ruby instead of shell, add local spec support

Closed Martin Lowe requested to merge malowe/main/update into main
3 unresolved threads

Switch to ruby was made for better scripting support for things such as yaml consumption, general file IO, and better support for building the data file used to build the site.

As part of this patch, support for local files was added to pull specs already included in the project to use in the build.

The previous properties file was swapped to the repos.yaml which denotes all of the specs to be imported by the script, and adds support for custom display names to be used in the link text for the site.

Merge request reports

Checking pipeline status.

Approval is optional

Merged by avatar (May 25, 2025 5:08pm UTC)

Merge details

  • Changes merged into with .
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
fetch_specs.rb 0 → 100755
19 def external_spec?(location)
20 !location.nil? && location =~ %r{^https?://(?:[^./]+.){1,3}\.[a-z]{2,3}(/[^/]+)*\.[a-z]{3,4}?$}
21 end
22
23 # Used for file presence checks
24 initial_project_directory = Dir.pwd
25
26 # Create the staging location if it doesn't yet exist
27 FileUtils.mkdir_p(TEMP_DIR_NAME) unless Dir.exist?(TEMP_DIR_NAME)
28 # Go to temp dir to start work
29 Dir.chdir(TEMP_DIR_NAME)
30
31 # Create the data holder for the generated repo data definitions
32 artificial_repo_data = { 'items' => [] }
33
34 repos_definition = YAML.load_file('../repos.yaml')
  • fetch_specs.rb 0 → 100755
    55 end
    56
    57 puts "Processing openapi spec for #{spec_display_name}..."
    58 # Go to the location where the spec is, and continue processing
    59 Dir.chdir(spec_machine_name)
    60 `npx redoc-cli build -o "../../content/#{spec_machine_name}/index.html" openapi.yaml`
    61
    62 artificial_repo_data['items'].push({ 'name' => spec_machine_name.to_s, 'displayName' => spec_display_name.to_s })
    63
    64 ## Go back to the ./tmp folder
    65 Dir.chdir('..')
    66 end
    67
    68 puts "Outputing generated spec data for site render"
    69 ## Dump the repo
    70 File.open('../data/specs.yaml', 'w') do |out|
  • Author Maintainer

    We're going to pivot away from ruby as there's been pushback with pretty reasonable requests. I'm going to see about rewriting this into JS, and while that isn't ideal for use case, it's supported and a lot more people know it on the team

  • closed

  • Please register or sign in to reply
    Loading