gherkin 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ == 2.2.5 (2010-10-1)
2
+
3
+ === New Features
4
+ * Gherkin will scan all top comments for the language comment. (Aslak Hellesøy)
5
+
1
6
  == 2.2.4 (2010-09-22)
2
7
 
3
8
  === Bugfixes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.4
1
+ 2.2.5
@@ -2,7 +2,7 @@
2
2
  rm -Rf release
3
3
  mkdir release
4
4
  GEM_PLATFORM=java gem build gherkin.gemspec
5
- GEM_PLATFORM=i386-mswin32 gem build gherkin.gemspec
6
- GEM_PLATFORM=i386-mingw32 gem build gherkin.gemspec
5
+ GEM_PLATFORM=x86-mswin32 gem build gherkin.gemspec
6
+ GEM_PLATFORM=x86-mingw32 gem build gherkin.gemspec
7
7
  GEM_PLATFORM=universal-dotnet gem build gherkin.gemspec
8
8
  mv *.gem release
@@ -32,7 +32,6 @@ Gem::Specification.new do |s|
32
32
 
33
33
  if ENV['GEM_PLATFORM']
34
34
  puts "GEM_PLATFORM:#{ENV['GEM_PLATFORM']}"
35
- puts "PLATFORM:#{PLATFORM}"
36
35
  end
37
36
  s.platform = ENV['GEM_PLATFORM'] if ENV['GEM_PLATFORM']
38
37
  case s.platform.to_s
@@ -11,7 +11,7 @@ module Gherkin
11
11
  end
12
12
 
13
13
  # Parse a gherkin object +o+, which can either be a JSON String,
14
- # or a Hash (from a parser JSON String).
14
+ # or a Hash (from a parsed JSON String).
15
15
  def parse(o, feature_uri='unknown.json', line_offset=0)
16
16
  o = JSON.parse(o) if String === o
17
17
  @formatter.uri(feature_uri)
@@ -10,6 +10,7 @@ module Gherkin
10
10
  class I18nLexer
11
11
  native_impl('gherkin')
12
12
 
13
+ COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s*$/
13
14
  LANGUAGE_PATTERN = /^\s*#\s*language\s*:\s*([a-zA-Z\-]+)/ #:nodoc:
14
15
  attr_reader :i18n_language
15
16
 
@@ -30,9 +31,15 @@ module Gherkin
30
31
  end
31
32
 
32
33
  def lang(source)
33
- line_one = source.split(/\n/)[0]
34
- match = LANGUAGE_PATTERN.match(line_one)
35
- I18n.get(match ? match[1] : 'en')
34
+ key = 'en'
35
+ source.split(/\n/).each do |line|
36
+ break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line
37
+ if LANGUAGE_PATTERN =~ line
38
+ key = $1
39
+ break
40
+ end
41
+ end
42
+ I18n.get(key)
36
43
  end
37
44
 
38
45
  end
@@ -20,6 +20,16 @@ module Gherkin
20
20
  @lexer.i18n_language.iso_code.should == "da"
21
21
  end
22
22
 
23
+ it "should detect language when the language comment is not the first line" do
24
+ @lexer.scan("# hello\n# language: no\n")
25
+ @lexer.i18n_language.iso_code.should == "no"
26
+ end
27
+
28
+ it "should detect language when the language is on the third line, and there are empty lines above" do
29
+ @lexer.scan("# hello\n\n# language: no\n")
30
+ @lexer.i18n_language.iso_code.should == "no"
31
+ end
32
+
23
33
  it "should use English i18n by default" do
24
34
  @lexer.scan("Feature: foo\n")
25
35
  @lexer.i18n_language.iso_code.should == "en"
@@ -78,7 +78,7 @@ EOF
78
78
  Rake::ExtensionTask.new("gherkin_lexer_#{i18n.underscored_iso_code}") do |ext|
79
79
  if ENV['RUBY_CC_VERSION']
80
80
  ext.cross_compile = true
81
- ext.cross_platform = 'i386-mingw32'
81
+ ext.cross_platform = 'x86-mingw32'
82
82
  end
83
83
  end
84
84
 
@@ -1,4 +1,3 @@
1
- begin
2
1
  require 'cucumber/rake/task'
3
2
 
4
3
  Cucumber::Rake::Task.new(:cucumber) do |t|
@@ -17,9 +16,3 @@ namespace :cucumber do
17
16
  end
18
17
  task :native_lexer => [:clean, :compile]
19
18
  end
20
-
21
- rescue LoadError
22
- task :cucumber do
23
- raise "Cucumber not installed"
24
- end
25
- end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gherkin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
4
  prerelease: false
6
5
  segments:
7
6
  - 2
8
7
  - 2
9
- - 4
10
- version: 2.2.4
8
+ - 5
9
+ version: 2.2.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - Mike Sassak
@@ -17,112 +16,106 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-09-22 00:00:00 +02:00
19
+ date: 2010-10-01 00:00:00 +02:00
21
20
  default_executable: gherkin
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ name: rake-compiler
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 1
30
29
  segments:
31
30
  - 0
32
31
  - 7
33
32
  - 1
34
33
  version: 0.7.1
35
- requirement: *id001
36
34
  type: :development
37
- name: rake-compiler
38
35
  prerelease: false
36
+ version_requirements: *id001
39
37
  - !ruby/object:Gem::Dependency
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ name: trollop
39
+ requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - ~>
44
43
  - !ruby/object:Gem::Version
45
- hash: 83
46
44
  segments:
47
45
  - 1
48
46
  - 16
49
47
  - 2
50
48
  version: 1.16.2
51
- requirement: *id002
52
49
  type: :runtime
53
- name: trollop
54
50
  prerelease: false
51
+ version_requirements: *id002
55
52
  - !ruby/object:Gem::Dependency
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
53
+ name: json
54
+ requirement: &id003 !ruby/object:Gem::Requirement
57
55
  none: false
58
56
  requirements:
59
57
  - - ~>
60
58
  - !ruby/object:Gem::Version
61
- hash: 11
62
59
  segments:
63
60
  - 1
64
61
  - 4
65
62
  - 6
66
63
  version: 1.4.6
67
- requirement: *id003
68
64
  type: :runtime
69
- name: json
70
65
  prerelease: false
66
+ version_requirements: *id003
71
67
  - !ruby/object:Gem::Dependency
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ name: term-ansicolor
69
+ requirement: &id004 !ruby/object:Gem::Requirement
73
70
  none: false
74
71
  requirements:
75
72
  - - ~>
76
73
  - !ruby/object:Gem::Version
77
- hash: 29
78
74
  segments:
79
75
  - 1
80
76
  - 0
81
77
  - 5
82
78
  version: 1.0.5
83
- requirement: *id004
84
79
  type: :runtime
85
- name: term-ansicolor
86
80
  prerelease: false
81
+ version_requirements: *id004
87
82
  - !ruby/object:Gem::Dependency
88
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
+ name: rake
84
+ requirement: &id005 !ruby/object:Gem::Requirement
89
85
  none: false
90
86
  requirements:
91
87
  - - ~>
92
88
  - !ruby/object:Gem::Version
93
- hash: 49
94
89
  segments:
95
90
  - 0
96
91
  - 8
97
92
  - 7
98
93
  version: 0.8.7
99
- requirement: *id005
100
94
  type: :development
101
- name: rake
102
95
  prerelease: false
96
+ version_requirements: *id005
103
97
  - !ruby/object:Gem::Dependency
104
- version_requirements: &id006 !ruby/object:Gem::Requirement
98
+ name: awesome_print
99
+ requirement: &id006 !ruby/object:Gem::Requirement
105
100
  none: false
106
101
  requirements:
107
102
  - - ~>
108
103
  - !ruby/object:Gem::Version
109
- hash: 21
110
104
  segments:
111
105
  - 0
112
106
  - 2
113
107
  - 1
114
108
  version: 0.2.1
115
- requirement: *id006
116
109
  type: :development
117
- name: awesome_print
118
110
  prerelease: false
111
+ version_requirements: *id006
119
112
  - !ruby/object:Gem::Dependency
120
- version_requirements: &id007 !ruby/object:Gem::Requirement
113
+ name: rspec
114
+ requirement: &id007 !ruby/object:Gem::Requirement
121
115
  none: false
122
116
  requirements:
123
117
  - - ~>
124
118
  - !ruby/object:Gem::Version
125
- hash: 62196431
126
119
  segments:
127
120
  - 2
128
121
  - 0
@@ -130,26 +123,24 @@ dependencies:
130
123
  - beta
131
124
  - 22
132
125
  version: 2.0.0.beta.22
133
- requirement: *id007
134
126
  type: :development
135
- name: rspec
136
127
  prerelease: false
128
+ version_requirements: *id007
137
129
  - !ruby/object:Gem::Dependency
138
- version_requirements: &id008 !ruby/object:Gem::Requirement
130
+ name: cucumber
131
+ requirement: &id008 !ruby/object:Gem::Requirement
139
132
  none: false
140
133
  requirements:
141
134
  - - ~>
142
135
  - !ruby/object:Gem::Version
143
- hash: 59
144
136
  segments:
145
137
  - 0
146
138
  - 9
147
139
  - 0
148
140
  version: 0.9.0
149
- requirement: *id008
150
141
  type: :development
151
- name: cucumber
152
142
  prerelease: false
143
+ version_requirements: *id008
153
144
  description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
154
145
  email: cukes@googlegroups.com
155
146
  executables:
@@ -485,7 +476,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
485
476
  requirements:
486
477
  - - ">="
487
478
  - !ruby/object:Gem::Version
488
- hash: 3
479
+ hash: -4413246641250620761
489
480
  segments:
490
481
  - 0
491
482
  version: "0"
@@ -494,7 +485,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
494
485
  requirements:
495
486
  - - ">="
496
487
  - !ruby/object:Gem::Version
497
- hash: 3
488
+ hash: -4413246641250620761
498
489
  segments:
499
490
  - 0
500
491
  version: "0"
@@ -504,7 +495,7 @@ rubyforge_project:
504
495
  rubygems_version: 1.3.7
505
496
  signing_key:
506
497
  specification_version: 3
507
- summary: gherkin-2.2.4
498
+ summary: gherkin-2.2.5
508
499
  test_files:
509
500
  - features/escaped_pipes.feature
510
501
  - features/feature_parser.feature