gherkin 1.0.4-java → 1.0.5-java

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 1.0.5 (2009-04-08)
2
+
3
+ === New Features
4
+ * New .NET build of gherkin - an ikvmc build of gherkin.jar to gherkin.dll. (Aslak Hellesøy)
5
+
6
+ === Bugfixes
7
+ * Made parsers reusable so that the same instance can parse several features. (Aslak Hellesøy)
8
+
1
9
  == 1.0.4 (2009-04-07)
2
10
 
3
11
  === New features
data/README.rdoc CHANGED
@@ -28,16 +28,22 @@ E.g. in Bash, export RL_LANG="en,fr,no". This can be quite helpful when modifyin
28
28
 
29
29
  == Release process
30
30
 
31
+ * Bump version in the VERSION file
32
+ * Do a file search and replace from old version number to new one.
31
33
  * Run "rake clean spec cucumber" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
32
34
  * rvm 1.8.7
33
- * Bump version in the VERSION file
34
35
  * rake clean jar compile
35
36
  * rake gemspec
36
37
  * git commit -a -m "Release vX.Y.Z"
37
38
  * rake gemcutter:release
39
+ * rake git:release
38
40
  * ./nativegems.sh
39
41
  * gem push pkg/... (for each native gem)
40
42
  * cd java && mvn deploy
43
+ * rake ikvm
44
+ * Upload pkg/gherkin-X.Y.Z.dll to Github: http://github.com/aslakhellesoy/gherkin/downloads
45
+
46
+ * Announce on Cucumber list, IRC and Twitter.
41
47
 
42
48
  == Configuring Rake-Compiler for cross compilation
43
49
  In order to build Windows binaries (so we can release Windows gems from OS X/Linux) we need to set up rake-compiler.
data/Rakefile CHANGED
@@ -3,6 +3,10 @@ require 'rbconfig'
3
3
  require 'rubygems'
4
4
  require 'rake'
5
5
  require 'rake/clean'
6
+ require 'yaml'
7
+
8
+ config = YAML.load_file('VERSION.yml')
9
+ GHERKIN_VERSION = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
6
10
 
7
11
  begin
8
12
  require 'jeweler'
@@ -16,11 +20,12 @@ begin
16
20
  gem.executables = ["gherkin"]
17
21
  gem.add_dependency "trollop", ">= 1.15"
18
22
  gem.add_development_dependency "rspec", ">= 1.3.0"
19
- gem.add_development_dependency "cucumber", ">= 0.6.2"
23
+ gem.add_development_dependency "cucumber", ">= 0.6.4"
20
24
  gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
21
- gem.add_development_dependency "albacore", ">= 0.1.0"
25
+ gem.add_development_dependency "albacore", ">= 0.1.2"
22
26
 
23
27
  gem.files -= FileList['dotnet/**/*']
28
+ gem.files -= FileList['ikvm/**/*']
24
29
  gem.files -= FileList['java/**/*']
25
30
  case ENV['PLATFORM']
26
31
  when 'java'
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 4
3
+ :patch: 5
4
4
  :major: 1
data/gherkin.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gherkin}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
  s.platform = %q{java}
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Helles\303\270y"]
13
- s.date = %q{2010-04-07}
13
+ s.date = %q{2010-04-08}
14
14
  s.default_executable = %q{gherkin}
15
15
  s.description = %q{A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.}
16
16
  s.email = %q{cukes@googlegroups.com}
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  "features/steps_parser.feature",
41
41
  "features/support/env.rb",
42
42
  "gherkin.gemspec",
43
+ "ikvm/.gitignore",
43
44
  "java/.gitignore",
44
45
  "java/Gherkin.iml",
45
46
  "java/src/main/java/gherkin/lexer/.gitignore",
@@ -113,6 +114,7 @@ Gem::Specification.new do |s|
113
114
  "tasks/bench/null_listener.rb",
114
115
  "tasks/compile.rake",
115
116
  "tasks/cucumber.rake",
117
+ "tasks/ikvm.rake",
116
118
  "tasks/ragel_task.rb",
117
119
  "tasks/rdoc.rake",
