smparkes-envjs 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/envjsrb +15 -15
- data/lib/envjs/runtime.rb +5 -0
- metadata +1 -1
data/bin/envjsrb
CHANGED
@@ -3,18 +3,9 @@
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'pathname'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require 'envjs/runtime'
|
10
|
-
rescue Exception => e
|
11
|
-
# (temporarily) run out of local if gem not installed
|
12
|
-
$: << File.expand_path( File.join( File.dirname(__FILE__), "..", "lib" ) )
|
13
|
-
$: << File.expand_path( File.join( File.dirname(__FILE__), "..", "vendor", "johnson", "lib" ) )
|
14
|
-
require 'johnson/tracemonkey'
|
15
|
-
require 'johnson/cli'
|
16
|
-
require 'envjs/runtime'
|
17
|
-
end
|
6
|
+
require 'johnson/tracemonkey'
|
7
|
+
require 'johnson/cli'
|
8
|
+
require 'envjs/runtime'
|
18
9
|
|
19
10
|
RUNTIME = js = Johnson::Runtime.new
|
20
11
|
RUNTIME.extend Envjs::Runtime
|
@@ -24,15 +15,24 @@ RUNTIME.load Envjs::ENVJS
|
|
24
15
|
if ARGV.length > 0
|
25
16
|
|
26
17
|
begin
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
about_blank = true
|
19
|
+
ARGV.each do |file|
|
20
|
+
if file == "about:blank"
|
21
|
+
RUNTIME.wait
|
22
|
+
RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
|
23
|
+
about_blank = true
|
24
|
+
elsif file =~ /\.x?html?$/ || file =~ %r(^https?://)
|
25
|
+
# this might want to go alway; jazrb does it manually now, which I think was the use case
|
26
|
+
# that wanted this
|
27
|
+
if !about_blank
|
30
28
|
RUNTIME.wait
|
31
29
|
RUNTIME.evaluate("window.location = 'about:blank'", "(comand line)", 1)
|
32
30
|
end
|
33
31
|
RUNTIME.wait
|
34
32
|
RUNTIME.evaluate("window.location = 'file://#{Pathname.new(file).realpath}'", file, 1)
|
33
|
+
about_blank = false
|
35
34
|
else
|
35
|
+
RUNTIME.become_first_script_window
|
36
36
|
RUNTIME.load file
|
37
37
|
end
|
38
38
|
end
|
data/lib/envjs/runtime.rb
CHANGED
@@ -102,6 +102,11 @@ EOJS
|
|
102
102
|
|
103
103
|
scripts = {}
|
104
104
|
|
105
|
+
( class << self; self; end ).send :define_method, :become_first_script_window do
|
106
|
+
# p "heh", inner, master.first_script_window
|
107
|
+
inner = master.first_script_window
|
108
|
+
end
|
109
|
+
|
105
110
|
( class << self; self; end ).send :define_method, :evaluate do |*args|
|
106
111
|
( script, file, line, global, scope, fn ) = *args
|
107
112
|
# print "eval in " + script[0,50].inspect + (scope ? scope.toString() : "nil") + "\n"
|