Skip to content

Conversation

@aramprice
Copy link
Member

@aramprice aramprice commented Dec 5, 2025

This PR adds a workflow to test the execution of the embedded ruby code against Rubies >= 2.6

The spec will not pass against Ruby > 3.4 because the ostruct gem required by the code is no longer part of the default gemset.

NOTE: the bosh-cli currently relies on whichever ruby executable is found in its $PATH when invoked, and does not have the capacity to install gems.

@aramprice aramprice moved this from Inbox to Pending Review | Discussion in Foundational Infrastructure Working Group Dec 11, 2025
@aramprice aramprice requested review from a team, KauzClay and julian-hj and removed request for a team December 11, 2025 16:11
@rkoster rkoster requested a review from Copilot December 18, 2025 15:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive Ruby testing infrastructure to validate embedded Ruby code execution across multiple Ruby versions (2.6 through head) and operating systems. The workflow addresses a known compatibility issue where Ruby versions > 3.4 no longer include the ostruct gem in the default gemset.

Key Changes:

  • Added GitHub Actions workflow to test Ruby code against versions 2.6 through head
  • Created RSpec test suite with specs for ERBRenderer initialization and rendering
  • Modernized erb_renderer.rb with style improvements and safer Ruby patterns

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/ruby.yml Defines CI workflow to run specs across Ruby 2.6-head and ubuntu/macos
templatescompiler/erbrenderer/Gemfile Adds test dependencies (rspec, standardrb, rake)
templatescompiler/erbrenderer/Rakefile Configures rake tasks for running specs and linting
templatescompiler/erbrenderer/.gitignore Excludes Gemfile.lock from version control
templatescompiler/erbrenderer/spec/spec_helper.rb Sets up RSpec test environment and load paths
templatescompiler/erbrenderer/spec/erb_renderer_spec.rb Adds test coverage for ERBRenderer initialization and template rendering
templatescompiler/erbrenderer/erb_renderer.rb Applies style improvements, modernizes Ruby patterns (alias_method, File.write, JSON.load_file)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aramprice aramprice changed the title Add Ruby workflow for embeded ruby code Add Ruby workflow for embedded ruby code Dec 19, 2025
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: bundle install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running bundle install here masks a compatibility issue. The bundle install pulls in a newer json gem (≥2.5.0) which provides JSON.load_file, but this method doesn't exist in Ruby's stdlib json library for versions < 3.0.

erb.filename = src_path

context_hash = JSON.load(File.read(@json_context_path))
context_hash = JSON.load_file(@json_context_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context_hash = JSON.load_file(@json_context_path)
context_hash = if JSON.respond_to?(:load_file)
JSON.load_file(@json_context_path)
else
JSON.load(File.read(@json_context_path))
end```

@github-project-automation github-project-automation bot moved this from Pending Review | Discussion to Waiting for Changes | Open for Contribution in Foundational Infrastructure Working Group Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting for Changes | Open for Contribution

Development

Successfully merging this pull request may close these issues.

2 participants