gherkin 2.3.10-x86-mingw32 → 2.4.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +2 -0
  2. data/.yardopts +5 -0
  3. data/{History.txt → History.md} +144 -133
  4. data/{README.rdoc → README.md} +62 -64
  5. data/Rakefile +1 -1
  6. data/features/json_formatter.feature +1 -1
  7. data/features/json_parser.feature +1 -1
  8. data/gherkin.gemspec +8 -3
  9. data/lib/gherkin/formatter/ansi_escapes.rb +1 -1
  10. data/lib/gherkin/formatter/model.rb +4 -4
  11. data/lib/gherkin/formatter/pretty_formatter.rb +4 -4
  12. data/lib/gherkin/json_parser.rb +1 -1
  13. data/lib/gherkin/listener/formatter_listener.rb +7 -7
  14. data/lib/gherkin/parser/meta.txt +1 -1
  15. data/lib/gherkin/parser/root.txt +1 -1
  16. data/lib/gherkin/parser/steps.txt +1 -1
  17. data/lib/gherkin/rubify.rb +2 -2
  18. data/ragel/lexer.c.rl.erb +1 -1
  19. data/ragel/lexer.java.rl.erb +1 -1
  20. data/ragel/lexer.js.rl.erb +2 -2
  21. data/ragel/lexer.rb.rl.erb +1 -1
  22. data/ragel/lexer_common.rl.erb +4 -4
  23. data/spec/gherkin/c_lexer_spec.rb +1 -1
  24. data/spec/gherkin/fixtures/complex.json +1 -1
  25. data/spec/gherkin/java_lexer_spec.rb +1 -1
  26. data/spec/gherkin/js_lexer_spec.rb +1 -1
  27. data/spec/gherkin/rb_lexer_spec.rb +1 -1
  28. data/spec/gherkin/sexp_recorder.rb +2 -2
  29. data/spec/gherkin/shared/{py_string_group.rb → doc_string_group.rb} +28 -28
  30. data/spec/gherkin/shared/lexer_group.rb +4 -4
  31. data/spec/spec_helper.rb +1 -1
  32. data/tasks/compile.rake +3 -2
  33. data/tasks/cucumber.rake +1 -1
  34. data/tasks/gems.rake +1 -1
  35. data/tasks/release.rake +8 -1
  36. data/tasks/yard.rake +7 -0
  37. data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  38. data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
  39. data/tasks/yard/default/layout/html/footer.erb +5 -0
  40. data/tasks/yard/default/layout/html/index.erb +1 -0
  41. data/tasks/yard/default/layout/html/layout.erb +25 -0
  42. data/tasks/yard/default/layout/html/logo.erb +1 -0
  43. data/tasks/yard/default/layout/html/setup.rb +4 -0
  44. metadata +45 -17
  45. data/tasks/rdoc.rake +0 -9
@@ -1,6 +1,4 @@
1
- = Gherkin
2
-
3
- Fast Gherkin lexer and parser based on Ragel. Gherkin is two things:
1
+ A fast lexer and parser for the Gherkin language based on Ragel. Gherkin is two things:
4
2
 
5
3
  * The language that has evolved out of the Cucumber project.
6
4
  * This library
@@ -13,7 +11,7 @@ Supported platforms:
13
11
  * .NET
14
12
  * IronRuby (experimental)
15
13
 
16
- == Installing the toolchain
14
+ ## Installing the toolchain
17
15
 
18
16
  Due to the cross-platform nature of this library, you have to install a lot of tools to build gherkin yourself.
19
17
  In order to make it easier for occasional contributors to get the development environment up and running, you don't
@@ -21,7 +19,7 @@ have to install everything up front. The build scripts should tell you if you ar
21
19
  you shouldn't have to install MinGW to build windows binaries if you are a Linux user and just want to fix a bug in
22
20
  the C code.
23
21
 
24
- === Common dependencies
22
+ ### Common dependencies
25
23
 
26
24
  These are the minimal tools you need to install:
27
25
 
@@ -32,42 +30,42 @@ These are the minimal tools you need to install:
32
30
 
33
31
  With this minimal toolchain installed, install Ruby gems needed by the build:
34
32
 
35
- gem install bundler
36
- bundle install
33
+ gem install bundler
34
+ bundle install
37
35
 
38
36
  Running RSpec and Cucumber tests
39
37
 
40
- rake clean spec cucumber
38
+ rake clean spec cucumber
41
39
 
42
40
  If the RL_LANGS environment variable is set, only the parsers for the languages specified there will be built.
43
41
  E.g. in Bash, export RL_LANGS="en,fr,no". This can be quite helpful when modifying the Ragel grammar.
