add 1.9.3-rc1 test support and fix #70

This commit is contained in:
John Bintz 2011-10-10 09:32:27 -04:00
parent c1dc86a329
commit b04bb49879
3 changed files with 25 additions and 8 deletions

View File

@ -14,12 +14,23 @@ require 'jasmine/headless/task'
Jasmine::Headless::Task.new Jasmine::Headless::Task.new
PLATFORMS = %w{1.8.7 1.9.2 ree 1.9.3-rc1}
def rvm_bundle(command = '')
Bundler.with_clean_env do
system %{bash -c 'unset BUNDLE_BIN_PATH && unset BUNDLE_GEMFILE && rvm #{PLATFORMS.join(',')} ruby bundle #{command}'}.tap { |o| p o }
end
end
class SpecFailure < StandardError; end
class BundleFailure < StandardError; end
namespace :spec do namespace :spec do
desc "Run on three Rubies" desc "Run on three Rubies"
task :platforms do task :platforms do
system %{rvm 1.8.7,1.9.2,ree ruby bundle} rvm_bundle
system %{rvm 1.8.7,1.9.2,ree ruby bundle exec rake spec} rvm_bundle "exec rspec spec"
raise StandardError.new if $?.exitstatus != 0 raise SpecError.new if $?.exitstatus != 0
end end
end end
@ -31,3 +42,4 @@ task :build_runner do
system %{ruby extconf.rb} system %{ruby extconf.rb}
end end
end end

View File

@ -1,5 +1,4 @@
require 'jasmine-core' require 'jasmine-core'
require 'iconv'
require 'time' require 'time'
require 'multi_json' require 'multi_json'
@ -64,7 +63,6 @@ module Jasmine
alert_time = nil alert_time = nil
end end
function_locations = {}
source = nil source = nil
result = case File.extname(file) result = case File.extname(file)

View File

@ -1,4 +1,3 @@
require 'iconv'
require 'multi_json' require 'multi_json'
module Jasmine::Headless module Jasmine::Headless
@ -12,8 +11,16 @@ module Jasmine::Headless
def action def action
line_numbers = {} line_numbers = {}
ic = Iconv.new('UTF-8//IGNORE', 'US-ASCII') data = File.read(file)
data = ic.iconv(File.read(file) + ' ')[0..-2]
if data.respond_to?(:encode)
data.encode!('US-ASCII', 'UTF-8', :invalid => :replace)
else
require 'iconv'
ic = Iconv.new('UTF-8//IGNORE', 'US-ASCII')
data = ic.iconv(File.read(file) + ' ')[0..-2]
end
data.force_encoding('US-ASCII') if data.respond_to?(:force_encoding) data.force_encoding('US-ASCII') if data.respond_to?(:force_encoding)
data.lines.each_with_index.each { |line, index| data.lines.each_with_index.each { |line, index|