Skip to content

Commit 0e74fb4

Browse files
Merge pull request #813 from cucumber/cucumber-messages/use-pure-ruby-protobuf
cucumber-messages: Use pure-Ruby protobuf implementation (experimental)
2 parents 3535747 + 150e0fd commit 0e74fb4

File tree

28 files changed

+99
-53
lines changed

28 files changed

+99
-53
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ executors:
1414
docker:
1515
# Remember to update to the latest image tag.
1616
# Run `source scripts/functions.sh && docker_image Dockerfile` to print it.
17-
- image: cucumber/cucumber-build:9ce5f6a542de12ceecdd84caaad47365
17+
- image: cucumber/cucumber-build:7e07f786ac72e3597a8e5bbe435b4c90
1818
working_directory: ~/cucumber
1919
# Go
2020
docker-circleci-golang:
@@ -397,7 +397,7 @@ jobs:
397397
- persist_to_workspace:
398398
root: ~/cucumber
399399
paths:
400-
- cucumber-messages/ruby/lib/cucumber/messages_pb.rb
400+
- cucumber-messages/ruby
401401

402402
gherkin-ruby-23:
403403
executor: docker-circleci-ruby-23

.templates/ruby/Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Bundler::GemHelper.install_tasks
55

66
$:.unshift File.expand_path("../lib", __FILE__)
77

8+
Dir['./rake/*.rb'].each do |f|
9+
require f
10+
end
11+
812
require "rspec/core/rake_task"
913
RSpec::Core::RakeTask.new(:spec) do |t|
1014
t.ruby_opts = %w[-r./spec/coverage -w]

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ RUN apk add --no-cache \
3232
py2-pip \
3333
rsync \
3434
ruby \
35+
ruby-bigdecimal \
3536
ruby-dev \
3637
sed \
3738
su-exec \

c21e/ruby/Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Bundler::GemHelper.install_tasks
55

66
$:.unshift File.expand_path("../lib", __FILE__)
77

8+
Dir['./rake/*.rb'].each do |f|
9+
require f
10+
end
11+
812
require "rspec/core/rake_task"
913
RSpec::Core::RakeTask.new(:spec) do |t|
1014
t.ruby_opts = %w[-r./spec/coverage -w]

cucumber-demo-formatter/ruby/Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Bundler::GemHelper.install_tasks
55

66
$:.unshift File.expand_path("../lib", __FILE__)
77

8+
Dir['./rake/*.rb'].each do |f|
9+
require f
10+
end
11+
812
require "rspec/core/rake_task"
913
RSpec::Core::RakeTask.new(:spec) do |t|
1014
t.ruby_opts = %w[-r./spec/coverage -w]

cucumber-demo-formatter/ruby/bin/cucumber-demo-formatter

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require 'cucumber_demo_formatter'
88
ARGV << '-h' if ARGV.empty?
99

1010
option_parser = OptionParser.new do |opts|
11-
opts.on '-f', '--format=ndjson|protobuf', 'Output format'
11+
opts.on '-f', '--format=ndjson|protobuf', 'Input format'
1212

1313
opts.on_tail("-h", "--help", "Show this message") do
1414
puts opts
@@ -29,4 +29,4 @@ else
2929
raise "Unsupported format: '#{format}'"
3030
end
3131

32-
formatter.process_messages(message_enumerator, STDOUT)
32+
formatter.process_messages(message_enumerator, STDOUT)

cucumber-demo-formatter/ruby/lib/cucumber_demo_formatter.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
33
class CucumberDemoFormatter
44
def process_messages(message_enumerator, output)
55
emoji = {
6-
UNKNOWN: '👽',
7-
PASSED: '😃',
8-
SKIPPED: '🥶',
9-
PENDING: '⏰',
10-
UNDEFINED: '🤷',
11-
AMBIGUOUS: '🦄',
12-
FAILED: '💣',
6+
::Cucumber::Messages::TestResult::Status::UNKNOWN => '👽',
7+
::Cucumber::Messages::TestResult::Status::PASSED => '😃',
8+
::Cucumber::Messages::TestResult::Status::SKIPPED => '🥶',
9+
::Cucumber::Messages::TestResult::Status::PENDING => '⏰',
10+
::Cucumber::Messages::TestResult::Status::UNDEFINED => '🤷',
11+
::Cucumber::Messages::TestResult::Status::AMBIGUOUS => '🦄',
12+
::Cucumber::Messages::TestResult::Status::FAILED => '💣',
1313
}
1414
message_enumerator.each do |message|
1515
if message.test_step_finished
16-
output.write(emoji[message.test_step_finished.test_result.status])
16+
status = message.test_step_finished.test_result.status
17+
em = emoji[status]
18+
raise "No emoji found for status #{status}" if em.nil?
19+
output.write(em)
1720
end
1821
if message.test_run_finished
1922
output.write("\n")
2023
end
2124
end
2225
end
23-
end
26+
end

cucumber-expressions/ruby/Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Bundler::GemHelper.install_tasks
55

66
$:.unshift File.expand_path("../lib", __FILE__)
77

8+
Dir['./rake/*.rb'].each do |f|
9+
require f
10+
end
11+
812
require "rspec/core/rake_task"
913
RSpec::Core::RakeTask.new(:spec) do |t|
1014
t.ruby_opts = %w[-r./spec/coverage -w]

cucumber-json-formatter/ruby/Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Bundler::GemHelper.install_tasks
55

66
$:.unshift File.expand_path("../lib", __FILE__)
77

8+
Dir['./rake/*.rb'].each do |f|
9+
require f
10+
end
11+
812
require "rspec/core/rake_task"
913
RSpec::Core::RakeTask.new(:spec) do |t|
1014
t.ruby_opts = %w[-r./spec/coverage -w]

cucumber-messages/dotnet/messages.proto

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
syntax = "proto3";
22
package io.cucumber.messages;
3-
option ruby_package = "Cucumber::Messages";
43
option go_package = "messages";
54

65
// When removing a field, replace it with reserved, rather than deleting the line.
@@ -426,13 +425,13 @@ message TestCase {
426425
string pickle_step_id = 2;
427426
// Pointer to all the matching `StepDefinition`s (if derived from a PickleStep)
428427
repeated string step_definition_ids = 3;
429-
// A list of list of StepMatchArgument (if derived from a `StepDefinition`).
428+
// A list of list of StepMatchArgument (if derived from a `StepDefinition`).
430429
// Each element represents a matching step definition. A size of 0 means `UNDEFINED`,
431430
// and a size of 2+ means `AMBIGUOUS`
432431
repeated StepMatchArgumentsList step_match_arguments_lists = 4;
433432
// Pointer to the `Hook` (if derived from a Hook)
434433
string hook_id = 5;
435-
434+
436435
message StepMatchArgumentsList {
437436
repeated StepMatchArgument step_match_arguments = 1;
438437
}

0 commit comments

Comments
 (0)