gherkin 2.2.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/.gitattributes +2 -0
  2. data/.gitignore +11 -0
  3. data/.mailmap +2 -0
  4. data/.rspec +1 -0
  5. data/.rvmrc +1 -0
  6. data/Gemfile +5 -0
  7. data/History.txt +306 -0
  8. data/LICENSE +20 -0
  9. data/README.rdoc +59 -0
  10. data/Rakefile +16 -0
  11. data/VERSION +1 -0
  12. data/bin/gherkin +5 -0
  13. data/build_native_gems.sh +8 -0
  14. data/cucumber.yml +3 -0
  15. data/features/escaped_pipes.feature +8 -0
  16. data/features/feature_parser.feature +237 -0
  17. data/features/json_formatter.feature +278 -0
  18. data/features/json_parser.feature +318 -0
  19. data/features/native_lexer.feature +19 -0
  20. data/features/parser_with_native_lexer.feature +205 -0
  21. data/features/pretty_formatter.feature +15 -0
  22. data/features/step_definitions/eyeball_steps.rb +3 -0
  23. data/features/step_definitions/gherkin_steps.rb +29 -0
  24. data/features/step_definitions/json_formatter_steps.rb +28 -0
  25. data/features/step_definitions/json_parser_steps.rb +20 -0
  26. data/features/step_definitions/pretty_formatter_steps.rb +82 -0
  27. data/features/steps_parser.feature +46 -0
  28. data/features/support/env.rb +38 -0
  29. data/gherkin.gemspec +59 -0
  30. data/ikvm/.gitignore +3 -0
  31. data/java/.gitignore +2 -0
  32. data/java/src/main/java/gherkin/lexer/i18n/.gitignore +1 -0
  33. data/java/src/main/resources/gherkin/.gitignore +1 -0
  34. data/lib/.gitignore +4 -0
  35. data/lib/gherkin.rb +2 -0
  36. data/lib/gherkin/c_lexer.rb +17 -0
  37. data/lib/gherkin/cli/main.rb +33 -0
  38. data/lib/gherkin/formatter/argument.rb +28 -0
  39. data/lib/gherkin/formatter/colors.rb +119 -0
  40. data/lib/gherkin/formatter/escaping.rb +15 -0
  41. data/lib/gherkin/formatter/filter_formatter.rb +136 -0
  42. data/lib/gherkin/formatter/json_formatter.rb +72 -0
  43. data/lib/gherkin/formatter/line_filter.rb +26 -0
  44. data/lib/gherkin/formatter/model.rb +231 -0
  45. data/lib/gherkin/formatter/monochrome_format.rb +9 -0
  46. data/lib/gherkin/formatter/pretty_formatter.rb +174 -0
  47. data/lib/gherkin/formatter/regexp_filter.rb +21 -0
  48. data/lib/gherkin/formatter/tag_count_formatter.rb +47 -0
  49. data/lib/gherkin/formatter/tag_filter.rb +19 -0
  50. data/lib/gherkin/i18n.rb +180 -0
  51. data/lib/gherkin/i18n.yml +601 -0
  52. data/lib/gherkin/json_parser.rb +88 -0
  53. data/lib/gherkin/lexer/i18n_lexer.rb +47 -0
  54. data/lib/gherkin/listener/event.rb +45 -0
  55. data/lib/gherkin/listener/formatter_listener.rb +113 -0
  56. data/lib/gherkin/native.rb +7 -0
  57. data/lib/gherkin/native/ikvm.rb +55 -0
  58. data/lib/gherkin/native/java.rb +55 -0
  59. data/lib/gherkin/native/null.rb +9 -0
  60. data/lib/gherkin/parser/meta.txt +5 -0
  61. data/lib/gherkin/parser/parser.rb +164 -0
  62. data/lib/gherkin/parser/root.txt +11 -0
  63. data/lib/gherkin/parser/steps.txt +4 -0
  64. data/lib/gherkin/rb_lexer.rb +8 -0
  65. data/lib/gherkin/rb_lexer/.gitignore +1 -0
  66. data/lib/gherkin/rb_lexer/README.rdoc +8 -0
  67. data/lib/gherkin/rubify.rb +24 -0
  68. data/lib/gherkin/tag_expression.rb +62 -0
  69. data/lib/gherkin/tools.rb +8 -0
  70. data/lib/gherkin/tools/files.rb +34 -0
  71. data/lib/gherkin/tools/reformat.rb +20 -0
  72. data/lib/gherkin/tools/stats.rb +20 -0
  73. data/lib/gherkin/tools/stats_listener.rb +60 -0
  74. data/lib/gherkin/version.rb +3 -0
  75. data/ragel/i18n/.gitignore +1 -0
  76. data/ragel/lexer.c.rl.erb +459 -0
  77. data/ragel/lexer.java.rl.erb +224 -0
  78. data/ragel/lexer.rb.rl.erb +179 -0
  79. data/ragel/lexer_common.rl.erb +50 -0
  80. data/spec/gherkin/c_lexer_spec.rb +21 -0
  81. data/spec/gherkin/fixtures/1.feature +8 -0
  82. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  83. data/spec/gherkin/fixtures/complex.feature +45 -0
  84. data/spec/gherkin/fixtures/complex.json +143 -0
  85. data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
  86. data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
  87. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  88. data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
  89. data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
  90. data/spec/gherkin/fixtures/i18n_no.feature +7 -0
  91. data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
  92. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
  93. data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
  94. data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
  95. data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
  96. data/spec/gherkin/fixtures/with_bom.feature +3 -0
  97. data/spec/gherkin/formatter/argument_spec.rb +28 -0
  98. data/spec/gherkin/formatter/colors_spec.rb +18 -0
  99. data/spec/gherkin/formatter/filter_formatter_spec.rb +165 -0
  100. data/spec/gherkin/formatter/model_spec.rb +15 -0
  101. data/spec/gherkin/formatter/pretty_formatter_spec.rb +140 -0
  102. data/spec/gherkin/formatter/spaces.feature +9 -0
  103. data/spec/gherkin/formatter/tabs.feature +9 -0
  104. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
  105. data/spec/gherkin/i18n_spec.rb +149 -0
  106. data/spec/gherkin/java_lexer_spec.rb +20 -0
  107. data/spec/gherkin/json.rb +5 -0
  108. data/spec/gherkin/json_parser_spec.rb +67 -0
  109. data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
  110. data/spec/gherkin/output_stream_string_io.rb +24 -0
  111. data/spec/gherkin/parser/parser_spec.rb +16 -0
  112. data/spec/gherkin/rb_lexer_spec.rb +19 -0
  113. data/spec/gherkin/sexp_recorder.rb +56 -0
  114. data/spec/gherkin/shared/lexer_group.rb +592 -0
  115. data/spec/gherkin/shared/py_string_group.rb +153 -0
  116. data/spec/gherkin/shared/row_group.rb +120 -0
  117. data/spec/gherkin/shared/tags_group.rb +54 -0
  118. data/spec/gherkin/tag_expression_spec.rb +137 -0
  119. data/spec/spec_helper.rb +68 -0
  120. data/tasks/bench.rake +184 -0
  121. data/tasks/bench/feature_builder.rb +49 -0
  122. data/tasks/bench/generated/.gitignore +1 -0
  123. data/tasks/bench/null_listener.rb +4 -0
  124. data/tasks/compile.rake +102 -0
  125. data/tasks/cucumber.rake +18 -0
  126. data/tasks/gems.rake +42 -0
  127. data/tasks/ikvm.rake +54 -0
  128. data/tasks/ragel_task.rb +70 -0
  129. data/tasks/rdoc.rake +9 -0
  130. data/tasks/release.rake +30 -0
  131. data/tasks/rspec.rake +8 -0
  132. metadata +447 -0
@@ -0,0 +1,68 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
4
+
5
+ require 'gherkin'
6
+ require 'stringio'
7
+ require 'gherkin/sexp_recorder'
8
+ require 'gherkin/output_stream_string_io'
9
+ require 'gherkin/json'
10
+ require 'gherkin/shared/lexer_group'
11
+ require 'gherkin/shared/tags_group'
12
+ require 'gherkin/shared/py_string_group'
13
+ require 'gherkin/shared/row_group'
14
+
15
+ module GherkinSpecHelper
16
+ def scan_file(file)
17
+ @lexer.scan(fixture(file))
18
+ end
19
+
20
+ def fixture(file)
21
+ File.new(File.dirname(__FILE__) + "/gherkin/fixtures/" + file).read
22
+ end
23
+
24
+ def rubify_hash(hash)
25
+ if defined?(JRUBY_VERSION)
26
+ h = {}
27
+ hash.keySet.each{|key| h[key] = hash[key]}
28
+ h
29
+ else
30
+ hash
31
+ end
32
+ end
33
+ end
34
+
35
+ RSpec.configure do |c|
36
+ c.include(GherkinSpecHelper)
37
+ end
38
+
39
+ # Allows comparison of Java List with Ruby Array (rows)
40
+ RSpec::Matchers.define :r do |expected|
41
+ match do |row|
42
+ def row.inspect
43
+ "r " + self.map{|cell| cell}.inspect
44
+ end
45
+ row.map{|cell| cell}.should == expected
46
+ end
47
+ end
48
+
49
+ RSpec::Matchers.define :a do |expected|
50
+ match do |array|
51
+ def array.inspect
52
+ "a " + self.map{|e| e.to_sym}.inspect
53
+ end
54
+ array.map{|e| e.to_sym}.should == expected
55
+ end
56
+ end
57
+
58
+ RSpec::Matchers.define :sym do |expected|
59
+ match do |actual|
60
+ expected.to_s == actual.to_s
61
+ end
62
+ end
63
+
64
+ RSpec::Matchers.define :allow do |event|
65
+ match do |parser|
66
+ parser.expected.index(event)
67
+ end
68
+ end
@@ -0,0 +1,184 @@
1
+ %w{/../lib /bench}.each do |l|
2
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + l)
3
+ end
4
+
5
+ require 'benchmark'
6
+
7
+ GENERATED_FEATURES = File.expand_path(File.dirname(__FILE__) + "/bench/generated")
8
+
9
+ class RandomFeatureGenerator
10
+ def initialize(number)
11
+ require 'faker'
12
+ require 'feature_builder'
13
+
14
+ @number = number
15
+ end
16
+
17
+ def generate
18
+ @number.times do
19
+ name = catch_phrase
20
+ feature = FeatureBuilder.new(name) do |f|
21
+ num_scenarios = rand_in(1..10)
22
+ num_scenarios.times do
23
+ f.scenario(bs) do |steps|
24
+ num_steps = rand_in(3..10)
25
+ num_steps.times do
26
+ steps.step(sentence, self)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ write feature.to_s, name
32
+ end
33
+ end
34
+
35
+ def write(content, name)
36
+ File.open(GENERATED_FEATURES + "/#{name.downcase.gsub(/[\s\-\/]/, '_')}.feature", "w+") do |file|
37
+ file << content
38
+ end
39
+ end
40
+
41
+ def rand_in(range)
42
+ ary = range.to_a
43
+ ary[rand(ary.length - 1)]
44
+ end
45
+
46
+ def catch_phrase
47
+ Faker::Company.catch_phrase
48
+ end
49
+
50
+ def bs
51
+ Faker::Company.bs.capitalize
52
+ end
53
+
54
+ def sentence
55
+ Faker::Lorem.sentence
56
+ end
57
+
58
+ def table_cell
59
+ Faker::Lorem.words(rand(2)+1).join(" ")
60
+ end
61
+ end
62
+
63
+ class Benchmarker
64
+ def initialize
65
+ @features = Dir[GENERATED_FEATURES + "/**/*feature"]
66
+ end
67
+
68
+ def report(lexer)
69
+ Benchmark.bm do |x|
70
+ x.report("#{lexer}:") { send :"run_#{lexer}" }
71
+ end
72
+ end
73
+
74
+ def report_all
75
+ Benchmark.bmbm do |x|
76
+ x.report("native_gherkin:") { run_native_gherkin }
77
+ x.report("native_gherkin_no_parser:") { run_native_gherkin_no_parser }
78
+ x.report("rb_gherkin:") { run_rb_gherkin }
79
+ x.report("cucumber:") { run_cucumber }
80
+ x.report("tt:") { run_tt }
81
+ end
82
+ end
83
+
84
+ def run_cucumber
85
+ require 'cucumber'
86
+ require 'logger'
87
+ step_mother = Cucumber::StepMother.new
88
+ logger = Logger.new(STDOUT)
89
+ logger.level = Logger::INFO
90
+ step_mother.log = logger
91
+ step_mother.load_plain_text_features(@features)
92
+ end
93
+
94
+ def run_tt
95
+ require 'cucumber'
96
+ # Using Cucumber's Treetop lexer, but never calling #build to build the AST
97
+ lexer = Cucumber::Parser::NaturalLanguage.new(nil, 'en').parser
98
+ @features.each do |file|
99
+ source = IO.read(file)
100
+ parse_tree = lexer.parse(source)
101
+ if parse_tree.nil?
102
+ raise Cucumber::Parser::SyntaxError.new(lexer, file, 0)
103
+ end
104
+ end
105
+ end
106
+
107
+ def run_rb_gherkin
108
+ require 'gherkin'
109
+ require 'null_formatter'
110
+ parser = Gherkin::Parser::Parser.new(NullFormatter.new, true, "root", true)
111
+ @features.each do |feature|
112
+ parser.parse(File.read(feature), feature, 0)
113
+ end
114
+ end
115
+
116
+ def run_native_gherkin
117
+ require 'gherkin'
118
+ require 'null_listener'
119
+ parser = Gherkin::Parser::Parser.new(NullFormatter.new, true, "root", false)
120
+ @features.each do |feature|
121
+ parser.parse(File.read(feature), feature, 0)
122
+ end
123
+ end
124
+
125
+ def run_native_gherkin_no_parser
126
+ require 'gherkin'
127
+ require 'gherkin/lexer/i18n_lexer'
128
+ require 'null_listener'
129
+ lexer = Gherkin::Lexer::I18nLexer.new(NullListener.new, false)
130
+ @features.each do |feature|
131
+ lexer.scan(File.read(feature), feature, 0)
132
+ end
133
+ end
134
+ end
135
+
136
+ desc "Generate 500 random features and benchmark Cucumber, Treetop and Gherkin with them"
137
+ task :bench => ["bench:clean", "bench:gen"] do
138
+ benchmarker = Benchmarker.new
139
+ benchmarker.report_all
140
+ end
141
+
142
+ namespace :bench do
143
+ desc "Generate [number] features with random content, or 500 features if number is not provided"
144
+ task :gen, :number do |t, args|
145
+ args.with_defaults(:number => 500)
146
+ generator = RandomFeatureGenerator.new(args.number.to_i)
147
+ generator.generate
148
+ end
149
+
150
+ desc "Benchmark Cucumber AST building from the features in tasks/bench/generated"
151
+ task :cucumber do
152
+ benchmarker = Benchmarker.new
153
+ benchmarker.report("cucumber")
154
+ end
155
+
156
+ desc "Benchmark the Treetop parser with the features in tasks/bench/generated"
157
+ task :tt do
158
+ benchmarker = Benchmarker.new
159
+ benchmarker.report("tt")
160
+ end
161
+
162
+ desc "Benchmark the Ruby Gherkin lexer+parser with the features in tasks/bench/generated"
163
+ task :rb_gherkin do
164
+ benchmarker = Benchmarker.new
165
+ benchmarker.report("rb_gherkin")
166
+ end
167
+
168
+ desc "Benchmark the ntive Gherkin lexer+parser with the features in tasks/bench/generated"
169
+ task :native_gherkin do
170
+ benchmarker = Benchmarker.new
171
+ benchmarker.report("native_gherkin")
172
+ end
173
+
174
+ desc "Benchmark the native Gherkin lexer (no parser) with the features in tasks/bench/generated"
175
+ task :native_gherkin_no_parser do
176
+ benchmarker = Benchmarker.new
177
+ benchmarker.report("native_gherkin_no_parser")
178
+ end
179
+
180
+ desc "Remove all generated features in tasks/bench/generated"
181
+ task :clean do
182
+ rm_f FileList[GENERATED_FEATURES + "/**/*feature"]
183
+ end
184
+ end
@@ -0,0 +1,49 @@
1
+ class StepsBuilder
2
+ def initialize
3
+ @steps = []
4
+ end
5
+
6
+ def step(content, generator)
7
+ @steps << " Given #{content}"
8
+ if(rand(5) == 0)
9
+ cols = rand(8) + 1
10
+ rows = rand(10)
11
+ rows.times do
12
+ row = " |"
13
+ cols.times do
14
+ row << generator.table_cell << "|"
15
+ end
16
+ @steps << row
17
+ end
18
+ end
19
+ end
20
+
21
+ def to_s
22
+ @steps.join("\n")
23
+ end
24
+ end
25
+
26
+ class FeatureBuilder
27
+ def initialize(name, &block)
28
+ @name = name
29
+ @scenarios = {}
30
+ block.call(self)
31
+ end
32
+
33
+ def scenario(name, &block)
34
+ @scenarios[name] = StepsBuilder.new
35
+ block.call(@scenarios[name])
36
+ end
37
+
38
+ def to_s
39
+ str = "Feature: #{@name}\n"
40
+ @scenarios.each do |scenario, steps|
41
+ str += "\n"
42
+ str += " Scenario: #{scenario}\n"
43
+ str += steps.to_s
44
+ str += "\n"
45
+ end
46
+ str
47
+ end
48
+ end
49
+
@@ -0,0 +1 @@
1
+ *.feature
@@ -0,0 +1,4 @@
1
+ class NullListener
2
+ def method_missing(*args)
3
+ end
4
+ end
@@ -0,0 +1,102 @@
1
+ require File.dirname(__FILE__) + '/ragel_task'
2
+ BYPASS_NATIVE_IMPL = true
3
+ require 'gherkin/i18n'
4
+
5
+ CLEAN.include [
6
+ 'pkg', 'tmp',
7
+ '**/*.{o,bundle,jar,so,obj,pdb,lib,def,exp,log,rbc}', 'ext',
8
+ 'java/target',
9
+ 'ragel/i18n/*.rl',
10
+ 'lib/gherkin/rb_lexer/*.rb',
11
+ 'lib/*.dll',
12
+ 'ext/**/*.c',
13
+ 'java/src/main/java/gherkin/lexer/i18n/*.java',
14
+ 'java/src/main/resources/gherkin/*.properties',
15
+ ]
16
+
17
+ desc "Compile the Java extensions"
18
+ task :jar => 'lib/gherkin.jar'
19
+
20
+ file 'lib/gherkin.jar' => Dir['java/src/main/java/**/*.java'] do
21
+ sh("mvn -f java/pom.xml package")
22
+ end
23
+
24
+ rl_langs = ENV['RL_LANGS'] ? ENV['RL_LANGS'].split(',') : []
25
+ langs = Gherkin::I18n.all.select { |lang| rl_langs.empty? || rl_langs.include?(lang.iso_code) }
26
+
27
+ # http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6457127
28
+ file 'lib/gherkin.jar' => "java/src/main/resources/gherkin/I18nKeywords_in.properties"
29
+ file "java/src/main/resources/gherkin/I18nKeywords_in.properties" => "java/src/main/resources/gherkin/I18nKeywords_id.properties" do
30
+ cp "java/src/main/resources/gherkin/I18nKeywords_id.properties", "java/src/main/resources/gherkin/I18nKeywords_in.properties"
31
+ end
32
+
33
+ # http://forums.sun.com/thread.jspa?threadID=5335461
34
+ file 'lib/gherkin.jar' => "java/src/main/resources/gherkin/I18nKeywords_iw.properties"
35
+ file "java/src/main/resources/gherkin/I18nKeywords_iw.properties" => "java/src/main/resources/gherkin/I18nKeywords_he.properties" do
36
+ cp "java/src/main/resources/gherkin/I18nKeywords_he.properties", "java/src/main/resources/gherkin/I18nKeywords_iw.properties"
37
+ end
38
+
39
+ langs.each do |i18n|
40
+ java = RagelTask.new('java', i18n)
41
+ rb = RagelTask.new('rb', i18n)
42
+
43
+ lang_country = i18n.iso_code.split(/-/)
44
+ suffix = lang_country.length == 1 ? lang_country[0] : "#{lang_country[0]}_#{lang_country[1].upcase}"
45
+ java_properties = "java/src/main/resources/gherkin/I18nKeywords_#{suffix}.properties"
46
+ file java_properties => 'lib/gherkin/i18n.yml' do
47
+ File.open(java_properties, 'wb') do |io|
48
+ io.puts("# Generated file. Do not edit.")
49
+ (Gherkin::I18n::KEYWORD_KEYS + %w{name native}).each do |key|
50
+ value = Gherkin::I18n.unicode_escape(i18n.keywords(key).join("|"))
51
+ io.puts("#{key}:#{value}")
52
+ end
53
+ end
54
+ end
55
+ file 'lib/gherkin.jar' => [java.target, rb.target, java_properties]
56
+
57
+ begin
58
+ if !defined?(JRUBY_VERSION)
59
+ require 'rake/extensiontask'
60
+
61
+ c = RagelTask.new('c', i18n)
62
+
63
+ extconf = "ext/gherkin_lexer_#{i18n.underscored_iso_code}/extconf.rb"
64
+ file extconf do
65
+ FileUtils.mkdir(File.dirname(extconf)) unless File.directory?(File.dirname(extconf))
66
+ File.open(extconf, "w") do |io|
67
+ io.write(<<-EOF)
68
+ require 'mkmf'
69
+ CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
70
+ $CFLAGS << ' -O0 -Wall -Werror' if CONFIG['CC'] =~ /gcc/
71
+ dir_config("gherkin_lexer_#{i18n.underscored_iso_code}")
72
+ have_library("c", "main")
73
+ create_makefile("gherkin_lexer_#{i18n.underscored_iso_code}")
74
+ EOF
75
+ end
76
+ end
77
+
78
+ Rake::ExtensionTask.new("gherkin_lexer_#{i18n.underscored_iso_code}") do |ext|
79
+ if ENV['RUBY_CC_VERSION']
80
+ ext.cross_compile = true
81
+ ext.cross_platform = 'x86-mingw32'
82
+ end
83
+ end
84
+
85
+ # The way tasks are defined with compile:xxx (but without namespace) in rake-compiler forces us
86
+ # to use these hacks for setting up dependencies. Ugly!
87
+ Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(extconf)
88
+ Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(c.target)
89
+ Rake::Task["compile:gherkin_lexer_#{i18n.underscored_iso_code}"].prerequisites.unshift(rb.target)
90
+
91
+ Rake::Task["compile"].prerequisites.unshift(extconf)
92
+ Rake::Task["compile"].prerequisites.unshift(c.target)
93
+ Rake::Task["compile"].prerequisites.unshift(rb.target)
94
+ end
95
+ rescue LoadError
96
+ unless defined?($c_warned)
97
+ warn "WARNING: Rake::ExtensionTask not installed. Skipping C compilation."
98
+ $c_warned = true
99
+ task :compile # no-op
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,18 @@
1
+ require 'cucumber/rake/task'
2
+
3
+ Cucumber::Rake::Task.new(:cucumber) do |t|
4
+ t.cucumber_opts = "--profile default"
5
+ end
6
+
7
+ namespace :cucumber do
8
+ Cucumber::Rake::Task.new(:rcov, "Run Cucumber using RCov") do |t|
9
+ t.cucumber_opts = "--profile default"
10
+ t.rcov = true
11
+ t.rcov_opts = %w{--exclude spec\/}
12
+ end
13
+
14
+ Cucumber::Rake::Task.new(:native_lexer, "Run Native lexer Cucumber features") do |t|
15
+ t.cucumber_opts = "--profile native_lexer"
16
+ end
17
+ task :native_lexer => [:clean, :compile]
18
+ end
@@ -0,0 +1,42 @@
1
+ namespace :gems do
2
+ task :win do
3
+ unless File.directory?(File.expand_path('~/.rake-compiler'))
4
+ STDERR.puts <<-EOM
5
+
6
+ You must install Windows rubies to ~/.rake-compiler with:
7
+
8
+ rake-compiler cross-ruby VERSION=1.8.6-p287
9
+ # (Later 1.9.1 patch levels don't compile on mingw)
10
+ rake-compiler cross-ruby VERSION=1.9.1-p243
11
+ EOM
12
+ exit(1)
13
+ end
14
+ # rvm and mingw ruby versions have to match to avoid errors
15
+ sh "rvm 1.8.6@cucumber rake cross compile RUBY_CC_VERSION=1.8.6"
16
+ sh "rvm 1.9.1@cucumber rake cross compile RUBY_CC_VERSION=1.9.1"
17
+ # This will copy the .so files to the proper place
18
+ sh "rake cross compile RUBY_CC_VERSION=1.8.6:1.9.1"
19
+ end
20
+
21
+ desc 'Prepare JRuby binares'
22
+ task :jruby => [:jar] do
23
+ sh "rvm jruby@cucumber -S rspec spec"
24
+ end
25
+
26
+ desc 'Prepare IronRuby binaries'
27
+ task :ironruby => [:jruby, 'ikvm:dll', 'ikvm:copy_ikvm_dlls']
28
+
29
+ task :sanity do
30
+ raise "The jruby gem looks too small" if File.stat("release/gherkin-#{Gherkin::VERSION}-java.gem").size < 1000000
31
+ end
32
+
33
+ desc "Prepare binaries for all gems"
34
+ task :prepare => [
35
+ :clean,
36
+ :spec,
37
+ :win,
38
+ :jruby,
39
+ :ironruby
40
+ ]
41
+
42
+ end