Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
7c49898
Initial files
luke-hill Sep 5, 2025
c6a0dba
Add hidden files
luke-hill Sep 5, 2025
5f4a90b
Fix typo
luke-hill Sep 5, 2025
a988fd0
Add cucumber messages to runtime requirements and port over existing …
luke-hill Sep 5, 2025
273e248
Add in spec files
luke-hill Sep 5, 2025
b6c0a15
Fix up all loading, relations and requirements
luke-hill Sep 5, 2025
36e2a52
Alter error class for new API
luke-hill Sep 5, 2025
8db670b
Alter all other tests to pass
luke-hill Sep 5, 2025
e3637f1
Auto-gen rubocop config;
luke-hill Sep 5, 2025
b096339
Add note about duplication of code
luke-hill Sep 5, 2025
c0637d8
Minor linting and starting to unpick redundant pieces of spec support
luke-hill Sep 5, 2025
ef56500
Lint / DRY up tests
luke-hill Sep 5, 2025
f0b2552
Linting for tests and 1 bug fix where test case started was firing pr…
luke-hill Sep 5, 2025
c900365
Add in legacy ns;
luke-hill Sep 5, 2025
f35fa9b
Ported over helpers from JS
luke-hill Sep 5, 2025
c3d7fe5
Initial implementation of initializer and update method
luke-hill Sep 5, 2025
0a4c755
Remove un-needed placeholder
luke-hill Sep 5, 2025
2b2b2d0
Regen the rubocop config;
luke-hill Sep 5, 2025
f780531
Remove all legacy query entities
luke-hill Nov 28, 2025
47e4f14
Move query into correct NS and rename helpers
luke-hill Nov 28, 2025
3e72470
Remove legacy tests
luke-hill Nov 28, 2025
b2b1c59
Fix readme
luke-hill Nov 28, 2025
354aee3
Remove un-necessary items from package
luke-hill Nov 28, 2025
df0df56
Move Ruby query implementation into gem
mattwynne May 31, 2026
d238b78
Fix Ruby query packaging and test step lookup
mattwynne May 31, 2026
18b10c8
Add Ruby CI and release workflow
mattwynne Jun 13, 2026
367300f
Align Ruby gem version
mattwynne Jun 13, 2026
4c70e37
Update Ruby lockfile version
mattwynne Jun 13, 2026
004ccfa
Update changelog for Ruby implementation
mattwynne Jun 13, 2026
0ff633e
Pin Ruby workflow actions
mattwynne Jun 13, 2026
05cba61
Disable bundler cache in Ruby release workflow
mattwynne Jun 13, 2026
7b446a7
Add RubyGems badge
mattwynne Jun 13, 2026
ca2efd2
Tidy Ruby query implementation
mattwynne Jun 13, 2026
e98f91f
Merge branch 'main' into feature/ruby_implementation
mattwynne Jun 13, 2026
171185e
Update .github/workflows/test-ruby.yml
mattwynne Jun 17, 2026
985d991
Bump gemspec to only use ruby 3.3+ and higher dev gems
luke-hill Jun 30, 2026
92a4ed3
Target Ruby 3.3+
luke-hill Jun 30, 2026
5d39812
Fix CI
luke-hill Jun 30, 2026
648fa0c
Convert into new testing format for new query;
luke-hill Jun 30, 2026
84e1560
Tidy up test iteration code to ensure we only select files that will …
luke-hill Jun 30, 2026
f385309
Add in more cck examples to be tested against
luke-hill Jun 30, 2026
048184e
Remove gemfile.lock
luke-hill Jun 30, 2026
0575da5
Nitpicks
mpkorstanje Jun 30, 2026
b6d01eb
Fix version
luke-hill Jul 1, 2026
3e82877
Merge branch 'main' into feature/ruby_implementation
luke-hill Jul 1, 2026
74ad722
Fix for old ruby
luke-hill Jul 1, 2026
4f274cf
Fix requirements and rdoc
luke-hill Jul 1, 2026
831859f
Fix up test code
luke-hill Jul 1, 2026
1fcf781
Refactor out symbol refs to use verbose classes
luke-hill Jul 1, 2026
53e4325
Fix required version of messages and improve handlers by utilising ne…
luke-hill Jul 1, 2026
8f9af81
Tidy up line length and remove comments
luke-hill Jul 1, 2026
6f79e9e
Add in some more simple lambdas to validate more of the queries
luke-hill Jul 1, 2026
2023797
Fix findAll lambdas to return int
luke-hill Jul 2, 2026
7fdde96
Fix findMeta to return name of implementation
luke-hill Jul 2, 2026
7077a0d
Add in 2 new queries which also return simple counters;
luke-hill Jul 2, 2026
e04185b
Bump version requirements for messages
luke-hill Jul 9, 2026
6dabc4b
Merge branch 'main' into feature/ruby_implementation
luke-hill Jul 9, 2026
be8521b
Add in missing message handlers for 2 message updates plus catchall f…
luke-hill Jul 13, 2026
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
29 changes: 29 additions & 0 deletions .github/workflows/release-rubygem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release RubyGems

