gherkin 1.0.29-java → 1.0.30-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +21 -4
- 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
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 30
|
9
|
+
version: 1.0.30
|
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-05-
|
19
|
+
date: 2010-05-20 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -47,6 +47,20 @@ dependencies:
|
|
47
47
|
version: 1.3.0
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: cucumber
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
- 7
|
60
|
+
- 2
|
61
|
+
version: 0.7.2
|
62
|
+
type: :development
|
63
|
+
version_requirements: *id003
|
50
64
|
description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
|
51
65
|
email: cukes@googlegroups.com
|
52
66
|
executables:
|
@@ -94,7 +108,10 @@ files:
|
|
94
108
|
- lib/gherkin/i18n.rb
|
95
109
|
- lib/gherkin/i18n.yml
|
96
110
|
- lib/gherkin/i18n_lexer.rb
|
97
|
-
- lib/gherkin/
|
111
|
+
- lib/gherkin/native.rb
|
112
|
+
- lib/gherkin/native/ikvm.rb
|
113
|
+
- lib/gherkin/native/java.rb
|
114
|
+
- lib/gherkin/native/null.rb
|
98
115
|
- lib/gherkin/parser/event.rb
|
99
116
|
- lib/gherkin/parser/filter_listener.rb
|
100
117
|
- lib/gherkin/parser/meta.txt
|
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
|