Skip to content

Commit

Permalink
Renamed spec running script, & it is smart enough to determine by its…
Browse files Browse the repository at this point in the history
…elf if Method#to_source is supported.
  • Loading branch information
ngty committed Jun 8, 2012
1 parent 7c5d80f commit 3cca328
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
18 changes: 9 additions & 9 deletions Rakefile
Expand Up @@ -3,22 +3,22 @@ require 'rake'
require 'bundler'
Bundler::GemHelper.install_tasks

SPEC_SCRIPT = File.expand_path('../spec/run_spec.sh', __FILE__)
SPEC_SCRIPT = File.expand_path('../spec/run_build.sh', __FILE__)
task :default => :spec

RUBIES = {
:parsetree => [
[nil, 'ruby-1.8.6-p420@sourcify-parsetree'],
[nil, 'ruby-1.8.7-p334@sourcify-parsetree'],
[nil, 'ree-1.8.7-2011.03@sourcify-parsetree']
[nil, 'ree-1.8.7--2012.02@sourcify-parsetree']
],
:static => [
[nil, 'ruby-1.8.6-p420@sourcify'],
[nil, 'ruby-1.8.7-p334@sourcify'],
[nil, 'ree-1.8.7-2011.03@sourcify'],
[nil, 'ree-1.8.7--2012.02@sourcify'],
[nil, 'jruby-1.6.3@sourcify'],
['METHOD_TO_SOURCE=true', 'ruby-1.9.2-p320@sourcify'],
['METHOD_TO_SOURCE=true', 'ruby-1.9.3-p194@sourcify'],
[nil, 'ruby-1.9.2-p320@sourcify'],
[nil, 'ruby-1.9.3-p194@sourcify'],

# NOTE: This doesn't support Method#to_source (& friends) yet yet due to
# jruby's Method#parameters bug, see http://jira.codehaus.org/browse/JRUBY-5954
Expand All @@ -27,7 +27,7 @@ RUBIES = {
]
}

def run_spec_script_for(envs_and_rubies)
def run_build_for(envs_and_rubies)
envs_and_rubies.group_by{|arry| arry[0..-2] }.each do |envs, arry|
rubies = arry.map(&:last)
declared_envs = ['export MUTE_BACON=true']
Expand All @@ -50,17 +50,17 @@ end

desc "Run specs in all rubies (both ParseTree & static scanner modes)"
task :'spec:all' do
run_spec_script_for RUBIES.values.flatten(1)
run_build_for RUBIES.values.flatten(1)
end

desc "Run specs in rubies supporting ParseTree mode"
task :'spec:parsetree' do
run_spec_script_for RUBIES[:parsetree]
run_build_for RUBIES[:parsetree]
end

desc "Run specs in rubies supporting static scanner mode"
task :'spec:static' do
run_spec_script_for RUBIES[:static]
run_build_for RUBIES[:static]
end

# ///////////////////////////////////////////////////////////
Expand Down
25 changes: 25 additions & 0 deletions spec/run_build.sh
@@ -0,0 +1,25 @@
#!/bin/bash
if [ -z "$TRAVIS" ]; then
echo ''
echo `gem env | grep 'INSTALLATION DIRECTORY' | sed 's/.*\/\(.*\)/\1:/'`
rm -rf ~/.ruby_inline/*ParseTree*
fi

SUPPORTS_METHOD_TO_SOURCE=`ruby -e '
begin
[:source_location, :parameters].each{|meth| 1.method(:to_s).send(meth) }
raise RuntimeError if RUBY_PLATFORM =~ /java/i
puts :true
rescue NoMethodError, RuntimeError
puts :false
end
'`

if [ "$SUPPORTS_METHOD_TO_SOURCE" == "true" ]; then
bundle exec bacon spec/{proc,method}/*/*_spec.rb spec/{proc,method}/*_spec.rb
else
echo "NOTE: This ruby doesn't support Method#to_source (& friends) !!"
bundle exec bacon spec/proc/*/*_spec.rb spec/{proc,no_method}/*_spec.rb
fi

# __END__
12 changes: 0 additions & 12 deletions spec/run_spec.sh

This file was deleted.

0 comments on commit 3cca328

Please sign in to comment.