gherkin 1.0.29 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 1.0.30 (2010-05-18)
2
+
3
+ === New Features
4
+ * Native gems for IronRuby. Bundles IKVM OpenJDK dlls as well as ikvmc-compiled gherkin.dll. Experimental! (Aslak Hellesøy)
5
+
1
6
  == 1.0.29 (2010-05-18)
2
7
 
3
8
  === Bugfixes
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ begin
20
20
  gem.executables = ["gherkin"]
21
21
  gem.add_dependency "trollop", ">= 1.16.2"
22
22
  gem.add_development_dependency "rspec", ">= 1.3.0"
23
- # gem.add_development_dependency "cucumber", ">= 0.7.2"
23
+ gem.add_development_dependency "cucumber", ">= 0.7.2"
24
24
  gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
25
25
 
26
26
  gem.files -= FileList['ikvm/**/*']
@@ -34,6 +34,10 @@ begin
34
34
  gem.platform = ENV['PLATFORM']
35
35
  gem.files += FileList['lib/*/*.so']
36
36
  gem.extensions = []
37
+ when 'universal-dotnet'
38
+ gem.platform = ENV['PLATFORM']
39
+ gem.files += FileList['lib/*.dll']
40
+ gem.extensions = []
37
41
  else
38
42
  gem.files += FileList['lib/gherkin/rb_lexer/*.rb']
39
43
  gem.files += FileList['ext/**/*.c']
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 0
4
4
  :build:
5
- :patch: 29
5
+ :patch: 30
@@ -17,11 +17,11 @@ module Gherkin
17
17
 
18
18
  cmd_name = args.shift
19
19
  die("Missing command") if cmd_name.nil?
20
- cmd = Tools.const_get(cmd_name.capitalize.to_sym).new(args) rescue die("Unknown command #{cmd_name}")
21
20
  begin
21
+ cmd = Tools.const_get(cmd_name.capitalize.to_sym).new(args)
22
22
  cmd.run
23
23
  rescue => e
24
- Trollop::die(e.message)
24
+ Trollop::die(e.message + "\nCommand: #{cmd_name}")
25
25
  end
26
26
  end
27
27
 
@@ -1,9 +1,9 @@
1
+ require 'gherkin/native'
2
+
1
3
  module Gherkin
2
4
  module Formatter
3
5
  class Argument
4
- require 'gherkin/java_impl'
5
- java_impl('gherkin.jar')
6
-
6
+ native_impl('gherkin')
7
7
  attr_reader :byte_offset, :val
8
8
 
9
9
  def initialize(byte_offset, val)
@@ -1,15 +1,14 @@
1
1
  # encoding: utf-8
2
-
3
2
  require 'gherkin/formatter/colors'
4
3
  require 'gherkin/formatter/monochrome_format'
5
4
  require 'gherkin/formatter/argument'
6
5
  require 'gherkin/formatter/escaping'
6
+ require 'gherkin/native'
7
7
 
8
8
  module Gherkin
9
9
  module Formatter
10
10
  class PrettyFormatter
11
- require 'gherkin/java_impl'
12
- java_impl('gherkin.jar')
11
+ native_impl('gherkin')
13
12
 
14
13
  include Colors
15
14
  include Escaping
@@ -1,12 +1,10 @@
1
1
  require 'yaml'
2
2
  require 'gherkin/rubify'
3
+ require 'gherkin/native'
3
4
 
4
5
  module Gherkin
5
6
  class I18n
6
- unless defined?(BYPASS_JAVA_IMPL)
7
- require 'gherkin/java_impl'
8
- java_impl('gherkin.jar')
9
- end
7
+ native_impl('gherkin') unless defined?(BYPASS_NATIVE_IMPL)
10
8
 
11
9
  FEATURE_ELEMENT_KEYS = %w{feature background scenario scenario_outline examples}
12
10
  STEP_KEYWORD_KEYS = %w{given when then and but}
@@ -1,4 +1,5 @@
1
1
  require 'gherkin/i18n'
2
+ require 'gherkin/native'
2
3
 
3
4
  module Gherkin
4
5
  I18nLexerNotFound = Class.new(LoadError)
@@ -6,8 +7,7 @@ module Gherkin
6
7
 
7
8
  # The main entry point to lexing Gherkin source.
8
9
  class I18nLexer
9
- require 'gherkin/java_impl'
10
- java_impl('gherkin.jar')
10
+ native_impl('gherkin')
11
11
 
12
12
  LANGUAGE_PATTERN = /language\s*:\s*(.*)/ #:nodoc:
13
13
  attr_reader :i18n_language
@@ -0,0 +1,7 @@
1
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ironruby"
2
+ require 'gherkin/native/ikvm'
3
+ elsif defined?(JRUBY_VERSION)
4
+ require 'gherkin/native/java'
5
+ else
6
+ require 'gherkin/native/null'
7
+ end
@@ -0,0 +1,55 @@
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
@@ -0,0 +1,47 @@
1
+ class Class
2
+
3
+ def implements(java_class_name)
4
+ # no-op
5
+ end
6
+
7
+ # Causes a Java class to be instantiated instead of the Ruby class when
8
+ # running on JRuby. This is used to test both pure Java and pure Ruby classes
9
+ # from the same Ruby based test suite. The Java Class must have a package name
10
+ # that corresponds with the Ruby class.
11
+ def native_impl(lib)
12
+ require "#{lib}.jar"
13
+
14
+ class << self
15
+ def javaify(arg)
16
+ if Array === arg
17
+ arg.map{|a| javaify(a)}
18
+ else
19
+ case(arg)
20
+ when Regexp
21
+ java.util.regex.Pattern.compile(arg.source)
22
+ else
23
+ arg
24
+ end
25
+ end
26
+ end
27
+
28
+ def new(*args)
29
+ java_class.new(*javaify(args))
30
+ end
31
+
32
+ def ===(object)
33
+ super || object.java_kind_of?(java_class)
34
+ end
35
+
36
+ def java_class
37
+ names = self.name.split('::')
38
+ package = Java
39
+ names[0..-2].each do |module_name|
40
+ package = package.__send__(module_name.downcase)
41
+ end
42
+
43
+ package.__send__(names[-1])
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,9 @@
1
+ class Class
2
+ def implements(java_class_name)
3
+ # no-op
4
+ end
5
+
6
+ def native_impl(lib)
7
+ # no-op
8
+ end
9
+ end
@@ -1,12 +1,12 @@
1
1
  require 'gherkin/parser/event'
2
2
  require 'gherkin/parser/tag_expression'
3
+ require 'gherkin/native'
3
4
 
4
5
  module Gherkin
5
6
  module Parser
6
7
  # This class filters events based on filter criteria.
7
8
  class FilterListener
8
- require 'gherkin/java_impl'
9
- java_impl('gherkin.jar')
9
+ native_impl('gherkin')
10
10
 
11
11
  # Creates a new instance that replays events to +listener+, filtered by +filters+,
12
12
  # an Array that can contain one of the following:
@@ -1,3 +1,5 @@
1
+ require 'gherkin/native'
2
+
1
3
  module Gherkin
2
4
  module Parser
3
5
  class ParseError < StandardError
@@ -7,8 +9,7 @@ module Gherkin
7
9
  end
8
10
 
9
11
  class Parser
10
- require 'gherkin/java_impl'
11
- java_impl('gherkin.jar')
12
+ native_impl('gherkin')
12
13
 
13
14
  # Initialize the parser. +machine_name+ refers to a state machine table.
14
15
  def initialize(listener, raise_on_error=true, machine_name='root')
@@ -1,8 +1,9 @@
1
+ require 'gherkin/native'
2
+
1
3
  module Gherkin
2
4
  module Parser
3
5
  class TagExpression
