gherkin 2.11.0-java → 2.11.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [2.11.1](https://github.com/cucumber/gherkin/compare/v2.11.0...v2.11.1)
2
+
3
+ * [JavaScript] Native implementation of JSONFormatter (Aslak Hellesøy)
4
+ * [Core] Add more accurate polish translations. ([#181](https://github.com/cucumber/gherkin/pull/181) Adam Stankiewicz)
5
+
1
6
  ## [2.11.0](https://github.com/cucumber/gherkin/compare/v2.10.0...v2.11.0)
2
7
 
3
8
  * [Core] Alias Feature with Business Need and Ability. ([#167](https://github.com/cucumber/gherkin/issues/167) Aslak Hellesøy)
data/README.md CHANGED
@@ -54,7 +54,7 @@ The jar file is in the central Maven repo.
54
54
  <dependency>
55
55
  <groupId>info.cukes</groupId>
56
56
  <artifactId>gherkin</artifactId>
57
- <version>2.11.0</version>
57
+ <version>2.11.1</version>
58
58
  </dependency>
59
59
 
60
60
  You can get it manually from [Maven Central](http://search.maven.org/#browse%7C-2073395818)
@@ -143,10 +143,19 @@ And you can try it out with node.js:
143
143
 
144
144
  node js/example/print.js spec/gherkin/fixtures/1.feature
145
145
 
146
+ Or the json formatter:
147
+
148
+ node js/example/json_fomratter_example.js
149
+
146
150
  If you're hacking and just want to rebuild the English parser:
147
151
 
148
152
  rake js/lib/gherkin/lexer/en.js
149
153
 
154
+ In order to test the native JavaScript implementation of JSONFormatter, you also need to define the `GHERKIN_JS_NATIVE` environment
155
+ variable. It's recommended you don't do this permanently, as it will disable testing the Ruby implementation. Try this instead:
156
+
157
+ GHERKIN_JS_NATIVE=true GHERKIN_JS=true bundle exec rake
158
+
150
159
  TODO: Make all specs pass with js lexer - replace 'c(listener)' with 'js(listener)' in i18n.rb
151
160
 
152
161
  ### .NET dll
@@ -230,6 +239,10 @@ Make sure you have access to all the servers where packages are being uploaded:
230
239
  * Make sure you have a key [with no sub-key](https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven)
231
240
  * nuget: See .NET section above
232
241
 
242
+ Run tests once with GHERKIN_JS_NATIVE=true:
243
+
244
+ GHERKIN_JS_NATIVE=true GHERKIN_JS=true bundle exec rake
245
+
233
246
  Now we can release:
234
247
 
235
248
  * Make sure GHERKIN_JS is defined (see JavaScript section above)
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  # When both are building OK, do a `bundle exec rake install` in both cucumber and gherkin projects, revert the changes in the first 2 steps
16
16
  # and release both projects. Do this for both ruby 1.8.7, ruby 1.9.3 and jruby.
17
17
  #
18
- s.version = "2.11.0"
18
+ s.version = "2.11.1"
19
19
  s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
20
20
  s.description = "A fast Gherkin lexer/parser based on the Ragel State Machine Compiler."
21
21
  s.summary = "#{s.name}-#{s.version}"
Binary file
@@ -84,7 +84,7 @@ module Gherkin
84
84
  private
85
85
 
86
86
  def add_hook(match, result, hook)
87
- hooks = (feature_element[hook] ||= []);
87
+ hooks = feature_element[hook] ||= []
88
88
  hooks << {'match' => match.to_hash, 'result' => result.to_hash}
89
89
  end
90
90
 
@@ -432,13 +432,13 @@
432
432
  "pl":
433
433
  name: Polish
434
434
  native: polski
435
- feature: Właściwość
435
+ feature: Właściwość|Funkcja|Aspekt|Potrzeba biznesowa
436
436
  background: Założenia
437
437
  scenario: Scenariusz
438
438
  scenario_outline: Szablon scenariusza
439
439
  examples: Przykłady
440
440
  given: "*|Zakładając|Mając"
441
- when: "*|Jeżeli|Jeśli"
441
+ when: "*|Jeżeli|Jeśli|Gdy|Kiedy"
442
442
  then: "*|Wtedy"
443
443
  and: "*|Oraz|I"
444
444
  but: "*|Ale"
@@ -1,7 +1,7 @@
1
1
  require 'v8'
2
2
 
3
3
  module Gherkin
4
- # Thin adapter for the Javascript lexer, primarily used for testing.
4
+ # Thin adapter for the JavaScript lexer, primarily used for testing.
5
5
  class JsLexer
6
6
  def self.[](i18n_underscored_iso_code)
7
7
  cxt = V8::Context.new
@@ -17,4 +17,4 @@ module Gherkin
17
17
  cxt['exports']['Lexer']
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -1,7 +1,7 @@
1
- if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ironruby"
2
- require 'gherkin/native/ikvm'
3
- elsif defined?(JRUBY_VERSION)
1
+ if defined?(JRUBY_VERSION)
4
2
  require 'gherkin/native/java'
3
+ elsif ENV['GHERKIN_JS_NATIVE']
4
+ require 'gherkin/native/therubyracer'
5
5
  else
6
6
  require 'gherkin/native/null'
7
- end
7
+ end
@@ -17,10 +17,6 @@ class Class
17
17
  end
18
18
  end
19
19
 
20
- def implements(java_class_name)
21
- # no-op
22
- end
23
-
24
20
  # Causes a Java class to be instantiated instead of the Ruby class when
25
21
  # running on JRuby. This is used to test both pure Java and pure Ruby classes
26
22
  # from the same Ruby based test suite. The Java Class must have a package name
@@ -29,6 +25,18 @@ class Class
29
25
  require "#{lib}.jar"
30
26
 
31
27
  class << self
28
+ def new(*args)
29
+ begin
30
+ java_class.new(*javaify(args))
31
+ rescue ArgumentError => e
32
+ e.message << "\n#{java_class.name}"
33
+ raise e
34
+ rescue NameError => e
35
+ e.message << "\n args: #{args.inspect}"
36
+ raise e
37
+ end
38
+ end
39
+
32
40
  def javaify(arg)
33
41
  if Array === arg
34
42
  arg.map{|a| javaify(a)}
@@ -46,18 +54,6 @@ class Class
46
54
  end
47
55
  end
48
56
 
49
- def new(*args)
50
- begin
51
- java_class.new(*javaify(args))
52
- rescue ArgumentError => e
53
- e.message << "\n#{java_class.name}"
54
- raise e
55
- rescue NameError => e
56
- e.message << "\n args: #{args.inspect}"
57
- raise e
58
- end
59
- end
60
-
61
57
  def ===(object)
62
58
  super || object.java_kind_of?(java_class)
63
59
  end
@@ -1,9 +1,5 @@
1
1
  class Class
2
- def implements(java_class_name)
3
- # no-op
4
- end
5
-
6
2
  def native_impl(lib)
7
3
  # no-op
8
4
  end
9
- end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'v8'
2
+
3
+ class Class
4
+ def native_impl(lib)
5
+ class << self
6
+ def new(*args)
7
+ js = {
8
+ 'Gherkin::Formatter::JSONFormatter' => 'js/lib/gherkin/formatter/json_formatter.js'
9
+ }[self.name]
10
+ if(js)
11
+ Proxy.new(js, *args)
12
+ else
13
+ super(*args)
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ class Proxy
20
+ def initialize(js, *args)
21
+ cxt = V8::Context.new
22
+ cxt['module'] = {}
23
+
24
+ # Mimic Node.js / Firebug console.log
25
+ cxt['console'] = STDOUT
26
+ def STDOUT.log(*a)
27
+ puts sprintf(*a)
28
+ end
29
+
30
+ cxt.load(js)
31
+ @js_obj = cxt['module']['exports'].new(*args)
32
+ end
33
+
34
+ def method_missing(name, *args)
35
+ a = args.map{|a| a.respond_to?(:to_hash) ? a.to_hash : a}
36
+ @js_obj.__send__(name, *a)
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  #encoding: utf-8
2
- unless defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == "ironruby")
2
+ unless defined?(JRUBY_VERSION)
3
3
  require 'spec_helper'
4
4
  require 'gherkin_lexer_en'
5
5
 
@@ -85,7 +85,6 @@ module Gherkin
85
85
  }
86
86
  ]
87
87
  }
88
-
89
88
  JSON.parse(expected).should == JSON.parse(io.string)
90
89
  end
91
90
  end
@@ -1,11 +1,11 @@
1
1
  #encoding: utf-8
2
- if !defined?(JRUBY_VERSION) && !(defined?(RUBY_ENGINE) && RUBY_ENGINE == "ironruby") && ENV['GHERKIN_JS']
2
+ if !defined?(JRUBY_VERSION) && ENV['GHERKIN_JS']
3
3
  require 'spec_helper'
4
4
  require 'gherkin/js_lexer'
5
5
 
6
6
  module Gherkin
7
7
  module Lexer
8
- describe "Javascript Lexer" do
8
+ describe "JavaScript Lexer" do
9
9
  before do
10
10
  @listener = Gherkin::SexpRecorder.new
11
11
  @lexer = Gherkin::JsLexer['en'].new(@listener)
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'erb'
3
+ require 'rbconfig'
3
4
 
4
5
  class RagelTask
5
6
  begin
@@ -27,7 +28,8 @@ class RagelTask
27
28
  sh "ragel #{flags} #{lang_ragel} -o #{target}"
28
29
  if(@lang == 'js')
29
30
  # Ragel chokes if we put the escaped triple quotes in .rl, so we'll do the replace with sed after the fact. Lots of backslashes!!
30
- sh %{sed -i '' 's/ESCAPED_TRIPLE_QUOTE/\\\\\\\\\\\\"\\\\\\\\\\\\"\\\\\\\\\\\\"/' #{target}}
31
+ sed = Config::CONFIG['host_os'] =~ /linux/i ? "sed -i" : "sed -i ''"
32
+ sh %{#{sed} 's/ESCAPED_TRIPLE_QUOTE/\\\\\\\\\\\\"\\\\\\\\\\\\"\\\\\\\\\\\\"/' #{target}}
31
33
 
32
34
  # Minify
33
35
  sh %{node #{UGLIFYJS} #{target} > #{target.gsub(/\.js$/, '.min.js')}}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0
4
+ version: 2.11.1
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-06-08 00:00:00.000000000 Z
14
+ date: 2012-06-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -252,9 +252,9 @@ files:
252
252
  - lib/gherkin/listener/event.rb
253
253
  - lib/gherkin/listener/formatter_listener.rb
254
254
  - lib/gherkin/native.rb
255
- - lib/gherkin/native/ikvm.rb
256
255
  - lib/gherkin/native/java.rb
257
256
  - lib/gherkin/native/null.rb
257
+ - lib/gherkin/native/therubyracer.rb
258
258
  - lib/gherkin/parser/meta.txt
259
259
  - lib/gherkin/parser/parser.rb
260
260
  - lib/gherkin/parser/root.txt
@@ -360,7 +360,7 @@ rubyforge_project:
360
360
  rubygems_version: 1.8.24
361
361
  signing_key:
362
362
  specification_version: 3
363
- summary: gherkin-2.11.0
363
+ summary: gherkin-2.11.1
364
364
  test_files:
365
365
  - features/escaped_pipes.feature
366
366
  - features/feature_parser.feature
@@ -1,55 +0,0 @@
1
- class Class
2
-
3
- def implements(java_class_name)
4
- m = java_class_name.split('.').inject(Object) do |mod, name|
5
- mod = mod.const_get(name)
6
- end
7
- include m
8
- end
9
-
10
- # Causes a .NET class to be instantiated instead of the Ruby class when
11
- # running on IronRuby. This is used to test both pure .NET and pure Ruby classes
12
- # from the same Ruby based test suite. The .NET Class must have a package name
13
- # that corresponds with the Ruby class.
14
- def native_impl(lib)
15
- begin
16
- load_assembly(lib)
17
- rescue LoadError => e
18
- e.message << "\nTry this: SET MONO_PATH=#{File.expand_path(File.dirname(__FILE__) + '/../..')} (or export MONO_PATH=...)"
19
- raise e
20
- end
21
-
22
- class << self
23
- def ikvmify(arg)
24
- if Array === arg
25
- arg.map{|a| ikvmify(a)}
26
- else
27
- case(arg)
28
- when Regexp
29
- Object.const_get('java').const_get('util').const_get('regex').const_get('Pattern').compile(arg.source)
30
- else
31
- arg
32
- end
33
- end
34
- end
35
-
36
- def new(*args)
37
- ikvm_class.new(*ikvmify(args))
38
- end
39
-
40
- def ===(object)
41
- super || object.java_kind_of?(java_class)
42
- end
43
-
44
- def ikvm_class
45
- names = self.name.split('::')
46
- namespace = Object
47
- names[0..-2].each do |module_name|
48
- namespace = namespace.const_get(module_name.downcase)
49
- end
50
-
51
- namespace.const_get(names[-1])
52
- end
53
- end
54
- end
55
- end