118
120
  "tasks/rspec.rake"
@@ -150,22 +152,22 @@ Gem::Specification.new do |s|
150
152
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
151
153
  s.add_runtime_dependency(%q<trollop>, [">= 1.15"])
152
154
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
153
- s.add_development_dependency(%q<cucumber>, [">= 0.6.2"])
155
+ s.add_development_dependency(%q<cucumber>, [">= 0.6.4"])
154
156
  s.add_development_dependency(%q<rake-compiler>, [">= 0.7.0"])
155
- s.add_development_dependency(%q<albacore>, [">= 0.1.0"])
157
+ s.add_development_dependency(%q<albacore>, [">= 0.1.2"])
156
158
  else
157
159
  s.add_dependency(%q<trollop>, [">= 1.15"])
158
160
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
159
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
161
+ s.add_dependency(%q<cucumber>, [">= 0.6.4"])
160
162
  s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
161
- s.add_dependency(%q<albacore>, [">= 0.1.0"])
163
+ s.add_dependency(%q<albacore>, [">= 0.1.2"])
162
164
  end
163
165
  else
164
166
  s.add_dependency(%q<trollop>, [">= 1.15"])
165
167
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
166
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
168
+ s.add_dependency(%q<cucumber>, [">= 0.6.4"])
167
169
  s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
168
- s.add_dependency(%q<albacore>, [">= 0.1.0"])
170
+ s.add_dependency(%q<albacore>, [">= 0.1.2"])
169
171
  end
170
172
  end
171
173
 
data/ikvm/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ bin
2
+ *.pidb
3
+ *.userprefs
@@ -7,7 +7,7 @@ module Gherkin
7
7
  end
8
8
 
9
9
  class Parser
10
- def self.new(listener, raise_on_error=false, machine_name='root')
10
+ def self.new(listener, raise_on_error=true, machine_name='root')
11
11
  if defined?(JRUBY_VERSION)
12
12
  require 'gherkin.jar'
13
13
  Java::GherkinParser::Parser.new(listener, raise_on_error, machine_name)
@@ -21,7 +21,8 @@ module Gherkin
21
21
  @listener = listener
22
22
  @raise_on_error = raise_on_error
23
23
  @machines = []
24
- push_machine(machine_name)
24
+ @machine_name = machine_name
25
+ push_machine(@machine_name)
25
26
  end
26
27
 
27
28
  # Doesn't yet fall back to super
@@ -30,6 +31,10 @@ module Gherkin
30
31
  if(event(method.to_s, args[-1]))
31
32
  @listener.send(method, *args)
32
33
  end
34
+ if method == :eof
35
+ pop_machine
36
+ push_machine(@machine_name)
37
+ end
33
38
  end
34
39
 
35
40
  def event(ev, line)
