isomorfeus-puppetmaster 0.3.0 → 0.3.1

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: 422c2bb4f0581a37a50491b60bfb2b0a44b96acd903c8aaf5460d233d70eb8bf
4
- data.tar.gz: cc52402be32baecea8e5d70071cdc9d94684ab682eec4e36f124b9185130869b
3
+ metadata.gz: 7123d1c27ed7357e7ac6fff577bb2dcd025bd7d622c2ba849d1232ab9d3086d2
4
+ data.tar.gz: 4020f116455824c9ff42c4dca646ef69fb252ee7113986cb3926109cb874d381
5
5
  SHA512:
6
- metadata.gz: 89f9b3910c274388f23623aded55d5ac5e94d620ff77586bd6f597b6cb723540b9c91d586a4f7e95e869b801832a2dee13f9db88706a32578a2e7ce3e5b52bb1
7
- data.tar.gz: 0e79a45d2fd530702f95180cb5710b9e304244b76bfe8fe0f59ca2e62c71a349d4c8fb0704e9fc3a93f59df5731187f1086660077c7e385ff5986b2796f3d58a
6
+ metadata.gz: c30ba060532b000fe950b6bbbd0dcde8a22f0957771368b0b4f8862839f4690102ea71b7ce8e74e1f6d1c5aaded08331cb4a387f14adde8dd3b0cd902b3484e7
7
+ data.tar.gz: 9418b91dd65c552b9f26fa1c92fe2eeb2e75eb5f807125a6413e1812fd58545d3c6c554474f565b43700acb54f6478add020444b9ee202978758e782ce24ab74
@@ -80,7 +80,13 @@ module Isomorfeus
80
80
  evaluate_script <<~JAVASCRIPT
81
81
  (function(){
82
82
  Opal.gvars.promise_resolved = false;
83
- return #{compiled_ruby}
83
+ Opal.await_ruby_exception = null;
84
+ try {
85
+ return #{compiled_ruby}
86
+ } catch (e) {
87
+ Opal.await_ruby_exception = e;
88
+ Opal.gvars.promise_resolved = true;
89
+ }
84
90
  })()
85
91
  JAVASCRIPT
86
92
  have_result = false
@@ -90,14 +96,26 @@ module Isomorfeus
90
96
  have_result = evaluate_script 'Opal.gvars.promise_resolved'
91
97
  sleep 0.1 unless have_result
92
98
  end
93
- execute_script <<~JAVASCRIPT
99
+ result, exception = execute_script <<~JAVASCRIPT
94
100
  var result;
95
- if (typeof Opal.gvars.promise_result.$to_n === 'function') { result = Opal.gvars.promise_result.$to_n(); }
101
+ var exception = false;
102
+ if (Opal.await_ruby_exception) {
103
+ var e = Opal.await_ruby_exception;
104
+ exception = { message: e.message, name: e.name, stack: e.stack }
105
+ } else if (typeof Opal.gvars.promise_result.$to_n === 'function') {
106
+ result = Opal.gvars.promise_result.$to_n();
107
+ }
96
108
  else { result = Opal.gvars.promise_result };
97
109
  delete Opal.gvars.promise_result;
98
110
  delete Opal.gvars.promise_resolved;
99
- return result;
111
+ return [result, exception];
100
112
  JAVASCRIPT
113
+ if exception
114
+ e = Isomorfeus::Puppetmaster::Error.new("#{exception['name']}: #{exception['message']}")
115
+ e.set_backtrace(exception['stack'])
116
+ raise e
117
+ end
118
+ result
101
119
  end
102
120
 
103
121
  def evaluate_ruby(ruby_source = '', &block)
@@ -238,4 +256,4 @@ module Isomorfeus
238
256
  end
239
257
  end
240
258
  end
241
- end
259
+ end
@@ -20,7 +20,7 @@ module Isomorfeus
20
20
  end
21
21
 
22
22
  def open_new_document(uri = nil)
23
- puppetmaster_session.document_open_new_document(uri)
23
+ puppetmaster_session.document_open_new_document(nil, uri)
24
24
  end
25
25
 
26
26
  def reset_session!
@@ -41,4 +41,4 @@ module Isomorfeus
41
41
 
42
42
  end
43
43
  end
44
- end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module Isomorfeus
2
- PUPPETMASTER_VERSION = '0.3.0'
2
+ PUPPETMASTER_VERSION = '0.3.1'
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -359,7 +359,8 @@ files:
359
359
  homepage: http://isomorfeus.com
360
360
  licenses:
361
361
  - MIT
362
- metadata: {}
362
+ metadata:
363
+ github_repo: ssh://github.com/isomorfeus/gems
363
364
  post_install_message:
364
365
  rdoc_options: []
365
366
  require_paths: