gherkin 2.1.5-java → 2.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +16 -0
- data/README.rdoc +1 -0
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/features/json_formatter.feature +3 -11
- data/features/json_parser.feature +2 -5
- data/features/step_definitions/json_lexer_steps.rb +1 -1
- data/features/step_definitions/pretty_formatter_steps.rb +1 -1
- data/features/support/env.rb +2 -1
- data/java/src/main/java/gherkin/lexer/{.gitignore → i18n/.gitignore} +0 -0
- data/json-simple-1.1.dll +0 -0
- data/lib/gherkin.rb +1 -1
- data/lib/gherkin/formatter/filter_formatter.rb +52 -61
- data/lib/gherkin/formatter/json_formatter.rb +26 -94
- data/lib/gherkin/formatter/line_filter.rb +3 -3
- data/lib/gherkin/formatter/model.rb +156 -19
- data/lib/gherkin/formatter/pretty_formatter.rb +25 -25
- data/lib/gherkin/formatter/regexp_filter.rb +5 -1
- data/lib/gherkin/formatter/tag_count_formatter.rb +15 -12
- data/lib/gherkin/formatter/tag_filter.rb +19 -0
- data/lib/gherkin/json_parser.rb +49 -65
- data/lib/gherkin/lexer/i18n_lexer.rb +40 -0
- data/lib/gherkin/listener/formatter_listener.rb +11 -18
- data/lib/gherkin/parser/parser.rb +4 -5
- data/lib/gherkin/tools/stats_listener.rb +1 -1
- data/ragel/lexer.c.rl.erb +3 -1
- data/ragel/lexer.java.rl.erb +4 -4
- data/ragel/lexer.rb.rl.erb +3 -1
- data/spec/gherkin/fixtures/complex.json +2 -3
- data/spec/gherkin/formatter/model_spec.rb +1 -1
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +11 -8
- data/spec/gherkin/i18n_spec.rb +3 -3
- data/spec/gherkin/java_lexer_spec.rb +1 -1
- data/spec/gherkin/json.rb +5 -0
- data/spec/gherkin/json_parser_spec.rb +49 -73
- data/spec/gherkin/lexer/i18n_lexer_spec.rb +33 -0
- data/spec/gherkin/sexp_recorder.rb +0 -2
- data/spec/spec_helper.rb +1 -0
- data/tasks/bench.rake +2 -2
- data/tasks/compile.rake +1 -1
- data/tasks/ikvm.rake +3 -1
- data/tasks/ragel_task.rb +1 -1
- data/tasks/release.rake +13 -1
- data/tasks/rspec.rake +0 -1
- metadata +15 -11
- data/lib/gherkin/i18n_lexer.rb +0 -38
- data/spec/gherkin/i18n_lexer_spec.rb +0 -26
@@ -0,0 +1,33 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
module Gherkin
|
5
|
+
module Lexer
|
6
|
+
describe I18nLexer do
|
7
|
+
before do
|
8
|
+
@lexer = Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, false)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should store the i18n language of the last scanned feature" do
|
12
|
+
@lexer.scan("# language: fr\n")
|
13
|
+
@lexer.i18n_language.iso_code.should == "fr"
|
14
|
+
@lexer.scan("# language: no\n")
|
15
|
+
@lexer.i18n_language.iso_code.should == "no"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should detect language when there are spaces and CRLF" do
|
19
|
+
@lexer.scan("# language: da \r\n")
|
20
|
+
@lexer.i18n_language.iso_code.should == "da"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should use English i18n by default" do
|
24
|
+
@lexer.scan("Feature: foo\n")
|
25
|
+
@lexer.i18n_language.iso_code.should == "en"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should === its ruby class, even when the impl is Java" do
|
29
|
+
Gherkin::Lexer::I18nLexer.should === Gherkin::Lexer::I18nLexer.new(Gherkin::SexpRecorder.new, true)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/tasks/bench.rake
CHANGED
@@ -124,9 +124,9 @@ class Benchmarker
|
|
124
124
|
|
125
125
|
def run_native_gherkin_no_parser
|
126
126
|
require 'gherkin'
|
127
|
-
require 'gherkin/i18n_lexer'
|
127
|
+
require 'gherkin/lexer/i18n_lexer'
|
128
128
|
require 'null_listener'
|
129
|
-
lexer = Gherkin::I18nLexer.new(NullListener.new, false)
|
129
|
+
lexer = Gherkin::Lexer::I18nLexer.new(NullListener.new, false)
|
130
130
|
@features.each do |feature|
|
131
131
|
lexer.scan(File.read(feature), feature, 0)
|
132
132
|
end
|
data/tasks/compile.rake
CHANGED
data/tasks/ikvm.rake
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec/gherkin/json'
|
1
2
|
# To test out the pure Java main program on .NET, execute:
|
2
3
|
#
|
3
4
|
# rake ikvm
|
@@ -28,7 +29,8 @@ namespace :ikvm do
|
|
28
29
|
desc 'Make a .NET .dll'
|
29
30
|
task :dll => 'lib/gherkin.jar' do
|
30
31
|
mkdir_p 'release' unless File.directory?('release')
|
31
|
-
sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library
|
32
|
+
sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library #{JSON_SIMPLE_JAR} -out:release/json-simple.dll")
|
33
|
+
sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.dll -reference:release/json-simple.dll")
|
32
34
|
cp "release/gherkin-#{GHERKIN_VERSION}.dll", 'lib/gherkin.dll'
|
33
35
|
end
|
34
36
|
|
data/tasks/ragel_task.rb
CHANGED
@@ -28,7 +28,7 @@ class RagelTask
|
|
28
28
|
def target
|
29
29
|
{
|
30
30
|
'c' => "ext/gherkin_lexer_#{@i18n.underscored_iso_code}/gherkin_lexer_#{@i18n.underscored_iso_code}.c",
|
31
|
-
'java' => "java/src/main/java/gherkin/lexer/#{@i18n.underscored_iso_code.upcase}.java",
|
31
|
+
'java' => "java/src/main/java/gherkin/lexer/i18n/#{@i18n.underscored_iso_code.upcase}.java",
|
32
32
|
'rb' => "lib/gherkin/rb_lexer/#{@i18n.underscored_iso_code}.rb"
|
33
33
|
}[@lang]
|
34
34
|
end
|
data/tasks/release.rake
CHANGED
@@ -2,6 +2,7 @@ namespace :release do
|
|
2
2
|
desc 'Uplad all packages and tag git'
|
3
3
|
task :ALL => [:gems, :push_dll, :push_jar, :push_gems, 'git:release']
|
4
4
|
|
5
|
+
desc 'Push all gems to rubygems.org (gemcutter)'
|
5
6
|
task :push_gems do
|
6
7
|
Dir.chdir('release') do
|
7
8
|
Dir['*.gem'].each do |gem_file|
|
@@ -10,14 +11,25 @@ namespace :release do
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
14
|
+
desc 'Push dll to Github'
|
13
15
|
task :push_dll => :ikvm do
|
14
16
|
Dir.chdir('release') do
|
15
17
|
# This requires aslakhellesoy's build of the github gem,
|
16
18
|
# which has tekkub's upload command.
|
17
|
-
|
19
|
+
begin
|
20
|
+
sh("github upload gherkin-#{GHERKIN_VERSION}.dll")
|
21
|
+
rescue => e
|
22
|
+
# For some reason we're getting an error even if the upload is successful. Verify that here...
|
23
|
+
head = `curl -I -X HEAD http://github.com/downloads/aslakhellesoy/gherkin/gherkin-#{GHERKIN_VERSION}.dll`
|
24
|
+
if !(head =~ /302 Found/in)
|
25
|
+
e.message << "\n\nUpload of gherkin-#{GHERKIN_VERSION}.dll failed:\n\n#{head}"
|
26
|
+
raise e
|
27
|
+
end
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
|
32
|
+
desc 'Push jar to cukes.info Maven repo'
|
21
33
|
task :push_jar do
|
22
34
|
Dir.chdir('java') do
|
23
35
|
sh("mvn -Dmaven.wagon.provider.http=httpclient deploy")
|
data/tasks/rspec.rake
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 2.
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 2.2.0
|
10
10
|
platform: java
|
11
11
|
authors:
|
12
12
|
- Mike Sassak
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-07-
|
19
|
+
date: 2010-07-26 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -72,9 +72,9 @@ dependencies:
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
-
|
76
|
-
-
|
77
|
-
version: 0.
|
75
|
+
- 9
|
76
|
+
- 0
|
77
|
+
version: 0.9.0
|
78
78
|
type: :development
|
79
79
|
version_requirements: *id004
|
80
80
|
description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
|
@@ -114,8 +114,9 @@ files:
|
|
114
114
|
- features/support/env.rb
|
115
115
|
- ikvm/.gitignore
|
116
116
|
- java/.gitignore
|
117
|
-
- java/src/main/java/gherkin/lexer/.gitignore
|
117
|
+
- java/src/main/java/gherkin/lexer/i18n/.gitignore
|
118
118
|
- java/src/main/resources/gherkin/.gitignore
|
119
|
+
- json-simple-1.1.dll
|
119
120
|
- lib/.gitignore
|
120
121
|
- lib/gherkin.jar
|
121
122
|
- lib/gherkin.rb
|
@@ -132,10 +133,11 @@ files:
|
|
132
133
|
- lib/gherkin/formatter/pretty_formatter.rb
|
133
134
|
- lib/gherkin/formatter/regexp_filter.rb
|
134
135
|
- lib/gherkin/formatter/tag_count_formatter.rb
|
136
|
+
- lib/gherkin/formatter/tag_filter.rb
|
135
137
|
- lib/gherkin/i18n.rb
|
136
138
|
- lib/gherkin/i18n.yml
|
137
|
-
- lib/gherkin/i18n_lexer.rb
|
138
139
|
- lib/gherkin/json_parser.rb
|
140
|
+
- lib/gherkin/lexer/i18n_lexer.rb
|
139
141
|
- lib/gherkin/listener/event.rb
|
140
142
|
- lib/gherkin/listener/formatter_listener.rb
|
141
143
|
- lib/gherkin/native.rb
|
@@ -186,10 +188,11 @@ files:
|
|
186
188
|
- spec/gherkin/formatter/spaces.feature
|
187
189
|
- spec/gherkin/formatter/tabs.feature
|
188
190
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
189
|
-
- spec/gherkin/i18n_lexer_spec.rb
|
190
191
|
- spec/gherkin/i18n_spec.rb
|
191
192
|
- spec/gherkin/java_lexer_spec.rb
|
193
|
+
- spec/gherkin/json.rb
|
192
194
|
- spec/gherkin/json_parser_spec.rb
|
195
|
+
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
193
196
|
- spec/gherkin/output_stream_string_io.rb
|
194
197
|
- spec/gherkin/parser/parser_spec.rb
|
195
198
|
- spec/gherkin/rb_lexer_spec.rb
|
@@ -245,9 +248,9 @@ summary: Fast Gherkin lexer/parser
|
|
245
248
|
test_files:
|
246
249
|
- spec/spec_helper.rb
|
247
250
|
- spec/gherkin/c_lexer_spec.rb
|
248
|
-
- spec/gherkin/i18n_lexer_spec.rb
|
249
251
|
- spec/gherkin/i18n_spec.rb
|
250
252
|
- spec/gherkin/java_lexer_spec.rb
|
253
|
+
- spec/gherkin/json.rb
|
251
254
|
- spec/gherkin/json_parser_spec.rb
|
252
255
|
- spec/gherkin/output_stream_string_io.rb
|
253
256
|
- spec/gherkin/rb_lexer_spec.rb
|
@@ -259,6 +262,7 @@ test_files:
|
|
259
262
|
- spec/gherkin/formatter/model_spec.rb
|
260
263
|
- spec/gherkin/formatter/pretty_formatter_spec.rb
|
261
264
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
265
|
+
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
262
266
|
- spec/gherkin/parser/parser_spec.rb
|
263
267
|
- spec/gherkin/shared/lexer_group.rb
|
264
268
|
- spec/gherkin/shared/py_string_group.rb
|
data/lib/gherkin/i18n_lexer.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'gherkin/i18n'
|
2
|
-
require 'gherkin/native'
|
3
|
-
|
4
|
-
module Gherkin
|
5
|
-
I18nLexerNotFound = Class.new(LoadError)
|
6
|
-
LexingError = Class.new(StandardError)
|
7
|
-
|
8
|
-
# The main entry point to lexing Gherkin source.
|
9
|
-
class I18nLexer
|
10
|
-
native_impl('gherkin')
|
11
|
-
|
12
|
-
LANGUAGE_PATTERN = /language\s*:\s*(.*)/ #:nodoc:
|
13
|
-
attr_reader :i18n_language
|
14
|
-
|
15
|
-
def initialize(listener, force_ruby=false)
|
16
|
-
@listener = listener
|
17
|
-
@force_ruby = force_ruby
|
18
|
-
end
|
19
|
-
|
20
|
-
def scan(source)
|
21
|
-
create_delegate(source).scan(source)
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def create_delegate(source)
|
27
|
-
@i18n_language = lang(source)
|
28
|
-
@i18n_language.lexer(@listener, @force_ruby)
|
29
|
-
end
|
30
|
-
|
31
|
-
def lang(source)
|
32
|
-
line_one = source.split(/\n/)[0]
|
33
|
-
match = LANGUAGE_PATTERN.match(line_one)
|
34
|
-
I18n.get(match ? match[1] : 'en')
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
module Gherkin
|
5
|
-
describe I18nLexer do
|
6
|
-
before do
|
7
|
-
@lexer = Gherkin::I18nLexer.new(Gherkin::SexpRecorder.new, false)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should store the i18n language of the last scanned feature" do
|
11
|
-
@lexer.scan("# language: fr\n")
|
12
|
-
@lexer.i18n_language.iso_code.should == "fr"
|
13
|
-
@lexer.scan("# language: no\n")
|
14
|
-
@lexer.i18n_language.iso_code.should == "no"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should use English i18n by default" do
|
18
|
-
@lexer.scan("Feature: foo\n")
|
19
|
-
@lexer.i18n_language.iso_code.should == "en"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should === its ruby class, even when the impl is Java" do
|
23
|
-
Gherkin::I18nLexer.should === Gherkin::I18nLexer.new(Gherkin::SexpRecorder.new, true)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|