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: 2a818662d531a1ac2b26ca8aa6e0ce6abb4d9b6c7f89b30f38388cf84a09103d
4
- data.tar.gz: 59116b39e62ab2563eea74417a746cb495dc8a5c4bce4be6ee0a75176f24c039
3
+ metadata.gz: 3df3255c6f71d1809d47fd8c2a8df5a6ba722d7f2cde9f843e23f951a95c1c62
4
+ data.tar.gz: 6ce553af5784b0e599644bdb297eb2e880b62cfbe4a354c446ff253f6bb9b148
5
5
  SHA512:
6
- metadata.gz: 6d9aed5578705db190c682f3fe0430386311e886d80f5924c659d168b736ded119b1b207692804e1f7b0153d7c8a9641568ed0c5328c6646c04172fe465509c8
7
- data.tar.gz: 911913061aefa31c849cb321135912e9d075c1bd081c9a5e64142bf2b31a367fcdddc1b3ec565f13960c484c6ac5fe17d3a9d990667c8ec92491bd179e040da0
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 "function(){ try { return #{compiled_ruby} } catch (e) { return { error: e.name, message: e.message, stack: e.stack }; }}"
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
- if (typeof Opal === "undefined") {
20
- #{Isomorfeus::Puppetmaster.opal_prelude}
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
- try { return #{compiled_ruby} }
23
- catch (e) { return { error: e.name, message: e.message, stack: e.stack }; }
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 }"
@@ -1,3 +1,3 @@
1
1
  module Isomorfeus
2
- PUPPETMASTER_VERSION = '0.6.8'
2
+ PUPPETMASTER_VERSION = '0.6.9'
3
3
  end
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.8
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-01 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport