gherkin 1.0.29-i386-mingw32 → 1.0.30-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +5 -1
- data/VERSION.yml +1 -1
- data/lib/gherkin/cli/main.rb +2 -2
- data/lib/gherkin/formatter/argument.rb +3 -3
- data/lib/gherkin/formatter/pretty_formatter.rb +2 -3
- data/lib/gherkin/i18n.rb +2 -4
- data/lib/gherkin/i18n_lexer.rb +2 -2
- data/lib/gherkin/native.rb +7 -0
- data/lib/gherkin/native/ikvm.rb +55 -0
- data/lib/gherkin/native/java.rb +47 -0
- data/lib/gherkin/native/null.rb +9 -0
- data/lib/gherkin/parser/filter_listener.rb +2 -2
- data/lib/gherkin/parser/parser.rb +3 -2
- data/lib/gherkin/parser/tag_expression.rb +3 -2
- data/lib/gherkin/tools/stats_listener.rb +4 -0
- data/ragel/lexer.java.rl.erb +1 -1
- data/tasks/compile.rake +1 -1
- data/tasks/gems.rake +7 -1
- data/tasks/ikvm.rake +5 -7
- metadata +37 -7
- data/lib/gherkin/java_impl.rb +0 -43
data/History.txt
CHANGED
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
|
-
|
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']
|
data/VERSION.yml
CHANGED
data/lib/gherkin/cli/main.rb
CHANGED
@@ -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,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
|
-
|
12
|
-
java_impl('gherkin.jar')
|
11
|
+
native_impl('gherkin')
|
13
12
|
|
14
13
|
include Colors
|
15
14
|
include Escaping
|
data/lib/gherkin/i18n.rb
CHANGED
@@ -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?(
|
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}
|
data/lib/gherkin/i18n_lexer.rb
CHANGED
@@ -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
|
-
|
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,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
|
@@ -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
|
-
|
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
|
-
|
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')
|
data/ragel/lexer.java.rl.erb
CHANGED
@@ -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(
|
145
|
+
public void scan(String inputSequence) {
|
146
146
|
String input = inputSequence.toString() + "\n%_FEATURE_END_%";
|
147
147
|
byte[] data = null;
|
148
148
|
try {
|
data/tasks/compile.rake
CHANGED
data/tasks/gems.rake
CHANGED
@@ -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']
|
data/tasks/ikvm.rake
CHANGED
@@ -20,25 +20,23 @@
|
|
20
20
|
#
|
21
21
|
namespace :ikvm do
|
22
22
|
desc 'Make a .NET .exe'
|
23
|
-
task :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
|
-
|
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
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 30
|
10
|
+
version: 1.0.30
|
10
11
|
platform: i386-mingw32
|
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-
|
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:
|
56
|
+
name: cucumber
|
52
57
|
prerelease: false
|
53
58
|
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
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
|
54
76
|
requirements:
|
55
77
|
- - ">="
|
56
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: *
|
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:
|
@@ -195,7 +218,10 @@ files:
|
|
195
218
|
- lib/gherkin/i18n.rb
|
196
219
|
- lib/gherkin/i18n.yml
|
197
220
|
- lib/gherkin/i18n_lexer.rb
|
198
|
-
- lib/gherkin/
|
221
|
+
- lib/gherkin/native.rb
|
222
|
+
- lib/gherkin/native/ikvm.rb
|
223
|
+
- lib/gherkin/native/java.rb
|
224
|
+
- lib/gherkin/native/null.rb
|
199
225
|
- lib/gherkin/parser/event.rb
|
200
226
|
- lib/gherkin/parser/filter_listener.rb
|
201
227
|
- lib/gherkin/parser/meta.txt
|
@@ -269,23 +295,27 @@ rdoc_options:
|
|
269
295
|
require_paths:
|
270
296
|
- lib
|
271
297
|
required_ruby_version: !ruby/object:Gem::Requirement
|
298
|
+
none: false
|
272
299
|
requirements:
|
273
300
|
- - ">="
|
274
301
|
- !ruby/object:Gem::Version
|
302
|
+
hash: 3
|
275
303
|
segments:
|
276
304
|
- 0
|
277
305
|
version: "0"
|
278
306
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
307
|
+
none: false
|
279
308
|
requirements:
|
280
309
|
- - ">="
|
281
310
|
- !ruby/object:Gem::Version
|
311
|
+
hash: 3
|
282
312
|
segments:
|
283
313
|
- 0
|
284
314
|
version: "0"
|
285
315
|
requirements: []
|
286
316
|
|
287
317
|
rubyforge_project:
|
288
|
-
rubygems_version: 1.3.
|
318
|
+
rubygems_version: 1.3.7
|
289
319
|
signing_key:
|
290
320
|
specification_version: 3
|
291
321
|
summary: Fast Gherkin lexer/parser
|
data/lib/gherkin/java_impl.rb
DELETED
@@ -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
|