Permalink
Browse files

Add experimental jasmine support

  • Loading branch information...
1 parent f12ce20 commit 3974fc1f7c3cdb11f3293f56460391028b8c53b8 @cowboyd committed Jun 2, 2010
View
@@ -0,0 +1,22 @@
+
+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
+
+require 'v8/jasmine/context'
@@ -0,0 +1,13 @@
+
+module V8
+ module Jasmine
+ class Context < V8::Context
+ def initialize(*args)
+ super(*args) do
+ self.extend V8::Jasmine
+ yield(self) if block_given?
+ end
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit 3974fc1

Please sign in to comment.