gherkin 2.1.5-i386-mswin32 → 2.2.0-i386-mswin32

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 +17 -13
  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
@@ -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'
@@ -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
@@ -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
 
@@ -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
 
@@ -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
@@ -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")
@@ -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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
- - 1
9
- - 5
10
- version: 2.1.5
8
+ - 2
9
+ - 0
10
+ version: 2.2.0
11
11
  platform: i386-mswin32
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-17 00:00:00 +02:00
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: 53
81
+ hash: 59
82
82
  segments:
83
83
  - 0
84
- - 8
85
- - 5
86
- version: 0.8.5
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/1.8/gherkin_lexer_ar.so
146
147
  - lib/1.8/gherkin_lexer_bg.so
@@ -246,10 +247,11 @@ files:
246
247
  - lib/gherkin/formatter/pretty_formatter.rb
247
248
  - lib/gherkin/formatter/regexp_filter.rb
248
249
  - lib/gherkin/formatter/tag_count_formatter.rb
250
+ - lib/gherkin/formatter/tag_filter.rb
249
251
  - lib/gherkin/i18n.rb
250
252
  - lib/gherkin/i18n.yml
251
- - lib/gherkin/i18n_lexer.rb
252
253
  - lib/gherkin/json_parser.rb
254
+ - lib/gherkin/lexer/i18n_lexer.rb
253
255
  - lib/gherkin/listener/event.rb
254
256
  - lib/gherkin/listener/formatter_listener.rb
255
257
  - lib/gherkin/native.rb
@@ -300,10 +302,11 @@ files:
300
302
  - spec/gherkin/formatter/spaces.feature
301
303
  - spec/gherkin/formatter/tabs.feature
302
304
  - spec/gherkin/formatter/tag_count_formatter_spec.rb
303
- - spec/gherkin/i18n_lexer_spec.rb
304
305
  - spec/gherkin/i18n_spec.rb
305
306
  - spec/gherkin/java_lexer_spec.rb
307
+ - spec/gherkin/json.rb
306
308
  - spec/gherkin/json_parser_spec.rb
309
+ - spec/gherkin/lexer/i18n_lexer_spec.rb
307
310
  - spec/gherkin/output_stream_string_io.rb
308
311
  - spec/gherkin/parser/parser_spec.rb
309
312
  - spec/gherkin/rb_lexer_spec.rb
@@ -368,10 +371,11 @@ test_files:
368
371
  - spec/gherkin/formatter/model_spec.rb
369
372
  - spec/gherkin/formatter/pretty_formatter_spec.rb
370
373
  - spec/gherkin/formatter/tag_count_formatter_spec.rb
371
- - spec/gherkin/i18n_lexer_spec.rb
372
374
  - spec/gherkin/i18n_spec.rb
373
375
  - spec/gherkin/java_lexer_spec.rb
376
+ - spec/gherkin/json.rb
374
377
  - spec/gherkin/json_parser_spec.rb
378
+ - spec/gherkin/lexer/i18n_lexer_spec.rb
375
379
  - spec/gherkin/output_stream_string_io.rb
376
380
  - spec/gherkin/parser/parser_spec.rb
377
381
  - spec/gherkin/rb_lexer_spec.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