Skip to content

Commit

Permalink
Merge branch 'stable-2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Mar 13, 2009
2 parents 163de54 + 66cbcc2 commit b39f5c0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
25 changes: 18 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,31 @@ subdir 'test' do

desc "Run unit tests for the Ruby libraries"
task 'test:ruby' => [:native_support] do
sh "spec -c -f s ruby/*.rb ruby/*/*.rb"
if PlatformInfo::RSPEC.nil?
abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
else
ruby "#{PlatformInfo::RSPEC} -c -f s ruby/*.rb ruby/*/*.rb"
end
end

task 'test:rcov' => [:native_support] do
rspec = PlatformInfo.find_command('spec')
sh "rcov", "--exclude",
"lib\/spec,\/spec$,_spec\.rb$,support\/,platform_info,integration_tests",
rspec, "--", "-c", "-f", "s",
*Dir["ruby/*.rb", "ruby/*/*.rb", "integration_tests.rb"]
if PlatformInfo::RSPEC.nil?
abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
else
sh "rcov", "--exclude",
"lib\/spec,\/spec$,_spec\.rb$,support\/,platform_info,integration_tests",
PlatformInfo::RSPEC, "--", "-c", "-f", "s",
*Dir["ruby/*.rb", "ruby/*/*.rb", "integration_tests.rb"]
end
end

desc "Run integration tests"
task 'test:integration' => [:apache2, :native_support] do
sh "spec -c -f s integration_tests.rb"
if PlatformInfo::RSPEC.nil?
abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo::RUBY}'. Please install it."
else
ruby "#{PlatformInfo::RSPEC} -c -f s integration_tests.rb"
end
end

file 'oxt/oxt_test_main' => TEST::OXT_OBJECTS.keys.map{ |x| "oxt/#{x}" } +
Expand Down
12 changes: 9 additions & 3 deletions lib/phusion_passenger/platform_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ def self.locate_ruby_executable(name)
# On OS X we must look for Ruby binaries in /usr/bin.
# RubyGems puts executables (e.g. 'rake') in there, not in
# /System/Libraries/(...)/bin.
return "/usr/bin/#{name}"
filename = "/usr/bin/#{name}"
else
return File.dirname(RUBY) + "/#{name}"
filename = File.dirname(RUBY) + "/#{name}"
end
if File.file?(filename) && File.executable?(filename)
return filename
else
return nil
end
end

Expand Down Expand Up @@ -152,9 +157,10 @@ def self.read_file(filename)
public
# The absolute path to the current Ruby interpreter.
RUBY = Config::CONFIG['bindir'] + '/' + Config::CONFIG['RUBY_INSTALL_NAME'] + Config::CONFIG['EXEEXT']
# The correct 'gem' and 'rake' commands for this Ruby interpreter.
# The correct 'gem', 'rake' and 'spec' commands for this Ruby interpreter.
GEM = locate_ruby_executable('gem')
RAKE = locate_ruby_executable('rake')
RSPEC = locate_ruby_executable('spec')

# Check whether the specified command is in $PATH, and return its
# absolute filename. Returns nil if the command is not found.
Expand Down

0 comments on commit b39f5c0

Please sign in to comment.