44
42
 
45
43
  See subsections for building for a specific platform.
46
44
 
47
- === MRI, REE or Rubinius
45
+ ### MRI, REE or Rubinius
48
46
 
49
47
  You'll need GCC installed.
50
48
 
51
49
  Build the gem with:
52
50
 
53
- rake build
51
+ rake build
54
52
 
55
- === Pure Java and JRuby
53
+ ### Pure Java and JRuby
56
54
 
57
55
  You must install JRuby to build the pure Java jar or the JRuby gem:
58
56
 
59
- rvm install jruby
60
- rvm use jruby
61
- rvm gemset create cucumber
62
- rvm use @cucumber
63
- gem install bundler
64
- bundle install
57
+ rvm install jruby
58
+ rvm use jruby
59
+ rvm gemset create cucumber
60
+ rvm use @cucumber
61
+ gem install bundler
62
+ bundle install
65
63
 
66
64
  Now you can build the jar with:
67
65
 
68
- rake clean jar
66
+ rake clean jar
69
67
 
70
- === Javascript
68
+ ### Javascript
71
69
 
72
70
  In order to build and test Gherkin for Javascript you must install:
73
71
 
@@ -78,20 +76,20 @@ In order to build and test Gherkin for Javascript you must install:
78
76
 
79
77
  Now you can build the Javascript with:
80
78
 
81
- rake js
82
- cd js
83
- npm install
79
+ rake js
80
+ cd js
81
+ npm install
84
82
 
85
83
  And you can try it out with node.js:
86
84
 
87
- node js/example/print.js spec/gherkin/fixtures/1.feature
85
+ node js/example/print.js spec/gherkin/fixtures/1.feature
88
86
 
89
87
  You can also try out Gherkin running in the browser (likely to move to a separate project):
90
88
 
91
- # Pull in the Ace (http://ace.ajax.org/) editor:
92
- git submodule update --init
93
- # Open a sample Gherkin-powered editor in Chrome
94
- open js/example/index.html
89
+ # Pull in the Ace (http://ace.ajax.org/) editor:
90
+ git submodule update --init
91
+ # Open a sample Gherkin-powered editor in Chrome
92
+ open js/example/index.html
95
93
 
96
94
  If you're hacking and just want to rebuild the English parser:
97
95
 
@@ -99,7 +97,7 @@ If you're hacking and just want to rebuild the English parser:
99
97
 
100
98
  TODO: Make all specs pass with js lexer - replace 'c(listener)' with 'js(listener)' in i18n.rb
101
99
 
102
- === .NET and IronRuby
100
+ ### .NET and IronRuby
103
101
 
104
102
  You must install Mono and IKVM to build the pure .NET dll and the IronRuby gem:
105
103
 
@@ -108,9 +106,9 @@ You must install Mono and IKVM to build the pure .NET dll and the IronRuby gem:
108
106
 
109
107
  Now you can build the .NET dll with:
110
108
 
111
- rake ikvm
109
+ rake ikvm
112
110
 
113
- === MinGW Rubies (for Windows gems)
111
+ ### MinGW Rubies (for Windows gems)
114
112
 
115
113
  In order to build Windows binaries (so we can release Windows gems from OS X/Linux) we need to set up rake-compiler.
116
114
 
@@ -127,48 +125,48 @@ First you need to download and install MinGW:
127
125
  OS X users can get it from http://crossgcc.rts-software.org/doku.php
128
126
  Once you have installed it, add this to your .bashrc:
129
127
 
130
- export PATH=$PATH:/usr/local/i386-mingw32-4.3.0/bin
128
+ export PATH=$PATH:/usr/local/i386-mingw32-4.3.0/bin
131
129
 
132
130
  Now, let's install some rubies.
133
131
  Make sure you have openssl installed first.
134
132
 
