gherkin 2.1.5-universal-dotnet → 2.2.0-universal-dotnet
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 +17 -13
- 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
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gherkin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: universal-dotnet
|
12
12
|
authors:
|
13
13
|
- Mike Sassak
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-07-
|
20
|
+
date: 2010-07-26 00:00:00 +02:00
|
21
21
|
default_executable: gherkin
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -78,12 +78,12 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
hash:
|
81
|
+
hash: 59
|
82
82
|
segments:
|
83
83
|
- 0
|
84
|
-
-
|
85
|
-
-
|
86
|
-
version: 0.
|
84
|
+
- 9
|
85
|
+
- 0
|
86
|
+
version: 0.9.0
|
87
87
|
type: :development
|
88
88
|
version_requirements: *id004
|
89
89
|
- !ruby/object:Gem::Dependency
|
@@ -139,8 +139,9 @@ files:
|
|
139
139
|
- features/support/env.rb
|
140
140
|
- ikvm/.gitignore
|
141
141
|
- java/.gitignore
|
142
|
-
- java/src/main/java/gherkin/lexer/.gitignore
|
142
|
+
- java/src/main/java/gherkin/lexer/i18n/.gitignore
|
143
143
|
- java/src/main/resources/gherkin/.gitignore
|
144
|
+
- json-simple-1.1.dll
|
144
145
|
- lib/.gitignore
|
145
146
|
- lib/IKVM.OpenJDK.Core.dll
|
146
147
|
- lib/IKVM.OpenJDK.Security.dll
|
@@ -161,10 +162,11 @@ files:
|
|
161
162
|
- lib/gherkin/formatter/pretty_formatter.rb
|
162
163
|
- lib/gherkin/formatter/regexp_filter.rb
|
163
164
|
- lib/gherkin/formatter/tag_count_formatter.rb
|
165
|
+
- lib/gherkin/formatter/tag_filter.rb
|
164
166
|
- lib/gherkin/i18n.rb
|
165
167
|
- lib/gherkin/i18n.yml
|
166
|
-
- lib/gherkin/i18n_lexer.rb
|
167
168
|
- lib/gherkin/json_parser.rb
|
169
|
+
- lib/gherkin/lexer/i18n_lexer.rb
|
168
170
|
- lib/gherkin/listener/event.rb
|
169
171
|
- lib/gherkin/listener/formatter_listener.rb
|
170
172
|
- lib/gherkin/native.rb
|
@@ -215,10 +217,11 @@ files:
|
|
215
217
|
- spec/gherkin/formatter/spaces.feature
|
216
218
|
- spec/gherkin/formatter/tabs.feature
|
217
219
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
218
|
-
- spec/gherkin/i18n_lexer_spec.rb
|
219
220
|
- spec/gherkin/i18n_spec.rb
|
220
221
|
- spec/gherkin/java_lexer_spec.rb
|
222
|
+
- spec/gherkin/json.rb
|
221
223
|
- spec/gherkin/json_parser_spec.rb
|
224
|
+
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
222
225
|
- spec/gherkin/output_stream_string_io.rb
|
223
226
|
- spec/gherkin/parser/parser_spec.rb
|
224
227
|
- spec/gherkin/rb_lexer_spec.rb
|
@@ -283,10 +286,11 @@ test_files:
|
|
283
286
|
- spec/gherkin/formatter/model_spec.rb
|
284
287
|
- spec/gherkin/formatter/pretty_formatter_spec.rb
|
285
288
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
286
|
-
- spec/gherkin/i18n_lexer_spec.rb
|
287
289
|
- spec/gherkin/i18n_spec.rb
|
288
290
|
- spec/gherkin/java_lexer_spec.rb
|
291
|
+
- spec/gherkin/json.rb
|
289
292
|
- spec/gherkin/json_parser_spec.rb
|
293
|
+
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
290
294
|
- spec/gherkin/output_stream_string_io.rb
|
291
295
|
- spec/gherkin/parser/parser_spec.rb
|
292
296
|
- spec/gherkin/rb_lexer_spec.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
|