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
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
desc "Run on three Rubies"
task :platforms do
system %{rvm 1.8.7,1.9.2,ree ruby bundle}
system %{rvm 1.8.7,1.9.2,ree ruby bundle exec rake spec}
raise StandardError.new if $?.exitstatus != 0
rvm_bundle
rvm_bundle "exec rspec spec"
raise SpecError.new if $?.exitstatus != 0
end
end
@ -31,3 +42,4 @@ task :build_runner do
system %{ruby extconf.rb}
end
end

View File

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

View File

@ -1,4 +1,3 @@
require 'iconv'
require 'multi_json'
module Jasmine::Headless
@ -12,8 +11,16 @@ module Jasmine::Headless
def action
line_numbers = {}
ic = Iconv.new('UTF-8//IGNORE', 'US-ASCII')
data = ic.iconv(File.read(file) + ' ')[0..-2]
data = File.read(file)
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.lines.each_with_index.each { |line, index|