135
- brew install openssl
136
-
137
- # 1.8.6
138
- # Don't worry about inconsistent patchlevels here. It works.
139
- rvm install 1.8.6-p399
140
- rvm use 1.8.6-p399
141
- rvm gemset create cucumber
142
- rvm use @cucumber
143
- gem install bundler
144
- bundle install
145
- rake-compiler cross-ruby VERSION=1.8.6-p287
146
-
147
- # 1.9.1
148
- # Later 1.9.1 patch levels or 1.9.2 don't compile on mingw.
149
- # The compiled binaries should still work on 1.9.2
150
- rvm install 1.9.1-p243
151
- rvm use 1.9.1-p243
152
- rvm gemset create cucumber
153
- rvm use @cucumber
154
- gem install bundler
155
- bundle install
156
- rake-compiler cross-ruby VERSION=1.9.1-p243
157
-
158
- == Release process
133
+ brew install openssl
134
+
135
+ # 1.8.6
136
+ # Don't worry about inconsistent patchlevels here. It works.
137
+ rvm install 1.8.6-p399
138
+ rvm use 1.8.6-p399
139
+ rvm gemset create cucumber
140
+ rvm use @cucumber
141
+ gem install bundler
142
+ bundle install
143
+ rake-compiler cross-ruby VERSION=1.8.6-p287
144
+
145
+ # 1.9.1
146
+ # Later 1.9.1 patch levels or 1.9.2 don't compile on mingw.
147
+ # The compiled binaries should still work on 1.9.2
148
+ rvm install 1.9.1-p243
149
+ rvm use 1.9.1-p243
150
+ rvm gemset create cucumber
151
+ rvm use @cucumber
152
+ gem install bundler
153
+ bundle install
154
+ rake-compiler cross-ruby VERSION=1.9.1-p243
155
+
156
+ ## Release process
159
157
 
160
158
  * Make sure GHERKIN_JS is defined (see Javascript section above)
161
159
  * Bump version in:
162
- ** gherkin.gemspec
163
- ** java/pom.xml
164
- ** ikvm/Gherkin/Gherkin.csproj (2 places)
165
- ** js/package.json
166
- * Commit changes.
160
+ * gherkin.gemspec
161
+ * java/pom.xml
162
+ * ikvm/Gherkin/Gherkin.csproj (2 places)
163
+ * js/package.json
164
+ * Commit changes, otherwise you will get an error at the end when a tag is made.
167
165
  * bundle exec rake gems:prepare && ./build_native_gems.sh && bundle exec rake release:ALL
168
- ** The specs intermittently fail with a segfault from therubyracer. Running specs can be disabled with SKIP_JS_SPECS=true
166
+ * The specs intermittently fail with a segfault from therubyracer. Running specs can be disabled with SKIP_JS_SPECS=true
169
167
  * Announce on Cucumber list, IRC and Twitter.
170
168
 
171
- == Note on Patches/Pull Requests
169
+ ## Note on Patches/Pull Requests
172
170
 
173
171
  * Fork the project.
174
172
  * Run rake ragel:rb to generate all the I18n lexers
@@ -177,9 +175,9 @@ Make sure you have openssl installed first.
177
175
  future version unintentionally.
178
176
  * Commit, do not mess with Rakefile, VERSION, or History.txt.
179
177
  (if you want to have your own version, that is fine but
180
- bump version in a commit by itself I can ignore when I pull)
178
+ bump version in a commit by itself I can ignore when I pull)
181
179
  * Send me a pull request. Bonus points for topic branches.
182
180
 
183
- == Copyright
181
+ ## Copyright
184
182
 
185
183
  Copyright (c) 2009-2010 Mike Sassak, Gregory Hnatiuk, Aslak Hellesøy. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
  GHERKIN_VERSION = Gem::Specification.load(File.dirname(__FILE__) + '/gherkin.gemspec').version.version
3
3
  require 'rubygems'
4
- require 'bundler'
5
4
  unless ENV['RUBY_CC_VERSION']
5
+ require 'bundler'
6
6
  Bundler.setup
7
7
  Bundler::GemHelper.install_tasks
8
8
  end
@@ -180,7 +180,7 @@ Feature: JSON formatter
180
180
  "name": "so",
181
181
  "line": 26,
182
182
  "multiline_arg": {
183
- "type": "py_string",
183
+ "type": "doc_string",
184
184
  "value": "innocent",
185
185
  "line": 27
186
186
  }
@@ -161,7 +161,7 @@ Feature: JSON lexer
161
161
  "name": "so",
162
162
  "line": 26,
