gherkin 7.0.4 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gherkin +34 -12
- data/lib/gherkin.rb +42 -0
- data/lib/gherkin/ast_builder.rb +260 -0
- data/lib/gherkin/ast_node.rb +30 -0
- data/lib/gherkin/dialect.rb +2 -12
- data/lib/gherkin/errors.rb +45 -0
- data/lib/gherkin/gherkin-languages.json +3520 -0
- data/lib/gherkin/gherkin_line.rb +97 -0
- data/lib/gherkin/parser.rb +3429 -0
- data/lib/gherkin/pickles/compiler.rb +233 -0
- data/lib/gherkin/stream/parser_message_stream.rb +93 -0
- data/lib/gherkin/stream/protobuf_message_stream.rb +21 -0
- data/lib/gherkin/stream/subprocess_message_stream.rb +26 -0
- data/lib/gherkin/token.rb +18 -0
- data/lib/gherkin/token_formatter_builder.rb +39 -0
- data/lib/gherkin/token_matcher.rb +169 -0
- data/lib/gherkin/token_scanner.rb +40 -0
- data/spec/gherkin/gherkin_spec.rb +36 -345
- data/spec/gherkin/stream/subprocess_message_stream_spec.rb +18 -0
- metadata +28 -53
- data/executables/gherkin-darwin-386 +0 -0
- data/executables/gherkin-darwin-amd64 +0 -0
- data/executables/gherkin-freebsd-386 +0 -0
- data/executables/gherkin-freebsd-amd64 +0 -0
- data/executables/gherkin-freebsd-arm +0 -0
- data/executables/gherkin-linux-386 +0 -0
- data/executables/gherkin-linux-amd64 +0 -0
- data/executables/gherkin-linux-arm +0 -0
- data/executables/gherkin-linux-mips +0 -0
- data/executables/gherkin-linux-mips64 +0 -0
- data/executables/gherkin-linux-mips64le +0 -0
- data/executables/gherkin-linux-mipsle +0 -0
- data/executables/gherkin-linux-s390x +0 -0
- data/executables/gherkin-netbsd-386 +0 -0
- data/executables/gherkin-netbsd-amd64 +0 -0
- data/executables/gherkin-netbsd-arm +0 -0
- data/executables/gherkin-openbsd-386 +0 -0
- data/executables/gherkin-openbsd-amd64 +0 -0
- data/executables/gherkin-windows-386.exe +0 -0
- data/executables/gherkin-windows-amd64.exe +0 -0
- data/lib/gherkin/exe_file_path.rb +0 -3
- data/lib/gherkin/gherkin.rb +0 -72
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/gherkin/gherkin.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'open3'
|
2
|
-
require 'c21e/exe_file'
|
3
|
-
# require 'gherkin/protobuf_cucumber_messages'
|
4
|
-
require 'gherkin/exe_file_path'
|
5
|
-
require 'cucumber/messages'
|
6
|
-
|
7
|
-
module Gherkin
|
8
|
-
class Gherkin
|
9
|
-
|
10
|
-
DEFAULT_OPTIONS = {
|
11
|
-
include_source: true,
|
12
|
-
include_gherkin_document: true,
|
13
|
-
include_pickles: true
|
14
|
-
}.freeze
|
15
|
-
|
16
|
-
def self.from_paths(paths, options={})
|
17
|
-
self.new(paths, [], options).messages
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.from_sources(sources, options={})
|
21
|
-
self.new([], sources, options).messages
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.from_source(uri, data, options={})
|
25
|
-
from_sources([encode_source_message(uri, data)], options)
|
26
|
-
end
|
27
|
-
|
28
|
-
def initialize(paths, sources, options)
|
29
|
-
@paths = paths
|
30
|
-
@sources = sources
|
31
|
-
@options = DEFAULT_OPTIONS.merge(options)
|
32
|
-
@gherkin_executable = C21e::ExeFile.new(EXE_FILE_PATH).target_file
|
33
|
-
end
|
34
|
-
|
35
|
-
def messages
|
36
|
-
args = base_args
|
37
|
-
args = args.concat(@paths)
|
38
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3(*args)
|
39
|
-
stdin.binmode
|
40
|
-
@sources.each do |source|
|
41
|
-
wrapper = Cucumber::Messages::Envelope.new(
|
42
|
-
source: source
|
43
|
-
)
|
44
|
-
wrapper.write_delimited_to(stdin)
|
45
|
-
end
|
46
|
-
stdin.close
|
47
|
-
Cucumber::Messages::ProtobufIoEnumerator.call(stdout)
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def base_args
|
53
|
-
args = [@gherkin_executable]
|
54
|
-
args.push('--no-source') unless @options[:include_source]
|
55
|
-
args.push('--no-ast') unless @options[:include_gherkin_document]
|
56
|
-
args.push('--no-pickles') unless @options[:include_pickles]
|
57
|
-
args.push("--default-dialect=#{@options[:default_dialect]}") unless @options[:default_dialect].nil?
|
58
|
-
args
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.encode_source_message(uri, data)
|
62
|
-
media_obj = Cucumber::Messages::Media.new
|
63
|
-
media_obj.encoding = :UTF8
|
64
|
-
media_obj.content_type = 'text/x.cucumber.gherkin+plain'
|
65
|
-
source_obj = Cucumber::Messages::Source.new
|
66
|
-
source_obj.uri = uri
|
67
|
-
source_obj.data = data
|
68
|
-
source_obj.media = media_obj
|
69
|
-
source_obj
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|