gherkin 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/VERSION.yml +1 -1
- data/java/src/main/resources/gherkin/.gitignore +1 -0
- data/lib/gherkin/c_lexer.rb +3 -3
- data/lib/gherkin/i18n.rb +54 -71
- data/lib/gherkin/i18n_lexer.rb +1 -1
- data/lib/gherkin/rb_lexer.rb +3 -3
- data/lib/gherkin/rubify.rb +18 -0
- data/ragel/lexer.c.rl.erb +3 -3
- data/ragel/lexer.java.rl.erb +4 -4
- data/ragel/lexer.rb.rl.erb +2 -2
- data/ragel/lexer_common.rl.erb +5 -5
- data/spec/gherkin/i18n_lexer_spec.rb +3 -3
- data/spec/gherkin/i18n_spec.rb +2 -0
- data/tasks/compile.rake +25 -11
- data/tasks/ragel_task.rb +6 -6
- metadata +5 -3
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.0.15 (2010-04-19)
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* Implemented more functionality in I18n.java. (Aslak Hellesøy)
|
5
|
+
|
6
|
+
=== Changed Features
|
7
|
+
* Java methods are no longer throwing Exception (but RuntimeException). (Aslak Hellesøy)
|
8
|
+
|
1
9
|
== 1.0.14 (2010-04-18)
|
2
10
|
(Something went wrong when releasing 1.0.13)
|
3
11
|
|
data/VERSION.yml
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
*.properties
|
data/lib/gherkin/c_lexer.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Gherkin
|
2
2
|
module CLexer
|
3
|
-
def self.[](
|
4
|
-
require "gherkin_lexer_#{
|
5
|
-
const_get(
|
3
|
+
def self.[](i18n_underscored_iso_code)
|
4
|
+
require "gherkin_lexer_#{i18n_underscored_iso_code}"
|
5
|
+
const_get(i18n_underscored_iso_code.capitalize)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/lib/gherkin/i18n.rb
CHANGED
@@ -1,20 +1,29 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'gherkin/rubify'
|
2
3
|
|
3
4
|
module Gherkin
|
4
5
|
class I18n
|
5
|
-
|
6
|
+
unless defined?(BYPASS_JAVA_IMPL)
|
7
|
+
require 'gherkin/java_impl'
|
8
|
+
java_impl('gherkin.jar')
|
9
|
+
end
|
10
|
+
|
11
|
+
ALL_KEYS = %w{name native feature background scenario scenario_outline examples given when then and but}
|
12
|
+
KEYWORD_KEYS = ALL_KEYS - %w{name native}
|
6
13
|
STEP_KEYWORD_KEYS = %w{given when then and but}
|
7
14
|
GWT_KEYWORD_KEYS = %w{given when then}
|
8
15
|
LANGUAGES = YAML.load_file(File.dirname(__FILE__) + '/i18n.yml')
|
9
16
|
|
10
17
|
class << self
|
18
|
+
include Rubify
|
19
|
+
|
11
20
|
# Used by code generators for other lexer tools like pygments lexer and textmate bundle
|
12
21
|
def all
|
13
|
-
LANGUAGES.keys.sort.map{|
|
22
|
+
LANGUAGES.keys.sort.map{|iso_code| get(iso_code)}
|
14
23
|
end
|
15
24
|
|
16
|
-
def get(
|
17
|
-
languages[
|
25
|
+
def get(iso_code)
|
26
|
+
languages[iso_code] ||= new(iso_code)
|
18
27
|
end
|
19
28
|
|
20
29
|
# Returns all keyword translations and aliases of +keywords+, escaped and joined with <tt>|</tt>.
|
@@ -25,9 +34,9 @@ module Gherkin
|
|
25
34
|
# The +keywords+ arguments can be one of <tt>:feature</tt>, <tt>:background</tt>, <tt>:scenario</tt>,
|
26
35
|
# <tt>:scenario_outline</tt>, <tt>:examples</tt>, <tt>:step</tt>.
|
27
36
|
def keyword_regexp(*keywords)
|
28
|
-
unique_keywords = all.map do |
|
37
|
+
unique_keywords = all.map do |i18n|
|
29
38
|
keywords.map do |keyword|
|
30
|
-
|
39
|
+
i18n.__send__("#{keyword}_keywords".to_sym)
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
@@ -35,7 +44,7 @@ module Gherkin
|
|
35
44
|
end
|
36
45
|
|
37
46
|
def code_keywords
|
38
|
-
all.map{|i18n| i18n.code_keywords}.flatten.uniq.sort
|
47
|
+
rubify(all.map{|i18n| i18n.code_keywords}).flatten.uniq.sort
|
39
48
|
end
|
40
49
|
|
41
50
|
def code_keyword_for(gherkin_keyword)
|
@@ -45,12 +54,26 @@ module Gherkin
|
|
45
54
|
def language_table
|
46
55
|
require 'stringio'
|
47
56
|
require 'gherkin/formatter/pretty_formatter'
|
48
|
-
io = StringIO.new
|
57
|
+
io = defined?(JRUBY_VERSION) ? Java.java.io.StringWriter.new : StringIO.new
|
49
58
|
pf = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
50
|
-
all.each{|i18n| pf.row([i18n.
|
59
|
+
all.each{|i18n| pf.row([i18n.iso_code, i18n.keywords('name')[0], i18n.keywords('native')[0]], 0)}
|
51
60
|
pf.flush_table
|
52
|
-
|
53
|
-
|
61
|
+
if defined?(JRUBY_VERSION)
|
62
|
+
io.getBuffer.toString
|
63
|
+
else
|
64
|
+
io.rewind
|
65
|
+
io.read
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def unicode_escape(word, prefix="\\u")
|
70
|
+
word = word.unpack("U*").map do |c|
|
71
|
+
if c > 127 || c == 32
|
72
|
+
"#{prefix}%04x" % c
|
73
|
+
else
|
74
|
+
c.chr
|
75
|
+
end
|
76
|
+
end.join
|
54
77
|
end
|
55
78
|
|
56
79
|
private
|
@@ -60,12 +83,12 @@ module Gherkin
|
|
60
83
|
end
|
61
84
|
end
|
62
85
|
|
63
|
-
attr_reader :
|
86
|
+
attr_reader :iso_code
|
64
87
|
|
65
|
-
def initialize(
|
66
|
-
@
|
67
|
-
@keywords = LANGUAGES[
|
68
|
-
raise "Language not supported: #{
|
88
|
+
def initialize(iso_code)
|
89
|
+
@iso_code = iso_code
|
90
|
+
@keywords = LANGUAGES[iso_code]
|
91
|
+
raise "Language not supported: #{iso_code.inspect}" if @iso_code.nil?
|
69
92
|
@keywords['grammar_name'] = @keywords['name'].gsub(/\s/, '')
|
70
93
|
end
|
71
94
|
|
@@ -88,57 +111,25 @@ module Gherkin
|
|
88
111
|
|
89
112
|
def c(listener)
|
90
113
|
require 'gherkin/c_lexer'
|
91
|
-
CLexer[
|
114
|
+
CLexer[underscored_iso_code].new(listener)
|
92
115
|
end
|
93
116
|
|
94
117
|
def rb(listener)
|
95
118
|
require 'gherkin/rb_lexer'
|
96
|
-
RbLexer[
|
97
|
-
end
|
98
|
-
|
99
|
-
def sanitized_key
|
100
|
-
@key.gsub(/[\s-]/, '_').downcase
|
101
|
-
end
|
102
|
-
|
103
|
-
def incomplete?
|
104
|
-
KEYWORD_KEYS.detect{|key| @keywords[key].nil?}
|
105
|
-
end
|
106
|
-
|
107
|
-
def feature_keywords
|
108
|
-
keywords('feature')
|
119
|
+
RbLexer[underscored_iso_code].new(listener)
|
109
120
|
end
|
110
121
|
|
111
|
-
def
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
def scenario_outline_keywords
|
116
|
-
keywords('scenario_outline')
|
117
|
-
end
|
118
|
-
|
119
|
-
def background_keywords
|
120
|
-
keywords('background')
|
121
|
-
end
|
122
|
-
|
123
|
-
def examples_keywords
|
124
|
-
keywords('examples')
|
125
|
-
end
|
126
|
-
|
127
|
-
def but_keywords
|
128
|
-
keywords('but')
|
129
|
-
end
|
130
|
-
|
131
|
-
def and_keywords
|
132
|
-
keywords('and')
|
122
|
+
def underscored_iso_code
|
123
|
+
@iso_code.gsub(/[\s-]/, '_').downcase
|
133
124
|
end
|
134
125
|
|
135
126
|
# Keywords that can be used in Gherkin source
|
136
127
|
def step_keywords
|
137
|
-
STEP_KEYWORD_KEYS.map{|
|
128
|
+
STEP_KEYWORD_KEYS.map{|iso_code| keywords(iso_code)}.flatten.uniq
|
138
129
|
end
|
139
130
|
|
140
131
|
def gwt_keywords
|
141
|
-
GWT_KEYWORD_KEYS.map{|
|
132
|
+
GWT_KEYWORD_KEYS.map{|iso_code| keywords(iso_code)}.flatten.uniq
|
142
133
|
end
|
143
134
|
|
144
135
|
# Keywords that can be used in code
|
@@ -148,17 +139,9 @@ module Gherkin
|
|
148
139
|
result
|
149
140
|
end
|
150
141
|
|
151
|
-
def
|
152
|
-
@keywords[
|
153
|
-
|
154
|
-
|
155
|
-
def native
|
156
|
-
@keywords['native']
|
157
|
-
end
|
158
|
-
|
159
|
-
def keywords(key)
|
160
|
-
raise "No #{key} in #{@keywords.inspect}" if @keywords[key].nil?
|
161
|
-
@keywords[key].split('|').map{|keyword| keyword_space(key, keyword)}
|
142
|
+
def keywords(iso_code)
|
143
|
+
raise "No #{iso_code} in #{@keywords.inspect}" if @keywords[iso_code].nil?
|
144
|
+
@keywords[iso_code].split('|').map{|keyword| keyword_space(iso_code, keyword)}
|
162
145
|
end
|
163
146
|
|
164
147
|
def keyword_table
|
@@ -167,12 +150,12 @@ module Gherkin
|
|
167
150
|
io = StringIO.new
|
168
151
|
pf = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
169
152
|
|
170
|
-
|
153
|
+
KEYWORD_KEYS.each do |key|
|
171
154
|
pf.row([key, keywords(key).map{|keyword| %{"#{keyword}"}}.join(', ')], 0)
|
172
155
|
end
|
173
|
-
|
174
|
-
code_keywords = keywords(key).reject{|
|
175
|
-
%{"#{self.class.code_keyword_for(
|
156
|
+
GWT_KEYWORD_KEYS.each do |key|
|
157
|
+
code_keywords = keywords(key).reject{|keyword| keyword == '* '}.map do |keyword|
|
158
|
+
%{"#{self.class.code_keyword_for(keyword)}"}
|
176
159
|
end.join(', ')
|
177
160
|
pf.row(["#{key} (code)", code_keywords], 0)
|
178
161
|
end
|
@@ -184,8 +167,8 @@ module Gherkin
|
|
184
167
|
|
185
168
|
private
|
186
169
|
|
187
|
-
def keyword_space(
|
188
|
-
if(STEP_KEYWORD_KEYS.index(
|
170
|
+
def keyword_space(iso_code, keyword)
|
171
|
+
if(STEP_KEYWORD_KEYS.index(iso_code))
|
189
172
|
(keyword + ' ').sub(/< $/,'')
|
190
173
|
else
|
191
174
|
keyword
|
data/lib/gherkin/i18n_lexer.rb
CHANGED
data/lib/gherkin/rb_lexer.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Gherkin
|
2
2
|
module RbLexer
|
3
|
-
def self.[](
|
4
|
-
require "gherkin/rb_lexer/#{
|
5
|
-
const_get(
|
3
|
+
def self.[](i18n_underscored_iso_code)
|
4
|
+
require "gherkin/rb_lexer/#{i18n_underscored_iso_code}"
|
5
|
+
const_get(i18n_underscored_iso_code.capitalize)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Gherkin
|
2
|
+
module Rubify
|
3
|
+
if defined?(JRUBY_VERSION)
|
4
|
+
# Translate Java objects to Ruby.
|
5
|
+
def rubify(o)
|
6
|
+
if Java.java.util.Collection === o || Array === o
|
7
|
+
o.map{|e| rubify(e)}
|
8
|
+
else
|
9
|
+
o
|
10
|
+
end
|
11
|
+
end
|
12
|
+
else
|
13
|
+
def rubify(o)
|
14
|
+
o
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/ragel/lexer.c.rl.erb
CHANGED
@@ -230,7 +230,7 @@ static VALUE rb_eGherkinLexingError;
|
|
230
230
|
}
|
231
231
|
}
|
232
232
|
|
233
|
-
include lexer_common "lexer_common.<%= @i18n.
|
233
|
+
include lexer_common "lexer_common.<%= @i18n.underscored_iso_code %>.rl";
|
234
234
|
|
235
235
|
}%%
|
236
236
|
|
@@ -407,13 +407,13 @@ static VALUE CLexer_scan(VALUE self, VALUE input)
|
|
407
407
|
}
|
408
408
|
}
|
409
409
|
|
410
|
-
void Init_gherkin_lexer_<%= @i18n.
|
410
|
+
void Init_gherkin_lexer_<%= @i18n.underscored_iso_code %>()
|
411
411
|
{
|
412
412
|
mGherkin = rb_define_module("Gherkin");
|
413
413
|
rb_eGherkinLexingError = rb_const_get(mGherkin, rb_intern("LexingError"));
|
414
414
|
|
415
415
|
mCLexer = rb_define_module_under(mGherkin, "CLexer");
|
416
|
-
cI18nLexer = rb_define_class_under(mCLexer, "<%= @i18n.
|
416
|
+
cI18nLexer = rb_define_class_under(mCLexer, "<%= @i18n.underscored_iso_code.capitalize %>", rb_cObject);
|
417
417
|
rb_define_alloc_func(cI18nLexer, CLexer_alloc);
|
418
418
|
rb_define_method(cI18nLexer, "initialize", CLexer_init, 1);
|
419
419
|
rb_define_method(cI18nLexer, "scan", CLexer_scan, 1);
|
data/ragel/lexer.java.rl.erb
CHANGED
@@ -8,7 +8,7 @@ import gherkin.Lexer;
|
|
8
8
|
import gherkin.Listener;
|
9
9
|
import gherkin.LexingError;
|
10
10
|
|
11
|
-
public class <%= @i18n.
|
11
|
+
public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
|
12
12
|
%%{
|
13
13
|
machine lexer;
|
14
14
|
alphtype byte;
|
@@ -129,18 +129,18 @@ public class <%= @i18n.sanitized_key.upcase %> implements Lexer {
|
|
129
129
|
}
|
130
130
|
}
|
131
131
|
|
132
|
-
include lexer_common "lexer_common.<%= @i18n.
|
132
|
+
include lexer_common "lexer_common.<%= @i18n.underscored_iso_code %>.rl";
|
133
133
|
}%%
|
134
134
|
|
135
135
|
private final Listener listener;
|
136
136
|
|
137
|
-
public <%= @i18n.
|
137
|
+
public <%= @i18n.underscored_iso_code.upcase %>(Listener listener) {
|
138
138
|
this.listener = listener;
|
139
139
|
}
|
140
140
|
|
141
141
|
%% write data noerror;
|
142
142
|
|
143
|
-
public void scan(CharSequence inputSequence)
|
143
|
+
public void scan(CharSequence inputSequence) {
|
144
144
|
String input = inputSequence.toString() + "\n%_FEATURE_END_%";
|
145
145
|
byte[] data = input.getBytes();
|
146
146
|
int cs, p = 0, pe = data.length;
|
data/ragel/lexer.rb.rl.erb
CHANGED
@@ -2,7 +2,7 @@ require 'gherkin/core_ext/array'
|
|
2
2
|
|
3
3
|
module Gherkin
|
4
4
|
module RbLexer
|
5
|
-
class <%= @i18n.
|
5
|
+
class <%= @i18n.underscored_iso_code.capitalize %> #:nodoc:
|
6
6
|
%%{
|
7
7
|
machine lexer;
|
8
8
|
|
@@ -121,7 +121,7 @@ module Gherkin
|
|
121
121
|
end
|
122
122
|
}
|
123
123
|
|
124
|
-
include lexer_common "lexer_common.<%= @i18n.
|
124
|
+
include lexer_common "lexer_common.<%= @i18n.underscored_iso_code %>.rl";
|
125
125
|
}%%
|
126
126
|
|
127
127
|
def initialize(listener)
|
data/ragel/lexer_common.rl.erb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
machine lexer_common;
|
3
3
|
|
4
4
|
# Language specific
|
5
|
-
I18N_Feature = (<%= ragel_list(@i18n.
|
6
|
-
I18N_Background = (<%= ragel_list(@i18n.
|
7
|
-
I18N_ScenarioOutline = (<%= ragel_list(@i18n.
|
8
|
-
I18N_Scenario = (<%= ragel_list(@i18n.
|
5
|
+
I18N_Feature = (<%= ragel_list(@i18n.keywords('feature')) %> ':') >start_keyword %end_keyword;
|
6
|
+
I18N_Background = (<%= ragel_list(@i18n.keywords('background')) %> ':') >start_keyword %end_keyword;
|
7
|
+
I18N_ScenarioOutline = (<%= ragel_list(@i18n.keywords('scenario_outline')) %> ':') >start_keyword %end_keyword;
|
8
|
+
I18N_Scenario = (<%= ragel_list(@i18n.keywords('scenario')) %> ':') >start_keyword %end_keyword;
|
9
9
|
I18N_Step = <%= ragel_list(@i18n.step_keywords) %> >start_keyword %end_keyword;
|
10
|
-
I18N_Examples = (<%= ragel_list(@i18n.
|
10
|
+
I18N_Examples = (<%= ragel_list(@i18n.keywords('examples')) %> ':') >start_keyword %end_keyword;
|
11
11
|
|
12
12
|
EOF = '%_FEATURE_END_%'; # Explicit EOF added before scanning begins
|
13
13
|
EOL = ('\n' | '\r\n') @inc_line_number @last_newline;
|
@@ -9,14 +9,14 @@ module Gherkin
|
|
9
9
|
|
10
10
|
it "should store the i18n language of the last scanned feature" do
|
11
11
|
@lexer.scan("# language: fr\n")
|
12
|
-
@lexer.i18n_language.
|
12
|
+
@lexer.i18n_language.iso_code.should == "fr"
|
13
13
|
@lexer.scan("# language: no\n")
|
14
|
-
@lexer.i18n_language.
|
14
|
+
@lexer.i18n_language.iso_code.should == "no"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should use English i18n by default" do
|
18
18
|
@lexer.scan("Feature: foo\n")
|
19
|
-
@lexer.i18n_language.
|
19
|
+
@lexer.i18n_language.iso_code.should == "en"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should === its ruby class, even when the impl is Java" do
|
data/spec/gherkin/i18n_spec.rb
CHANGED
@@ -68,6 +68,7 @@ module Gherkin
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
unless defined?(JRUBY_VERSION)
|
71
72
|
it "should print available languages" do
|
72
73
|
("\n" + I18n.language_table).should == %{
|
73
74
|
| ar | Arabic | العربية |
|
@@ -115,6 +116,7 @@ module Gherkin
|
|
115
116
|
| zh-TW | Chinese traditional | 繁體中文 |
|
116
117
|
}
|
117
118
|
end
|
119
|
+
end
|
118
120
|
|
119
121
|
it "should print keywords for a given language" do
|
120
122
|
("\n" + I18n.get('fr').keyword_table).should == %{
|
data/tasks/compile.rake
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/ragel_task'
|
2
|
+
BYPASS_JAVA_IMPL = true
|
2
3
|
require 'gherkin/i18n'
|
3
4
|
|
4
5
|
CLEAN.include [
|
@@ -8,7 +9,8 @@ CLEAN.include [
|
|
8
9
|
'ragel/i18n/*.rl',
|
9
10
|
'lib/gherkin/rb_lexer/*.rb',
|
10
11
|
'ext/**/*.c',
|
11
|
-
'java/src/main/java/gherkin/lexer/*.java'
|
12
|
+
'java/src/main/java/gherkin/lexer/*.java',
|
13
|
+
'java/src/main/resources/gherkin/*.properties',
|
12
14
|
]
|
13
15
|
|
14
16
|
desc "Compile the Java extensions"
|
@@ -22,32 +24,44 @@ rl_langs = ENV['RL_LANGS'] ? ENV['RL_LANGS'].split(',') : []
|
|
22
24
|
langs = Gherkin::I18n.all.select { |lang| rl_langs.empty? || rl_langs.include?(lang.key) }
|
23
25
|
|
24
26
|
langs.each do |i18n|
|
25
|
-
java
|
26
|
-
rb
|
27
|
+
java = RagelTask.new('java', i18n)
|
28
|
+
rb = RagelTask.new('rb', i18n)
|
27
29
|
|
28
30
|
file 'lib/gherkin.jar' => [java.target, rb.target]
|
29
31
|
|
30
32
|
begin
|
31
|
-
|
33
|
+
if defined?(JRUBY_VERSION)
|
34
|
+
java_properties = "java/src/main/resources/gherkin/I18nKeywords_#{i18n.iso_code.gsub(/-/, '_')}.properties"
|
35
|
+
file java_properties => 'lib/gherkin/i18n.yml' do
|
36
|
+
File.open(java_properties, 'wb') do |io|
|
37
|
+
io.puts("# Generated file. Do not edit.")
|
38
|
+
Gherkin::I18n::KEYWORD_KEYS.each do |key|
|
39
|
+
value = Gherkin::I18n.unicode_escape(i18n.keywords(key).join("|"))
|
40
|
+
io.puts("#{key}:#{value}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
file 'lib/gherkin.jar' => java_properties
|
45
|
+
else
|
32
46
|
require 'rake/extensiontask'
|
33
47
|
|
34
48
|
c = RagelTask.new('c', i18n)
|
35
49
|
|
36
|
-
extconf = "ext/gherkin_lexer_#{i18n.
|
50
|
+
extconf = "ext/gherkin_lexer_#{i18n.underscored_iso_code}/extconf.rb"
|
37
51
|
file extconf do
|
38
52
|
FileUtils.mkdir(File.dirname(extconf)) unless File.directory?(File.dirname(extconf))
|
39
53
|
File.open(extconf, "w") do |io|
|
40
54
|
io.write(<<-EOF)
|
41
55
|
require 'mkmf'
|
42
56
|
$CFLAGS << ' -O0 -Wall -Werror'
|
43
|
-
dir_config("gherkin_lexer_#{i18n.
|
57
|
+
dir_config("gherkin_lexer_#{i18n.underscored_iso_code}")
|
44
58
|
have_library("c", "main")
|
45
|
-
create_makefile("gherkin_lexer_#{i18n.
|
59
|
+
create_makefile("gherkin_lexer_#{i18n.underscored_iso_code}")
|
46
60
|
EOF
|
47
61
|
end
|
48
62
|
end
|
49
63
|
|
50
|
-
Rake::ExtensionTask.new("gherkin_lexer_#{i18n.
|
64
|
+
Rake::ExtensionTask.new("gherkin_lexer_#{i18n.underscored_iso_code}") do |ext|
|
51
65
|
if ENV['RUBY_CC_VERSION']
|
52
66
|
ext.cross_compile = true
|
53
67
|
ext.cross_platform = 'i386-mingw32'
|
@@ -56,9 +70,9 @@ EOF
|
|
56
70
|
|
57
71
|
# The way tasks are defined with compile:xxx (but without namespace) in rake-compiler forces us
|
58
72
|
# to use these hacks for setting up dependencies. Ugly!
|
59
|
-
Rake::Task["compile:gherkin_lexer_#{i18n.
|
60
|
-
Rake::Task["compile:gherkin_lexer_#{i18n.
|
61
|
-
Rake::Task["compile:gherkin_lexer_#{i18n.
|
73
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(extconf)
|
74
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(c.target)
|
75
|
+
Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(rb.target)
|
62
76
|
|
63
77
|
Rake::Task["compile"].prerequisites.unshift(extconf)
|
64
78
|
Rake::Task["compile"].prerequisites.unshift(c.target)
|
data/tasks/ragel_task.rb
CHANGED
@@ -27,15 +27,15 @@ class RagelTask
|
|
27
27
|
|
28
28
|
def target
|
29
29
|
{
|
30
|
-
'c' => "ext/gherkin_lexer_#{@i18n.
|
31
|
-
'java' => "java/src/main/java/gherkin/lexer/#{@i18n.
|
32
|
-
'rb' => "lib/gherkin/rb_lexer/#{@i18n.
|
33
|
-
'csharp' => "tmp/#{@i18n.
|
30
|
+
'c' => "ext/gherkin_lexer_#{@i18n.underscored_iso_code}/gherkin_lexer_#{@i18n.underscored_iso_code}.c",
|
31
|
+
'java' => "java/src/main/java/gherkin/lexer/#{@i18n.underscored_iso_code.upcase}.java",
|
32
|
+
'rb' => "lib/gherkin/rb_lexer/#{@i18n.underscored_iso_code}.rb",
|
33
|
+
'csharp' => "tmp/#{@i18n.underscored_iso_code}.cs"
|
34
34
|
}[@lang]
|
35
35
|
end
|
36
36
|
|
37
37
|
def common_ragel
|
38
|
-
RL_OUTPUT_DIR + "/lexer_common.#{@i18n.
|
38
|
+
RL_OUTPUT_DIR + "/lexer_common.#{@i18n.underscored_iso_code}.rl"
|
39
39
|
end
|
40
40
|
|
41
41
|
def common_erb
|
@@ -43,7 +43,7 @@ class RagelTask
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def lang_ragel
|
46
|
-
RL_OUTPUT_DIR + "/#{@i18n.
|
46
|
+
RL_OUTPUT_DIR + "/#{@i18n.underscored_iso_code}.#{@lang}.rl"
|
47
47
|
end
|
48
48
|
|
49
49
|
def lang_erb
|
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
|
+
- 15
|
9
|
+
version: 1.0.15
|
10
10
|
platform: ruby
|
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-
|
19
|
+
date: 2010-04-20 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- ikvm/.gitignore
|
191
191
|
- java/.gitignore
|
192
192
|
- java/src/main/java/gherkin/lexer/.gitignore
|
193
|
+
- java/src/main/resources/gherkin/.gitignore
|
193
194
|
- lib/.gitignore
|
194
195
|
- lib/gherkin.rb
|
195
196
|
- lib/gherkin/c_lexer.rb
|
@@ -257,6 +258,7 @@ files:
|
|
257
258
|
- lib/gherkin/rb_lexer/vi.rb
|
258
259
|
- lib/gherkin/rb_lexer/zh_cn.rb
|
259
260
|
- lib/gherkin/rb_lexer/zh_tw.rb
|
261
|
+
- lib/gherkin/rubify.rb
|
260
262
|
- lib/gherkin/tools.rb
|
261
263
|
- lib/gherkin/tools/files.rb
|
262
264
|
- lib/gherkin/tools/reformat.rb
|