This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename messages to cucumber-messaged
- Loading branch information
0 parents
commit e4a77f6
Showing
20 changed files
with
786 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PLEASE DO NOT CREATE ISSUES IN THIS REPO. | ||
THIS REPO IS A READ-ONLY MIRROR. | ||
|
||
Create your issue in the Cucumber monorepo instead: | ||
https://github.com/cucumber/cucumber/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PLEASE DO NOT CREATE PULL REAUESTS IN THIS REPO. | ||
THIS REPO IS A READ-ONLY MIRROR. | ||
|
||
Create your pull request in the Cucumber monorepo instead: | ||
https://github.com/cucumber/cucumber/pulls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
coverage/ | ||
Gemfile.lock | ||
pkg/ | ||
.tested |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
../../LICENSE LICENSE | ||
../../.templates/github/ .github/ | ||
../../.templates/ruby/ . | ||
../messages.proto messages.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cucumber/cucumber-messages-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
sudo: false | ||
language: ruby | ||
|
||
rvm: | ||
- "2.5.1" | ||
- "2.4.4" | ||
- "2.3.7" | ||
- "2.2.10" | ||
- "jruby-9.1.17.0" | ||
|
||
script: make default | ||
|
||
matrix: | ||
allow_failures: | ||
- rvm: "jruby-9.1.17.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# frozen_string_literal: true | ||
source "https://rubygems.org" | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Cucumber Ltd | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include default.mk | ||
|
||
.deps: lib/cucumber/messages_pb.rb | ||
|
||
lib/cucumber/messages_pb.rb: messages.proto | ||
protoc --ruby_out lib/cucumber $< | ||
|
||
clean: | ||
rm -f lib/cucumber/messages_pb.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Cucumber Messages for Ruby (Protocol Buffers) | ||
|
||
[![Build Status](https://travis-ci.org/cucumber/cucumber-messages-ruby.svg?branch=master)](https://travis-ci.org/cucumber/cucumber-messages-ruby) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# encoding: utf-8 | ||
require 'rubygems' | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks | ||
|
||
$:.unshift File.expand_path("../lib", __FILE__) | ||
|
||
require "rspec/core/rake_task" | ||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.ruby_opts = %w[-r./spec/coverage -w] | ||
end | ||
|
||
require_relative 'spec/capture_warnings' | ||
include CaptureWarnings | ||
namespace :spec do | ||
task :warnings do | ||
report_warnings do | ||
Rake::Task['spec'].invoke | ||
end | ||
end | ||
end | ||
|
||
task default: ['spec:warnings'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- encoding: utf-8 -*- | ||
Gem::Specification.new do |s| | ||
s.name = 'cucumber-messages' | ||
s.version = '1.0.0' | ||
s.authors = ["Aslak Hellesøy"] | ||
s.description = "Protocol Buffer messages for Cucumber's inter-process communication" | ||
s.summary = "cucumber-messages-#{s.version}" | ||
s.email = 'cukes@googlegroups.com' | ||
s.homepage = "https://github.com/cucumber/cucumber-messages-ruby#readme" | ||
s.platform = Gem::Platform::RUBY | ||
s.license = "MIT" | ||
s.required_ruby_version = ">= 1.9.3" | ||
|
||
# As of this writing (28 June 2018), the latest version is | ||
# 3.6.0, which doesn't works with JRuby. | ||
# See https://github.com/google/protobuf/issues/1594 | ||
# 3.1.0 works with JRuby, but fails with MRI 2.4.4 and above. | ||
# There doesn't seem to be a version that works with all rubies, | ||
# so we're picking the version that works with the most recent MRIs. | ||
s.add_dependency 'google-protobuf', '3.6.1' | ||
|
||
s.add_development_dependency 'bundler' | ||
s.add_development_dependency 'rake', '~> 12.3' | ||
s.add_development_dependency 'rspec', '~> 3.7' | ||
|
||
# For coverage reports | ||
s.add_development_dependency 'coveralls' | ||
|
||
s.rubygems_version = ">= 1.6.1" | ||
s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ } | ||
s.test_files = `git ls-files -- spec/*`.split("\n") | ||
s.rdoc_options = ["--charset=UTF-8"] | ||
s.require_path = "lib" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
SHELL := /usr/bin/env bash | ||
RUBY_SOURCE_FILES = $(shell find . -name "*.rb") | ||
GEMSPECS = $(shell find . -name "*.gemspec") | ||
|
||
ifdef TRAVIS_BRANCH | ||
LIBRARY_VERSION=$(TRAVIS_BRANCH) | ||
endif | ||
ifdef TRAVIS_TAG | ||
LIBRARY_VERSION=$(TRAVIS_TAG) | ||
endif | ||
ifndef LIBRARY_VERSION | ||
LIBRARY_VERSION=$(shell git rev-parse --abbrev-ref HEAD) | ||
endif | ||
|
||
default: .tested | ||
.PHONY: default | ||
|
||
.deps: Gemfile.lock | ||
|
||
Gemfile.lock: Gemfile $(GEMSPECS) | ||
bundle install | ||
touch $@ | ||
|
||
.tested: .deps $(RUBY_SOURCE_FILES) | ||
bundle exec rspec --color | ||
touch $@ | ||
|
||
clean: clean-ruby | ||
.PHONY: clean | ||
|
||
clean-ruby: | ||
rm -f .deps .linked .tested Gemfile.lock | ||
.PHONY: clean-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'cucumber/messages_pb' | ||
|
||
module Cucumber | ||
module Messages | ||
module Varint | ||
def decode_varint(io) | ||
# https://github.com/ruby-protobuf/protobuf/blob/master/lib/protobuf/varint_pure.rb | ||
value = index = 0 | ||
begin | ||
byte = io.readbyte | ||
value |= (byte & 0x7f) << (7 * index) | ||
index += 1 | ||
end while (byte & 0x80).nonzero? | ||
value | ||
end | ||
|
||
# https://www.rubydoc.info/gems/ruby-protocol-buffers/1.2.2/ProtocolBuffers%2FVarint.encode | ||
def encode_varint(io, int_val) | ||
if int_val < 0 | ||
# negative varints are always encoded with the full 10 bytes | ||
int_val = int_val & 0xffffffff_ffffffff | ||
end | ||
loop do | ||
byte = int_val & 0x7f | ||
int_val >>= 7 | ||
if int_val == 0 | ||
io << byte.chr | ||
break | ||
else | ||
io << (byte | 0x80).chr | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.