permissions: {}

on:
push:
branches:
- release/*

jobs:
publish-rubygem:
name: Publish Ruby Gem
runs-on: ubuntu-latest
environment: Release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0
with:
ruby-version: 4.0.5
working-directory: ruby
- uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
- uses: cucumber/action-publish-rubygem@4e79bb9aed597c835e8438f57c04d0996ab80d72 # v2.0.0
with:
working-directory: ruby
48 changes: 48 additions & 0 deletions .github/workflows/test-ruby.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test-ruby

permissions: {}

on:
push:
branches:
- main
- renovate/**
paths:
- ruby/**
- testdata/**
- .github/**
pull_request:
branches:
- main
- renovate/**
paths:
- ruby/**
- testdata/**
- .github/**

jobs:
test-ruby:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
ruby: ['3.3', '3.4', '4.0']
include:
- os: macos-latest
ruby: '4.0'
- os: windows-latest
ruby: '4.0'

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ruby/setup-ruby@6aaa311d81eba98ae12eaffbcb63296ace0efcde # v1.307.0
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ruby
- run: bundle exec rspec
working-directory: ruby
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- [Ruby] Add initial Ruby implementation and RubyGems release workflow, covering the needs of the rerun formatter only for now ([#98](https://github.com/cucumber/query/pull/98))

### Changed
- Prefer Pickle.Location with fallback to Lineage ([#175](https://github.com/cucumber/query/pull/175))

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<a href="https://central.sonatype.com/artifact/io.cucumber/query">
<img src="https://img.shields.io/maven-central/v/io.cucumber/query.svg?label=Maven%20Central&color=dark-green" alt="maven-central">
</a>
<a href="https://rubygems.org/gems/cucumber-query">
<img src="https://img.shields.io/gem/v/cucumber-query.svg?color=dark-green" alt="rubygems">
</a>
<a href="https://github.com/cucumber/query/actions/workflows/release-github.yaml">
<img src="https://github.com/cucumber/query/actions/workflows/release-github.yaml/badge.svg" alt="build">
</a>
Expand All @@ -38,3 +41,4 @@ is rendering the [GherkinDocument](https://github.com/cucumber/messages/blob/mai

The Query library makes this easy by providing a function to look up the
status of a step, a scenario or an entire file.

2 changes: 2 additions & 0 deletions ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Gemfile.lock
*.gem
2 changes: 2 additions & 0 deletions ruby/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--require spec_helper
--color
21 changes: 21 additions & 0 deletions ruby/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-performance
- rubocop-rspec

inherit_mode:
merge:
- Exclude

AllCops:
TargetRubyVersion: 3.3
NewCops: enable

# Stylistic preference for cucumber
Gemspec/DevelopmentDependencies:
Enabled: false

# Disabled on our repo's to enable polyglot-release
Gemspec/RequireMFA:
Enabled: false
133 changes: 133 additions & 0 deletions ruby/.rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-09-05 19:34:38 UTC using RuboCop version 1.80.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Layout/EmptyLinesAroundModuleBody:
Exclude:
- 'spec/support/runner_helper.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'

# Offense count: 8
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
# NotImplementedExceptions: NotImplementedError
Lint/UnusedMethodArgument:
Exclude:
- 'lib/cucumber/query/query.rb'

# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 43

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 14

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/ClassLength:
Max: 160

# Offense count: 3
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 24

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 14

# Offense count: 8
Performance/MethodObjectAsBlock:
Exclude:
- 'lib/cucumber/query/legacy/hook_by_test_step.rb'
- 'lib/cucumber/query/legacy/pickle_by_test.rb'
- 'lib/cucumber/query/legacy/pickle_step_by_test_step.rb'
- 'lib/cucumber/query/legacy/step_definitions_by_test_step.rb'
- 'lib/cucumber/query/legacy/test_case_started_by_test_case.rb'

# Offense count: 1
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'

# Offense count: 1
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 7

# Offense count: 32
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/cucumber/query/legacy/hook_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/pickle_by_test_spec.rb'
- 'spec/cucumber/query/legacy/pickle_step_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/step_definitions_by_test_step_spec.rb'
- 'spec/cucumber/query/legacy/test_case_started_by_test_case_spec.rb'

# Offense count: 3
RSpec/MultipleExpectations:
Max: 3

# Offense count: 12
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 5

# Offense count: 8
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'lib/cucumber/query/helpers.rb'
- 'lib/cucumber/query/legacy/hook_by_test_step.rb'
- 'lib/cucumber/query/legacy/pickle_by_test.rb'
- 'lib/cucumber/query/legacy/pickle_step_by_test_step.rb'
- 'lib/cucumber/query/legacy/step_definitions_by_test_step.rb'
- 'lib/cucumber/query/legacy/test_case_started_by_test_case.rb'
- 'lib/cucumber/query/legacy/test_run_started.rb'
- 'lib/cucumber/query/query.rb'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'lib/cucumber/query/helpers.rb'
- 'lib/cucumber/query/query.rb'
- 'spec/support/gherkin_helper.rb'
- 'spec/support/runner_helper.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 198
5 changes: 5 additions & 0 deletions ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec
21 changes: 21 additions & 0 deletions ruby/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Cucumber Ltd and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions ruby/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.0.0
34 changes: 34 additions & 0 deletions ruby/cucumber-query.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

Gem::Specification.new do |s|
s.name = 'cucumber-query'
s.version = File.read(File.expand_path('VERSION', __dir__)).strip
s.authors = ['Luke Hill']
s.description = 'Cucumber Query - query messages'
s.summary = "#{s.name}-#{s.version}"
s.email = 'cukebot@cucumber.io'
s.homepage = 'https://github.com/cucumber/query'
s.platform = Gem::Platform::RUBY
s.license = 'MIT'
s.required_ruby_version = '>= 3.3'
s.required_rubygems_version = '>= 3.2.8'

s.metadata = {
'bug_tracker_uri' => 'https://github.com/cucumber/query/issues',
'changelog_uri' => 'https://github.com/cucumber/query/blob/main/CHANGELOG.md',
'documentation_uri' => 'https://github.com/cucumber/query/blob/main/README.md',
'mailing_list_uri' => 'https://groups.google.com/forum/#!forum/cukes',
Comment thread
luke-hill marked this conversation as resolved.
'source_code_uri' => 'https://github.com/cucumber/query/blob/main/ruby'
}

s.add_dependency 'cucumber-messages', '> 34', '< 36'

s.add_development_dependency 'rspec', '~> 3.13'
s.add_development_dependency 'rubocop', '~> 1.88.0'
s.add_development_dependency 'rubocop-performance', '~> 1.26.1'
s.add_development_dependency 'rubocop-rspec', '~> 3.10.2'

s.files = Dir['LICENSE', 'VERSION', 'lib/**/*']
s.rdoc_options = ['--charset=UTF-8']
s.require_path = 'lib'
end
Loading
Loading