163
163
  "multiline_arg": {
164
- "type": "py_string",
164
+ "type": "doc_string",
165
165
  "value": "innocent",
166
166
  "line": 27
167
167
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "gherkin"
5
- s.version = "2.3.10"
5
+ s.version = "2.4.0"
6
6
  s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
7
7
  s.description = "A fast Gherkin lexer/parser for based on the Ragel State Machine Compiler."
8
8
  s.summary = "#{s.name}-#{s.version}"
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.extra_rdoc_files = ["LICENSE", "README.rdoc", "History.txt"]
19
18
  s.rdoc_options = ["--charset=UTF-8"]
20
19
  s.require_path = "lib"
21
20
 
@@ -53,7 +52,13 @@ Gem::Specification.new do |s|
53
52
  s.add_development_dependency('bundler', '>= 1.0.14')
54
53
  s.add_development_dependency('rspec', '>= 2.6.0')
55
54
  s.add_development_dependency('awesome_print', '>= 0.4.0')
56
- s.add_development_dependency('therubyracer', '>= 0.9.0.beta4') if ENV['GHERKIN_JS'] && !defined?(JRUBY_VERSION)
55
+
56
+ unless ENV['RUBY_CC_VERSION'] || defined?(JRUBY_VERSION)
57
+ s.add_development_dependency('therubyracer', '>= 0.9.0.beta7') if ENV['GHERKIN_JS']
58
+ # For Documentation:
59
+ s.add_development_dependency('yard', '= 0.7.1')
60
+ s.add_development_dependency('rdiscount', '= 1.6.8')
61
+ end
57
62
 
58
63
  # Only needed by Cucumber. Remove when Cucumber no longer needs those.
59
64
  s.add_development_dependency('term-ansicolor', '>= 1.0.5')
@@ -3,7 +3,7 @@ module Gherkin
3
3
  # Defines aliases for ANSI coloured output. Default colours can be overridden by defining
4
4
  # a <tt>GHERKIN_COLORS</tt> variable in your shell, very much like how you can
5
5
  # tweak the familiar POSIX command <tt>ls</tt> with
6
- # <a href="http://mipsisrisc.com/rambling/2008/06/27/lscolorsls_colors-now-with-linux-support/">$LSCOLORS/$LS_COLORS</a>
6
+ # $LSCOLORS: http://linux-sxs.org/housekeeping/lscolors.html
7
7
  #
8
8
  # The colours that you can change are:
9
9
  #
@@ -119,7 +119,7 @@ module Gherkin
119
119
  case multiline_arg
120
120
  when Array
121
121
  range = range.first..multiline_arg[-1].line
122
- when Model::PyString
122
+ when Model::DocString
123
123
  range = range.first..multiline_arg.line_range.last
124
124
  end
125
125
  range
@@ -144,8 +144,8 @@ module Gherkin
144
144
  'type' => 'table',
145
145
  'value' => hash['multiline_arg']
146
146
  }
147
- elsif PyString === @multiline_arg
148
- hash['multiline_arg']['type'] = 'py_string'
147
+ elsif DocString === @multiline_arg
148
+ hash['multiline_arg']['type'] = 'doc_string'
149
149
  end
150
150
  hash
151
151
  end
@@ -179,7 +179,7 @@ module Gherkin
179
179
  end
180
180
  end
181
181
 
182
- class PyString < Hashable
182
+ class DocString < Hashable
183
183
  native_impl('gherkin')
184
184
 
185
185
  attr_reader :value, :line
@@ -111,8 +111,8 @@ module Gherkin
111
111
  @step_printer.write_step(@io, text_format, arg_format, step.name, arguments)
112
112
  @io.puts(indented_location(location, proceed))
113
113
  case step.multiline_arg
114
- when Model::PyString
115
- py_string(step.multiline_arg)
114
+ when Model::DocString
115
+ doc_string(step.multiline_arg)
116
116
  when Array
117
117
  table(step.multiline_arg)
118
118
  end
@@ -180,8 +180,8 @@ module Gherkin
180
180
 
181
181
  private
182
182
 
183
- def py_string(py_string)
184
- @io.puts " \"\"\"\n" + escape_triple_quotes(indent(py_string.value, ' ')) + "\n \"\"\""
183
+ def doc_string(doc_string)
184
+ @io.puts " \"\"\"\n" + escape_triple_quotes(indent(doc_string.value, ' ')) + "\n \"\"\""
185
185
  end
186
186
 
187
187
  def exception(exception)
@@ -57,7 +57,7 @@ module Gherkin
57
57
  if(ma['type'] == 'table')
58
58
  step.multiline_arg = rows(ma['value'])
59
59
  else
60
- step.multiline_arg = Formatter::Model::PyString.new(ma['value'], ma['line'])
60
+ step.multiline_arg = Formatter::Model::DocString.new(ma['value'], ma['line'])
61
61
  end
62
62
  end
63
63
 
@@ -57,8 +57,8 @@ module Gherkin
57
57
  @table << Formatter::Model::Row.new(grab_comments!, cells, line)
58
58
  end
59
59
 
60
- def py_string(string, line)
61
- @py_string = Formatter::Model::PyString.new(string, line)
60
+ def doc_string(string, line)
61
+ @doc_string = Formatter::Model::DocString.new(string, line)
62
62
  end
63
63
 
64
64
  def eof
@@ -90,15 +90,15 @@ module Gherkin
90
90
  table
91
91
  end
