cucumber-messages 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +5 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
- data/.rspec +1 -0
- data/.rsync +4 -0
- data/.subrepo +1 -0
- data/.travis.yml +15 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/Makefile +9 -0
- data/README.md +2 -2
- data/Rakefile +23 -0
- data/cucumber-messages.gemspec +34 -0
- data/default.mk +33 -0
- data/lib/cucumber/messages.rb +32 -6
- data/lib/cucumber/messages_pb.rb +242 -0
- data/messages.proto +243 -0
- data/spec/capture_warnings.rb +74 -0
- data/spec/coverage.rb +7 -0
- data/spec/cucumber/messages/messages_spec.rb +23 -0
- metadata +51 -51
- data/VERSION +0 -1
- data/lib/cucumber/messages/id_generator.rb +0 -24
- data/lib/cucumber/messages/message/deserialization.rb +0 -37
- data/lib/cucumber/messages/message/serialization.rb +0 -70
- data/lib/cucumber/messages/message/utils.rb +0 -45
- data/lib/cucumber/messages/message.rb +0 -11
- data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +0 -21
- data/lib/cucumber/messages/time_conversion.rb +0 -33
- data/lib/cucumber/messages.deserializers.rb +0 -1208
- data/lib/cucumber/messages.dtos.rb +0 -1782
@@ -1,45 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
module Messages
|
3
|
-
class Message
|
4
|
-
module Utils
|
5
|
-
def self.included(other)
|
6
|
-
other.extend(ClassMethods)
|
7
|
-
end
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
##
|
11
|
-
# Makes an underscored, lowercase form from the expression in the string.
|
12
|
-
#
|
13
|
-
# underscore('GherkinDocument') # => "gherkin_document"
|
14
|
-
#
|
15
|
-
# This is a simplified version of the Ruby on Rails implementation
|
16
|
-
# https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L92
|
17
|
-
##
|
18
|
-
def underscore(term)
|
19
|
-
return term unless /[A-Z-]/.match?(term)
|
20
|
-
|
21
|
-
word = term.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
22
|
-
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
23
|
-
word.tr!("-", "_")
|
24
|
-
word.downcase!
|
25
|
-
word
|
26
|
-
end
|
27
|
-
|
28
|
-
##
|
29
|
-
# Converts strings to UpperCamelCase.
|
30
|
-
#
|
31
|
-
# camelize('gherkin_document') # => "GherkinDocument"
|
32
|
-
#
|
33
|
-
# This is a simplified version of the Ruby on Rails implementation
|
34
|
-
# https://github.com/rails/rails/blob/v6.1.3.2/activesupport/lib/active_support/inflector/methods.rb#L69
|
35
|
-
##
|
36
|
-
def camelize(term)
|
37
|
-
camelized = term.to_s
|
38
|
-
camelized.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
|
39
|
-
camelized
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'cucumber/messages/message/deserialization'
|
2
|
-
require 'cucumber/messages/message/serialization'
|
3
|
-
|
4
|
-
module Cucumber
|
5
|
-
module Messages
|
6
|
-
class Message
|
7
|
-
include Cucumber::Messages::Message::Deserialization
|
8
|
-
include Cucumber::Messages::Message::Serialization
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'cucumber/messages.deserializers'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Messages
|
5
|
-
class NdjsonToMessageEnumerator < Enumerator
|
6
|
-
def initialize(io)
|
7
|
-
super() do |yielder|
|
8
|
-
io.each_line do |line|
|
9
|
-
next if line.strip.empty?
|
10
|
-
begin
|
11
|
-
m = Envelope.from_json(line)
|
12
|
-
rescue => e
|
13
|
-
raise "Not JSON: #{line.strip}"
|
14
|
-
end
|
15
|
-
yielder.yield(m)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Cucumber
|
2
|
-
module Messages
|
3
|
-
module TimeConversion
|
4
|
-
NANOSECONDS_PER_SECOND = 1000000000
|
5
|
-
|
6
|
-
def time_to_timestamp(time)
|
7
|
-
{
|
8
|
-
'seconds' => time.to_i,
|
9
|
-
'nanos' => time.nsec
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
def timestamp_to_time(timestamp)
|
14
|
-
Time.at(timestamp['seconds'] + timestamp['nanos'].to_f / NANOSECONDS_PER_SECOND)
|
15
|
-
end
|
16
|
-
|
17
|
-
def seconds_to_duration(seconds_float)
|
18
|
-
seconds, second_modulus = seconds_float.divmod(1)
|
19
|
-
nanos = second_modulus * NANOSECONDS_PER_SECOND
|
20
|
-
{
|
21
|
-
'seconds' => seconds,
|
22
|
-
'nanos' => nanos.to_i
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def duration_to_seconds(duration)
|
27
|
-
seconds_part = duration['seconds']
|
28
|
-
nanos_part = duration['nanos'].to_f / NANOSECONDS_PER_SECOND
|
29
|
-
seconds_part + nanos_part
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|