1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/contrib/v8/jasmine.rb
2010-06-03 14:05:37 +03:00

22 lines
686 B
Ruby

require 'v8'
require 'v8/jasmine/context'
module V8
module Jasmine
FILENAME = File.join(File.dirname(__FILE__), "jasmine",Dir.new(File.join(File.dirname(__FILE__), "jasmine")).find {|f| f =~ /(\d+.\d+\.\d+)\.js$/})
VERSION = $1
SOURCE = File.read(FILENAME)
class << self
def included(mod)
raise ScriptError, "#{self} cannot be included. Use cxt.extend(V8::Jasmine)"
end
def extended(cxt)
raise ScriptError, "#{self} can only extend a V8::Context" unless cxt.kind_of?(V8::Context)
cxt.load(File.join(File.dirname(__FILE__), "jasmine", "window.js"))
cxt.load(FILENAME)
end
end
end
end