isomorfeus-puppetmaster 0.6.8 → 0.6.9
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3df3255c6f71d1809d47fd8c2a8df5a6ba722d7f2cde9f843e23f951a95c1c62
|
4
|
+
data.tar.gz: 6ce553af5784b0e599644bdb297eb2e880b62cfbe4a354c446ff253f6bb9b148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41747894a43d16c6a3b3032f7a5d64bc53f3f7ec1798c74a19a69a5f32ab43ddd5f5ff788c30613667b5baa38f9a8d47fc2b69d0480bdd649c67ca500e705a84
|
7
|
+
data.tar.gz: dc6bdad6e34ae3db50fc82b13ce7896b1ea619780e0cffd97d816d102be16b7a710045e7ce7a597e93743360debe784ec2577089fb55978f33393790c730d2cc
|
@@ -2,7 +2,17 @@ class Puppeteer::ExecutionContext
|
|
2
2
|
def eval_ruby(ruby_source = '', &block)
|
3
3
|
ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given?
|
4
4
|
compiled_ruby = Isomorfeus::Puppetmaster.compile_ruby_source(ruby_source)
|
5
|
-
res = evaluate
|
5
|
+
res = evaluate <<~JAVASCRIPT
|
6
|
+
function(){
|
7
|
+
let fun = function() {
|
8
|
+
try { return #{compiled_ruby} }
|
9
|
+
catch (e) { return { error: e.name, message: e.message, stack: e.stack }; }
|
10
|
+
}
|
11
|
+
let res = fun();
|
12
|
+
if (res && res.$to_n) { res = res.$to_n() }
|
13
|
+
return (res == Opal.nil) ? null : res;
|
14
|
+
}
|
15
|
+
JAVASCRIPT
|
6
16
|
if res.is_a?(Hash) && res.key?('error') && res.key?('message') && res.key?('stack')
|
7
17
|
e = RuntimeError.new("#{res['error']}: #{res['message']}")
|
8
18
|
e.set_backtrace(res['stack'].lines)
|
@@ -16,11 +26,16 @@ class Puppeteer::ExecutionContext
|
|
16
26
|
compiled_ruby = Isomorfeus::Puppetmaster.compile_ruby_source(ruby_source)
|
17
27
|
res = evaluate <<~JAVASCRIPT
|
18
28
|
function(){
|
19
|
-
|
20
|
-
|
29
|
+
let fun = function(){
|
30
|
+
if (typeof Opal === "undefined") {
|
31
|
+
#{Isomorfeus::Puppetmaster.opal_prelude}
|
32
|
+
}
|
33
|
+
try { return #{compiled_ruby} }
|
34
|
+
catch (e) { return { error: e.name, message: e.message, stack: e.stack }; }
|
21
35
|
}
|
22
|
-
|
23
|
-
|
36
|
+
let res = fun();
|
37
|
+
if (res && res.$to_n) { res = res.$to_n() }
|
38
|
+
return (res == Opal.nil) ? null : res;
|
24
39
|
}
|
25
40
|
JAVASCRIPT
|
26
41
|
if res.is_a?(Hash) && res.key?('error') && res.key?('message') && res.key?('stack')
|
@@ -31,7 +46,6 @@ class Puppeteer::ExecutionContext
|
|
31
46
|
res
|
32
47
|
end
|
33
48
|
|
34
|
-
|
35
49
|
def await_ruby(ruby_source = '', &block)
|
36
50
|
ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given?
|
37
51
|
ruby_source = "#{ruby_source}.then { |result| $promise_result = result; $promise_resolved = true }.fail { |result| $promise_result = result; $promise_resolved = true }"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-puppetmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|