Hamburger Cross Icon
Min Ruby Version
+
Ruby Collector

Min Ruby Version + Ruby Collector

Guardrail Collector Beta Devex Build And Ci

Enforce Min Ruby Version using data collected by Ruby Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Ensures the project uses at least the minimum required Ruby version. Helps maintain security and compatibility standards.
Data Source: Analyze Ruby projects to collect Bundler metadata, dependencies, Ruby version, and CI/CD command tracking. Detects Gemfile, .ruby-version, Rakefile, and gemspec files.

How Ruby Collector Powers This Guardrail

The Ruby Collector gathers metadata from your languages, build systems. This data flows into Lunar's Component JSON, where the Min Ruby Version guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
Ruby Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Min Ruby Version Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the Ruby Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/ruby@v1.0.5
    # with: ...

# Step 2: Enable the Ruby Project Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/ruby@v1.0.5
    include: [min-ruby-version]
    # with: ...

What Ruby Collector Collects

This collector gathers the following data that the Min Ruby Version guardrail evaluates.

Collector code

project

Analyzes Ruby project structure by detecting Gemfile, Gemfile.lock, .ruby-version, Rakefile, and .gemspec files. Extracts the Ruby version from .ruby-version or the Gemfile ruby directive. Detects build systems (Bundler, Rake). Writes project metadata to .lang.ruby.

Collector code

dependencies

Extracts direct and development dependencies from Gemfile and Gemfile.lock. Captures gem name, version constraint, and dependency group (default, development, test). Writes dependency data to .lang.ruby.dependencies.

Collector ci-before-command

cicd

Records every ruby command executed in CI pipelines along with the Ruby runtime version. Writes command strings and version info to .lang.ruby.cicd for audit trails and build reproducibility analysis.

Collector ci-before-command

bundler-cicd

Records every bundle command executed in CI pipelines along with the Bundler version. Writes command strings and version info to .lang.ruby.bundler.cicd.

Example Data Flow

Here's an example of the data that Ruby Collector writes to the Component JSON, which Min Ruby Version then evaluates.

{ } component.json From Ruby Collector
{
  "lang": {
    "ruby": {
      "version": "3.2.2",
      "build_systems": ["bundler", "rake"],
      "gemfile_exists": true,
      "gemfile_lock_exists": true,
      "ruby_version_file_exists": true,
      "rakefile_exists": true,
      "gemspec_files": ["my_gem.gemspec"],
      "source": { "tool": "ruby", "integration": "code" },
      "cicd": {
        "cmds": [
          { "cmd": "ruby app.rb", "version": "3.2.2" }
        ]
      },
      "bundler": {
        "cicd": {
          "cmds": [
            { "cmd": "bundle install", "version": "2.4.22" }
          ]
        }
      },
      "rake": {
        "cicd": {
          "cmds": [
            { "cmd": "rake test", "version": "13.1.0" }
          ]
        }
      },
      "bundler_audit": {
        "vulnerabilities": [
          {
            "gem": "actionpack",
            "version": "7.0.4",
            "advisory": "CVE-2023-22795",
            "title": "ReDoS vulnerability in Accept header parsing",
            "criticality": "High"
          }
        ],
        "source": { "tool": "bundler-audit", "integration": "ci" }
      },
      "dependencies": {
        "direct": [
          { "name": "rails", "version": "7.1.3", "group": "default" },
          { "name": "pg", "version": "1.5.4", "group": "default" }
        ],
        "development": [
          { "name": "rspec", "version": "3.12.0", "group": "development" },
          { "name": "rubocop", "version": "1.60.0", "group": "development" }
        ],
        "source": { "tool": "bundler", "integration": "code" }
      }
    }
  }
}

Configuration Options

Ruby Project Guardrails Inputs

Input Required Default Description
max_audit_vulnerabilities Optional 0 Maximum allowed known vulnerabilities from bundler-audit (0 = must be clean)
min_ruby_version Optional 3.0 Minimum required Ruby version (e.g., "3.0", "3.2")
min_ruby_version_cicd Optional 3.0 Minimum required Ruby version for CI/CD commands
min_bundler_version_cicd Optional 2.4 Minimum required Bundler version for CI/CD commands
min_rake_version_cicd Optional 13.0 Minimum required Rake version for CI/CD commands

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 200+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo