GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of wycats/merb-core
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/auser/merb-core.git
Allow for running specs with different Ruby implementations

Adds tasks for running specs under JRuby. The tasks still need to be run 
from
MRI, since popen3 isn't portable. This means that running the specs with 
JRuby
is extra slow because we spin up a new JVM for each spec file, but it's 
better
than nothing.

Signed-off-by: Ezra Zygmuntowicz <ez@engineyard.com>
dudleyf (author)
Tue Feb 12 08:46:48 -0800 2008
ivey (committer)
Tue Feb 12 20:20:24 -0800 2008
commit  dc83419bf5f16e3f58e2fe9fc7bbcfd7b71bbc0f
tree    5324f1b6e7fe7cc9d5fb9d3015941d763e27e079
parent  cdbf6e8fe7eee4ae751d8e29b1400bafaa472452
...
128
129
130
131
 
132
133
134
135
136
 
137
138
139
...
157
158
159
160
161
162
163
 
 
 
 
 
164
165
166
167
168
 
 
 
 
169
170
171
172
 
 
 
 
173
174
 
 
 
 
 
 
 
175
176
177
...
128
129
130
 
131
132
133
134
135
 
136
137
138
139
...
157
158
159
 
 
 
 
160
161
162
163
164
165
 
 
 
 
166
167
168
169
170
 
 
 
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
0
@@ -128,12 +128,12 @@ task :aok => [:specs, :rcov]
0
 
0
 require 'open3'
0
 
0
-def run_specs(glob)
0
+def run_specs(glob, spec_cmd='spec')
0
   require "optparse"
0
   require "spec"
0
   examples, failures, errors, pending = 0, 0, 0, 0
0
   Dir[glob].each do |spec|
0
- response = Open3.popen3("spec #{File.expand_path(spec)} -f s -c") do |i,o,e|
0
+ response = Open3.popen3("#{spec_cmd} #{File.expand_path(spec)} -f s -c") do |i,o,e|
0
       while out = o.gets
0
         STDOUT.puts out
0
         STDOUT.flush
0
@@ -157,21 +157,30 @@ def run_specs(glob)
0
   print "\e[0m"
0
 end
0
 
0
-desc "Run all specs"
0
-task :specs do
0
- run_specs("spec/**/*_spec.rb")
0
-end
0
+def setup_specs(name, spec_cmd='spec')
0
+ desc "Run all specs (#{name})"
0
+ task "specs:#{name}" do
0
+ run_specs("spec/**/*_spec.rb", spec_cmd)
0
+ end
0
 
0
-desc "Run private specs"
0
-task "specs:private" do
0
- run_specs("spec/private/**/*_spec.rb")
0
-end
0
+ desc "Run private specs (#{name})"
0
+ task "specs:#{name}:private" do
0
+ run_specs("spec/private/**/*_spec.rb", spec_cmd)
0
+ end
0
 
0
-desc "Run public specs"
0
-task "specs:public" do
0
- run_specs("spec/public/**/*_spec.rb")
0
+ desc "Run public specs (#{name})"
0
+ task "specs:#{name}:public" do
0
+ run_specs("spec/public/**/*_spec.rb", spec_cmd)
0
+ end
0
 end
0
 
0
+setup_specs("mri", "spec")
0
+setup_specs("jruby", "jruby -S spec")
0
+
0
+task "specs" => ["specs:mri"]
0
+task "specs:private" => ["specs:mri:private"]
0
+task "specs:public" => ["specs:mri:public"]
0
+
0
 desc "Run coverage suite"
0
 task :rcov do
0
   require 'fileutils'

Comments

    No one has commented yet.