data/lib/gherkin.jar CHANGED
Binary file
@@ -140,7 +140,7 @@ public class <%= @i18n.sanitized_key.capitalize %> implements Lexer {
140
140
 
141
141
  %% write data noerror;
142
142
 
143
- public void scan(CharSequence inputSequence) {
143
+ public void scan(CharSequence inputSequence) throws Exception {
144
144
  String input = inputSequence.toString() + "\n%_FEATURE_END_%";
145
145
  byte[] data = input.getBytes();
146
146
  int cs, p = 0, pe = data.length;
@@ -30,6 +30,21 @@ module Gherkin
30
30
  @parser = Parser.new(@listener, false)
31
31
  @parser.background("Background", "Content", 1)
32
32
  end
33
+
34
+ [true, false].each do |native|
35
+ it "should be reusable for several feature files (native lexer: #{native})" do
36
+ listener = mock('listener', :null_object => true)
37
+ parser = Parser.new(listener, true)
38
+ lexer = I18nLexer.new(parser, native)
39
+ feature = <<-EOF
40
+ Feature: foo
41
+ Scenario: bar
42
+ Given zap
43
+ EOF
44
+ lexer.scan(feature)
45
+ lexer.scan(feature)
46
+ end
47
+ end
33
48
  end
34
49
  end
35
50
  end
data/tasks/compile.rake CHANGED
@@ -15,7 +15,9 @@ CLEAN.include [
15
15
  ]
16
16
 
17
17
  desc "Compile the Java extensions"
18
- task :jar do
18
+ task :jar => 'lib/gherkin.jar'
19
+
20
+ file 'lib/gherkin.jar' => Dir['java/src/main/java/**/*.java'] do
19
21
  sh("mvn -f java/pom.xml package")
20
22
  end
21
23
 
data/tasks/ikvm.rake ADDED
@@ -0,0 +1,47 @@
1
+ # To test out the pure Java main program on .NET, execute:
2
+ #
3
+ # rake ikvm
4
+ #
5
+ # Just print dots:
6
+ #
7
+ # [mono] pkg/gherkin.exe features
8
+ #
9
+ # Pretty print all to STDOUT:
10
+ #
11
+ # [mono] pkg/gherkin.exe features pretty
12
+ #
13
+ # To test out the pure C# main program on .NET, execute:
14
+ #
15
+ # rake ikvm (you need this to generate all the .dll files needed for the next step)
16
+ #
17
+ # Then build ikvm/Gherkin.sln. Then:
18
+ #
19
+ # [mono] mono ikvm/Gherkin/bin/Debug/Gherkin.exe features/steps_parser.feature
20
+ #
21
+ namespace :ikvm do
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
29
+ mkdir_p 'pkg' unless File.directory?('pkg')
30
+ sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:exe lib/gherkin.jar -out:pkg/gherkin-#{GHERKIN_VERSION}.exe")
31
+ end
32
+
33
+ file 'pkg/gherkin.dll' => 'lib/gherkin.jar' do
34
+ mkdir_p 'pkg' unless File.directory?('pkg')
35
+ sh("mono /usr/local/ikvm/bin/ikvmc.exe -target:library lib/gherkin.jar -out:pkg/gherkin-#{GHERKIN_VERSION}.dll")
36
+ end
37
+
38
+ desc 'Copy the IKVM .dll files over to the pkg dir'
39
+ task :copy_ikvm_dlls do
40
+ Dir['/usr/local/ikvm/bin/{IKVM.OpenJDK.Core,IKVM.OpenJDK.Text,IKVM.Runtime}.dll'].each do |dll|
41
+ cp dll, 'pkg'
42
+ end
43
+ end
44
+ end
45
+
46
+ task :ikvm => ['ikvm:exe', 'ikvm:dll', 'ikvm:copy_ikvm_dlls']
47
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 4
9
- version: 1.0.4
8
+ - 5
9
+ version: 1.0.5
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-04-07 00:00:00 +02:00
19
+ date: 2010-04-08 00:00:00 +02:00
20
20
  default_executable: gherkin
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -56,8 +56,8 @@ dependencies:
56
56
  segments:
57
57
  - 0
58
58
  - 6
59
- - 2
60
- version: 0.6.2
59
+ - 4
60
+ version: 0.6.4
61
61
  type: :development
62
62
  version_requirements: *id003
63
63
  - !ruby/object:Gem::Dependency
@@ -84,8 +84,8 @@ dependencies:
84
84
  segments:
85
85
  - 0
86
86
  - 1
87
- - 0
88
- version: 0.1.0
87
+ - 2
88
+ version: 0.1.2
89
89
  type: :development
90
90
  version_requirements: *id005
91
91
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
@@ -118,6 +118,7 @@ files:
118
118
  - features/steps_parser.feature
119
119
  - features/support/env.rb
120
120
  - gherkin.gemspec
121
+ - ikvm/.gitignore
121
122
  - java/.gitignore
122
123
  - java/Gherkin.iml
123
124
  - java/src/main/java/gherkin/lexer/.gitignore
@@ -191,6 +192,7 @@ files:
191
192
  - tasks/bench/null_listener.rb
192
193
  - tasks/compile.rake
193
194
  - tasks/cucumber.rake
195
+ - tasks/ikvm.rake
194
196
  - tasks/ragel_task.rb
195
197
  - tasks/rdoc.rake
196
198
  - tasks/rspec.rake