Update build to use ruby instead of shell, add local spec support
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
Activity
requested review from @epoirier, @cguindon, @zacharysabourin, and @oliviergoulet
Deploy Preview for webdev.eclipse.org-spec-host has failed [ 41 sec] Inspect the build logs Restart a deploy nowEdited by Web Dev Bot userThe script is written in ruby, but it works locally to do the build, and I'll make a request to add ruby to the base image for the preview. It's a pretty standard package in most Linux releases and overall not too large of an environment, so I doubt there will be a problem with it.
I'm mainly looking for general feedback, or places that the code looks fishy so I can either fix or explain! TIA!
Edited by Martin LoweIssue for request for support: https://gitlab.eclipse.org/eclipsefdn/infrazilla/-/issues/1212
- 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|