92
92
 
93
- def grab_py_string!
94
- py_string = @py_string
95
- @py_string = nil
96
- py_string
93
+ def grab_doc_string!
94
+ doc_string = @doc_string
95
+ @doc_string = nil
96
+ doc_string
97
97
  end
98
98
 
99
99
  def replay_step_or_examples
100
100
  if(@step_statement)
101
- @step_statement.multiline_arg = grab_py_string! || grab_rows!
101
+ @step_statement.multiline_arg = grab_doc_string! || grab_rows!
102
102
  @formatter.step(@step_statement)
103
103
  @step_statement = nil
104
104
  end
@@ -1,4 +1,4 @@
1
- | | feature | background | scenario | scenario_outline | examples | step | row | py_string | eof | comment | tag |
1
+ | | feature | background | scenario | scenario_outline | examples | step | row | doc_string | eof | comment | tag |
2
2
  | meta | E | E | E | E | E | E | E | E | eof | comment | tag |
3
3
  | comment | pop() | pop() | pop() | pop() | pop() | pop() | pop() | pop() | eof | pop() | tag |
4
4
  | tag | pop() | E | pop() | pop() | pop() | E | E | E | E | E | tag |
@@ -1,4 +1,4 @@
1
- | | feature | background | scenario | scenario_outline | examples | step | row | py_string | eof | comment | tag |
1
+ | | feature | background | scenario | scenario_outline | examples | step | row | doc_string | eof | comment | tag |
2
2
  | root | feature | E | E | E | E | E | E | E | eof | push(meta) | push(meta) |
3
3
  | feature | E | background | scenario | scenario_outline | E | E | E | E | eof | push(meta) | push(meta) |
4
4
  | step | E | E | scenario | scenario_outline | E | step | step | step | eof | push(meta) | push(meta) |
@@ -1,4 +1,4 @@
1
- | | feature | background | scenario | scenario_outline | examples | step | row | py_string | eof | comment | tag |
1
+ | | feature | background | scenario | scenario_outline | examples | step | row | doc_string | eof | comment | tag |
2
2
  | steps | E | E | E | E | E | step | E | E | eof | E | E |
3
3
  | step | E | E | E | E | E | step | step | steps | eof | E | E |
4
4
  | eof | E | E | E | E | E | E | E | E | E | E | E |
@@ -8,9 +8,9 @@ module Gherkin
8
8
  case(o)
9
9
  when Java.java.util.Collection, Array
10
10
  o.map{|e| rubify(e)}
11
- when Java.gherkin.formatter.model.PyString
11
+ when Java.gherkin.formatter.model.DocString
12
12
  require 'gherkin/formatter/model'
13
- Formatter::Model::PyString.new(o.value, o.line)
13
+ Formatter::Model::DocString.new(o.value, o.line)
14
14
  else
15
15
  o
16
16
  end
@@ -328,7 +328,7 @@ store_pystring_content(VALUE listener,
328
328
  unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
329
329
  rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2(""));
330
330
  rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\""));
331
- rb_funcall(listener, rb_intern("py_string"), 2, con, INT2FIX(current_line));
331
+ rb_funcall(listener, rb_intern("doc_string"), 2, con, INT2FIX(current_line));
332
332
  }
333
333
 
334
334
  static void
@@ -32,7 +32,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
32
32
 
33
33
  action store_pystring_content {
34
34
  String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
35
- listener.pyString(con, currentLine);
35
+ listener.docString(con, currentLine);
36
36
  }
37
37
 
38
38
  action store_feature_content {
@@ -23,7 +23,7 @@
23
23
  this.start_col,
24
24
  this.bytesToString(data.slice(this.content_start, this.next_keyword_start-1)).replace(/(\r?\n)?([\t ])*$/, '').replace(/ESCAPED_TRIPLE_QUOTE/mg, '"""')
25
25
  );
26
- this.listener.py_string(con, this.current_line);
26
+ this.listener.doc_string(con, this.current_line);
27
27
  }
28
28
 
29
29
  action store_feature_content {
@@ -122,7 +122,7 @@
122
122
 
123
123
  var Lexer = function(listener) {
124
124
  // Check that listener has the required functions
125
- var events = ['comment', 'tag', 'feature', 'background', 'scenario', 'scenario_outline', 'examples', 'step', 'py_string', 'row', 'eof'];
125
+ var events = ['comment', 'tag', 'feature', 'background', 'scenario', 'scenario_outline', 'examples', 'step', 'doc_string', 'row', 'eof'];
126
126
  for(e in events) {
127
127
  var event = events[e];
128
128
  if(typeof listener[event] != 'function') {