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.
Files changed (47) hide show
  1. data/History.txt +16 -0
  2. data/README.rdoc +1 -0
  3. data/Rakefile +1 -1
  4. data/VERSION.yml +2 -2
  5. data/features/json_formatter.feature +3 -11
  6. data/features/json_parser.feature +2 -5
  7. data/features/step_definitions/json_lexer_steps.rb +1 -1
  8. data/features/step_definitions/pretty_formatter_steps.rb +1 -1
  9. data/features/support/env.rb +2 -1
  10. data/java/src/main/java/gherkin/lexer/{.gitignore → i18n/.gitignore} +0 -0
  11. data/json-simple-1.1.dll +0 -0
  12. data/lib/gherkin.rb +1 -1
  13. data/lib/gherkin/formatter/filter_formatter.rb +52 -61
  14. data/lib/gherkin/formatter/json_formatter.rb +26 -94
  15. data/lib/gherkin/formatter/line_filter.rb +3 -3
  16. data/lib/gherkin/formatter/model.rb +156 -19
  17. data/lib/gherkin/formatter/pretty_formatter.rb +25 -25
  18. data/lib/gherkin/formatter/regexp_filter.rb +5 -1
  19. data/lib/gherkin/formatter/tag_count_formatter.rb +15 -12
  20. data/lib/gherkin/formatter/tag_filter.rb +19 -0
  21. data/lib/gherkin/json_parser.rb +49 -65
  22. data/lib/gherkin/lexer/i18n_lexer.rb +40 -0
  23. data/lib/gherkin/listener/formatter_listener.rb +11 -18
  24. data/lib/gherkin/parser/parser.rb +4 -5
  25. data/lib/gherkin/tools/stats_listener.rb +1 -1
  26. data/ragel/lexer.c.rl.erb +3 -1
  27. data/ragel/lexer.java.rl.erb +4 -4
  28. data/ragel/lexer.rb.rl.erb +3 -1
  29. data/spec/gherkin/fixtures/complex.json +2 -3
  30. data/spec/gherkin/formatter/model_spec.rb +1 -1
  31. data/spec/gherkin/formatter/pretty_formatter_spec.rb +11 -8
  32. data/spec/gherkin/i18n_spec.rb +3 -3
  33. data/spec/gherkin/java_lexer_spec.rb +1 -1
  34. data/spec/gherkin/json.rb +5 -0
  35. data/spec/gherkin/json_parser_spec.rb +49 -73
  36. data/spec/gherkin/lexer/i18n_lexer_spec.rb +33 -0
  37. data/spec/gherkin/sexp_recorder.rb +0 -2
  38. data/spec/spec_helper.rb +1 -0
  39. data/tasks/bench.rake +2 -2
  40. data/tasks/compile.rake +1 -1
  41. data/tasks/ikvm.rake +3 -1
  42. data/tasks/ragel_task.rb +1 -1
  43. data/tasks/release.rake +13 -1
  44. data/tasks/rspec.rake +0 -1
  45. metadata +15 -11
  46. data/lib/gherkin/i18n_lexer.rb +0 -38
  47. 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
@@ -48,8 +48,6 @@ module Gherkin
48
48
  o.value
49
49
  elsif(Formatter::Model::Tag === o)
50
50
  o.name
51
- elsif(Formatter::Model::Statement === o)
52
- "APE"
53
51
  else
54
52
  o
55
53
  end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,7 @@ require 'gherkin'
4
4
  require 'stringio'
5
5
  require 'gherkin/sexp_recorder'
6
6
  require 'gherkin/output_stream_string_io'
7
+ require 'gherkin/json'
7
8
  require 'gherkin/shared/lexer_group'
8
9
  require 'gherkin/shared/tags_group'
9
10
  require 'gherkin/shared/py_string_group'
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
@@ -10,7 +10,7 @@ CLEAN.include [
10
10
  'lib/gherkin/rb_lexer/*.rb',
11
11
  'lib/*.dll',
12
12
  'ext/**/*.c',
13
- 'java/src/main/java/gherkin/lexer/*.java',
13
+ 'java/src/main/java/gherkin/lexer/i18n/*.java',
14
14
  'java/src/main/resources/gherkin/*.properties',
15
15
  ]
16
16
 
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 lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.dll")
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
- sh("github upload #{Dir['gherkin*.dll'][0]}")
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
@@ -4,7 +4,6 @@ RSpec::Core::RakeTask.new(:spec)
4
4
  task :spec => [:check_dependencies]
5
5
 
6
6
  RSpec::Core::RakeTask.new(:rcov) do |t|
7
- t.pattern = 'spec/**/*_spec.rb'
8
7
  t.rcov = true
9
8
  t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/}
10
9
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 1
8
- - 5
9
- version: 2.1.5
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-17 00:00:00 +02:00
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
- - 8
76
- - 5
77
- version: 0.8.5
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
@@ -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