4
- require 'gherkin/java_impl'
5
- java_impl('gherkin.jar')
6
+ native_impl('gherkin')
6
7
 
7
8
  attr_reader :limits
8
9
 
@@ -1,7 +1,11 @@
1
+ require 'gherkin/native'
2
+
1
3
  # encoding: utf-8
2
4
  module Gherkin
3
5
  module Tools
4
6
  class StatsListener
7
+ implements 'gherkin.Listener'
8
+
5
9
  attr_reader :features, :scenarios, :steps
6
10
 
7
11
  def initialize
@@ -142,7 +142,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
142
142
 
143
143
  %% write data noerror;
144
144
 
145
- public void scan(CharSequence inputSequence) {
145
+ public void scan(String inputSequence) {
146
146
  String input = inputSequence.toString() + "\n%_FEATURE_END_%";
147
147
  byte[] data = null;
148
148
  try {
@@ -1,5 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/ragel_task'
2
- BYPASS_JAVA_IMPL = true
2
+ BYPASS_NATIVE_IMPL = true
3
3
  require 'gherkin/i18n'
4
4
 
5
5
  CLEAN.include [
@@ -27,6 +27,12 @@ namespace :gems do
27
27
  mv "pkg/gherkin-#{GHERKIN_VERSION}-java.gem", 'release'
28
28
  end
29
29
 
30
+ desc 'Build IronRuby gem'
31
+ task :ironruby => [:jruby, 'ikvm:dll', 'ikvm:copy_ikvm_dlls'] do
32
+ sh "rake gemspec build PLATFORM=universal-dotnet"
33
+ mv "pkg/gherkin-#{GHERKIN_VERSION}-universal-dotnet.gem", 'release'
34
+ end
35
+
30
36
  task :release_dir do
31
37
  mkdir 'release' unless File.directory?('release')
32
38
  end
@@ -36,4 +42,4 @@ namespace :gems do
36
42
  end
37
43
  end
38
44
 
39
- task :gems => ['gems:clean_release_dir', 'gems:posix', 'gems:mswin32', 'gems:mingw32', 'gems:jruby']
45
+ task :gems => ['gems:clean_release_dir', 'gems:posix', 'gems:mswin32', 'gems:mingw32', 'gems:jruby', 'gems:ironruby']
@@ -20,25 +20,23 @@
20
20
  #
21
21
  namespace :ikvm do
22
22
  desc 'Make a .NET .exe'
23
- task :exe => 'pkg/gherkin.exe'
24
-
25
- desc 'Make a .NET .dll'
26
- task :dll => 'pkg/gherkin.dll'
27
-
28
- file 'pkg/gherkin.exe' => 'lib/gherkin.jar' do
23
+ task :exe => 'lib/gherkin.jar' do
29
24
  mkdir_p 'release' unless File.directory?('release')
30
25
  sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:exe lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.exe")
31
26
  end
32
27
 
33
- file 'pkg/gherkin.dll' => 'lib/gherkin.jar' do
28
+ desc 'Make a .NET .dll'
29
+ task :dll => 'lib/gherkin.jar' do
34
30
  mkdir_p 'release' unless File.directory?('release')
35
31
  sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library lib/gherkin.jar -out:release/gherkin-#{GHERKIN_VERSION}.dll")
32
+ cp "release/gherkin-#{GHERKIN_VERSION}.dll", 'lib/gherkin.dll'
36
33
  end
37
34
 
38
35
  desc 'Copy the IKVM .dll files over to the pkg dir'
39
36
  task :copy_ikvm_dlls do
40
37
  Dir['/usr/local/ikvm/bin/{IKVM.OpenJDK.Core,IKVM.OpenJDK.Text,IKVM.OpenJDK.Security,IKVM.Runtime}.dll'].each do |dll|
41
38
  cp dll, 'release'
39
+ cp dll, 'lib'
42
40
  end
43
41
  end
44
42
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 43
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 29
9
- version: 1.0.29
9
+ - 30
10
+ version: 1.0.30
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mike Sassak
@@ -16,16 +17,18 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-05-18 00:00:00 +02:00
20
+ date: 2010-05-20 00:00:00 +02:00
20
21
  default_executable: gherkin
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: trollop
24
25
  prerelease: false
25
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
26
28
  requirements:
27
29
  - - ">="
28
30
  - !ruby/object:Gem::Version
31
+ hash: 83
29
32
  segments:
30
33
  - 1
31
34
  - 16
@@ -37,9 +40,11 @@ dependencies:
37
40
  name: rspec
38
41
  prerelease: false
39
42
  requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
45
  - - ">="
42
46
  - !ruby/object:Gem::Version
47
+ hash: 27
43
48
  segments:
44
49
  - 1
45
50
  - 3
@@ -48,19 +53,37 @@ dependencies:
48
53
  type: :development
49
54
  version_requirements: *id002
50
55
  - !ruby/object:Gem::Dependency
51
- name: rake-compiler
56
+ name: cucumber
52
57
  prerelease: false
53
58
  requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
54
60
  requirements:
55
61
  - - ">="
56
62
  - !ruby/object:Gem::Version
63
+ hash: 7
64
+ segments:
65
+ - 0
66
+ - 7
67
+ - 2
68
+ version: 0.7.2
69
+ type: :development
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: rake-compiler
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
57
80
  segments:
58
81
  - 0
59
82
  - 7
60
83
  - 0
61
84
  version: 0.7.0
62
85
  type: :development
63
- version_requirements: *id003
86
+ version_requirements: *id004
64
87
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
65
88
  email: cukes@googlegroups.com
66
89
  executables:
@@ -194,7 +217,10 @@ files:
194
217
  - lib/gherkin/i18n.rb
195
218
  - lib/gherkin/i18n.yml
196
219
  - lib/gherkin/i18n_lexer.rb
197
- - lib/gherkin/java_impl.rb
220
+ - lib/gherkin/native.rb
221
+ - lib/gherkin/native/ikvm.rb
222
+ - lib/gherkin/native/java.rb
223
+ - lib/gherkin/native/null.rb
198
224
  - lib/gherkin/parser/event.rb
199
225
  - lib/gherkin/parser/filter_listener.rb
200
226
  - lib/gherkin/parser/meta.txt
@@ -302,6 +328,50 @@ files:
302
328
  - tasks/rdoc.rake
303
329
  - tasks/release.rake
304
330
  - tasks/rspec.rake
331
+ - ext/gherkin_lexer_ar/extconf.rb
332
+ - ext/gherkin_lexer_bg/extconf.rb
333
+ - ext/gherkin_lexer_ca/extconf.rb
334
+ - ext/gherkin_lexer_cs/extconf.rb
335
+ - ext/gherkin_lexer_cy_gb/extconf.rb
336
+ - ext/gherkin_lexer_da/extconf.rb
337
+ - ext/gherkin_lexer_de/extconf.rb
338
+ - ext/gherkin_lexer_en/extconf.rb
339
+ - ext/gherkin_lexer_en_au/extconf.rb
340
+ - ext/gherkin_lexer_en_lol/extconf.rb
341
+ - ext/gherkin_lexer_en_scouse/extconf.rb
342
+ - ext/gherkin_lexer_en_tx/extconf.rb
343
+ - ext/gherkin_lexer_eo/extconf.rb
344
+ - ext/gherkin_lexer_es/extconf.rb
345
+ - ext/gherkin_lexer_et/extconf.rb
346
+ - ext/gherkin_lexer_fi/extconf.rb
347
+ - ext/gherkin_lexer_fr/extconf.rb
348
+ - ext/gherkin_lexer_he/extconf.rb
349
+ - ext/gherkin_lexer_hr/extconf.rb
350
+ - ext/gherkin_lexer_hu/extconf.rb
351
+ - ext/gherkin_lexer_id/extconf.rb
352
+ - ext/gherkin_lexer_it/extconf.rb
353
+ - ext/gherkin_lexer_ja/extconf.rb
354
+ - ext/gherkin_lexer_ko/extconf.rb
355
+ - ext/gherkin_lexer_lt/extconf.rb
356
+ - ext/gherkin_lexer_lu/extconf.rb
357
+ - ext/gherkin_lexer_lv/extconf.rb
358
+ - ext/gherkin_lexer_nl/extconf.rb
359
+ - ext/gherkin_lexer_no/extconf.rb
360
+ - ext/gherkin_lexer_pl/extconf.rb
361
+ - ext/gherkin_lexer_pt/extconf.rb
362
+ - ext/gherkin_lexer_ro/extconf.rb
363
+ - ext/gherkin_lexer_ro_ro/extconf.rb
364
+ - ext/gherkin_lexer_ru/extconf.rb
365
+ - ext/gherkin_lexer_sk/extconf.rb
366
+ - ext/gherkin_lexer_sr_cyrl/extconf.rb
367
+ - ext/gherkin_lexer_sr_latn/extconf.rb
368
+ - ext/gherkin_lexer_sv/extconf.rb
369
+ - ext/gherkin_lexer_tr/extconf.rb
370
+ - ext/gherkin_lexer_uk/extconf.rb
371
+ - ext/gherkin_lexer_uz/extconf.rb
372
+ - ext/gherkin_lexer_vi/extconf.rb
373
+ - ext/gherkin_lexer_zh_cn/extconf.rb
374
+ - ext/gherkin_lexer_zh_tw/extconf.rb
305
375
  has_rdoc: true
306
376
  homepage: http://github.com/aslakhellesoy/gherkin
307
377
  licenses: []
@@ -312,23 +382,27 @@ rdoc_options:
312
382
  require_paths:
313
383
  - lib
314
384
  required_ruby_version: !ruby/object:Gem::Requirement
385
+ none: false
315
386
  requirements:
316
387
  - - ">="
317
388
  - !ruby/object:Gem::Version
389
+ hash: 3
318
390
  segments:
319
391
  - 0
320
392
  version: "0"
321
393
  required_rubygems_version: !ruby/object:Gem::Requirement
394
+ none: false
322
395
  requirements:
323
396
  - - ">="
324
397
  - !ruby/object:Gem::Version
398
+ hash: 3
325
399
  segments:
326
400
  - 0
327
401
  version: "0"
328
402
  requirements: []
329
403
 
330
404
  rubyforge_project:
331
- rubygems_version: 1.3.6
405
+ rubygems_version: 1.3.7
332
406
  signing_key:
333
407
  specification_version: 3
334
408
  summary: Fast Gherkin lexer/parser
@@ -1,43 +0,0 @@
1
- class Class
2
- # Causes a Java class to be instantiated instead of the Ruby class when
3
- # running on JRuby. This is used to test both pure Java and pure Ruby classes
4
- # from the same Ruby based test suite. The Java Class must have a package name
5
- # that corresponds with the Ruby class.
6
- def java_impl(jar)
7
- if defined?(JRUBY_VERSION)
8
- require jar
9
- class << self
10
- def javaify(arg)
11
- if Array === arg
12
- arg.map{|a| javaify(a)}
13
- else
14
- case(arg)
15
- when Regexp
16
- java.util.regex.Pattern.compile(arg.source)
17
- else
18
- arg
19
- end
20
- end
21
- end
22
-
23
- def new(*args)
24
- java_class.new(*javaify(args))
25
- end
26
-
27
- def ===(object)
28
- super || object.java_kind_of?(java_class)
29
- end
30
-
31
- def java_class
32
- names = self.name.split('::')
33
- package = Java
34
- names[0..-2].each do |module_name|
35
- package = package.__send__(module_name.downcase)
36
- end
37
-
38
- package.__send__(names[-1])
39
- end
40
- end
41
- end
42
- end
43
- end