isomorfeus-puppetmaster 0.6.0 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80d9cce921986638a386996065b1a98eac3ce78d8b94aadec05f205cf48df5a2
4
- data.tar.gz: e46bf120b12d46f9f966b104fc4b220a642c0c0ad6ac3bbbf519b2abcc48a669
3
+ metadata.gz: e54d9dd005c6c0e9afa0f9a18ea7a0a6a837da33b0eb5ec53faf81a7ce3056d2
4
+ data.tar.gz: 6f783f0d1e7fe33f94ea023441e3cef2b2a556b9424b5b39e09c29a319102b0e
5
5
  SHA512:
6
- metadata.gz: f3d3c7d5276df8e8efb6c72ba023829d13a6d210a81e6797994397f6134f908df11fab3a269bc47e50e666414fbddfb4b59c71540a2a9bb88e15b492392e321b
7
- data.tar.gz: 17bf71299943c74bc6c6763c25502b1b9f26868b56bce21dcc55a10c89c903832fd08ff5e40911f1f046446ed28a7aa051369927314665e163cd5a4b3bf51373
6
+ metadata.gz: 529c766594a02a539251eb416b360c05d0dd0b490a64974b44bf0c06d2983c01dc2bdf32a0e6fc69f4815b2a44fae3ebdd7d27da1f86ff191685d2c609319572
7
+ data.tar.gz: 6e5ccce74a50c1435f99ecc1f3e80e0c28b3e4df98f17261d274211fddc61b4e01d34cbcddb8a403905a612d38ee3cc0f4286b74fb9534deab9bb59ef00e9801
@@ -3,11 +3,12 @@ module Isomorfeus
3
3
  module DSL
4
4
  @@launch_options = nil
5
5
 
6
- def set_launch_options(args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil,
6
+ def set_launch_options(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil,
7
7
  env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil,
8
8
  headless: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil,
9
9
  product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil)
10
10
  @@launch_options = {
11
+ app: app,
11
12
  args: args,
12
13
  channel: channel&.to_s,
13
14
  devtools: devtools,
@@ -55,7 +56,7 @@ module Isomorfeus
55
56
  Isomorfeus::Puppetmaster.served_app.on_server(ruby_source, &block)
56
57
  end
57
58
 
58
- def new_session(app:, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil,
59
+ def new_session(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil,
59
60
  env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil,
60
61
  headless: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil,
61
62
  product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil)
@@ -24,6 +24,10 @@ module Isomorfeus
24
24
  ObjectSpace.define_finalizer(self, self.class.close_browser(self))
25
25
  end
26
26
 
27
+ def close
28
+ @browser.close
29
+ end
30
+
27
31
  def devices
28
32
  ::Puppeteer::DEVICES
29
33
  end
@@ -39,7 +43,7 @@ module Isomorfeus
39
43
  def goto(uri, referer: nil, timeout: nil, wait_until: 'networkidle0')
40
44
  parsed_uri = parse_uri(uri)
41
45
  @response = @default_page.goto(parsed_uri.to_s, referer: referer, timeout: timeout, wait_until: wait_until)
42
- self
46
+ @default_page
43
47
  end
44
48
  alias_method :visit, :goto
45
49
 
@@ -89,7 +93,7 @@ module Isomorfeus
89
93
 
90
94
  def eval_ruby(ruby_source = '', &block)
91
95
  ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given?
92
- compiled_ruby = compile_ruby_source(ruby_source)
96
+ compiled_ruby = Isomorfeus::Puppetmaster.compile_ruby_source(ruby_source)
93
97
  res = self.evaluate "function(){ try { return #{compiled_ruby} } catch (e) { return { error: e.name, message: e.message, stack: e.stack }; }}"
94
98
  if res.is_a?(Hash) && res.key?('error') && res.key?('message') && res.key?('stack')
95
99
  e = RuntimeError.new("#{res['error']}: #{res['message']}")
@@ -101,7 +105,7 @@ module Isomorfeus
101
105
 
102
106
  def eval_with_opal(ruby_source = '', &block)
103
107
  ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given?
104
- compiled_ruby = compile_ruby_source(ruby_source)
108
+ compiled_ruby = Isomorfeus::Puppetmaster.compile_ruby_source(ruby_source)
105
109
  res = self.evaluate <<~JAVASCRIPT
106
110
  function(){
107
111
  if (typeof Opal === "undefined") {
@@ -1,3 +1,3 @@
1
1
  module Isomorfeus
2
- PUPPETMASTER_VERSION = '0.6.0'
2
+ PUPPETMASTER_VERSION = '0.6.4'
3
3
  end
@@ -9,8 +9,11 @@ module Isomorfeus
9
9
  end
10
10
 
11
11
  def block_source_code(&block)
12
- source_block = Parser::CurrentRuby.parse(block.source).children.last
13
- source_block = source_block.children.last if source_block.type == :block
12
+ source_block = Parser::CurrentRuby.parse(block.source.strip)
13
+ unless source_block.type == :block
14
+ source_block = source_block.children[source_block.children.index { |c| c.respond_to?(:type) && c.type == :block }]
15
+ end
16
+ source_block = source_block.children[2]
14
17
  Unparser.unparse(source_block)
15
18
  end
16
19
 
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.0
4
+ version: 0.6.4
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-01-15 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.40.0
89
+ version: 0.40.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.40.0
96
+ version: 0.40.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: tty-which
99
99
  requirement: !ruby/object:Gem::Requirement