Module: Isomorfeus::Puppetmaster::DSL
- Defined in:
- lib/isomorfeus/puppetmaster/dsl.rb
Class Method Summary collapse
Instance Method Summary collapse
- #default_page ⇒ Object
- #isomorphic(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
- #isomorphic_with_opal(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
- #new_page(uri = nil) ⇒ Object
- #new_session(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil, env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil, headless: nil, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: nil, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
- #on_server(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
- #reset_session! ⇒ Object
- #session(headless: nil, devtools: nil) ⇒ Object
- #session=(s) ⇒ Object
- #set_launch_options(**args) ⇒ Object
- #visit(uri, referer: nil, timeout: nil, wait_until: 'networkidle0', headless: nil, devtools: nil) ⇒ Object (also: #goto)
Class Method Details
.set_launch_options(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil, env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil, headless: nil, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 4 def self.(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil, env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil, headless: nil, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) Isomorfeus::Puppetmaster. = { app: app, args: args, channel: channel, devtools: devtools, default_viewport: , dumpio: dumpio, env: env, executable_path: executable_path, handle_SIGINT: handle_SIGINT, handle_SIGTERM: handle_SIGTERM, handle_SIGHUP: handle_SIGHUP, headless: headless, ignore_default_args: ignore_default_args, ignore_https_errors: ignore_https_errors, pipe: pipe, product: product, slow_mo: slow_mo, timeout: timeout ? timeout : Isomorfeus::Puppetmaster::Session::TIMEOUT, user_data_dir: user_data_dir, } end |
Instance Method Details
#default_page ⇒ Object
35 36 37 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 35 def default_page session.default_page end |
#isomorphic(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
44 45 46 47 48 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 44 def isomorphic(ruby_source = '', file = nil, line = nil, &block) ruby_source, file, line = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given? on_server(ruby_source, file, line) default_page.eval_ruby(ruby_source, file, line) end |
#isomorphic_with_opal(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
50 51 52 53 54 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 50 def isomorphic_with_opal(ruby_source = '', file = nil, line = nil, &block) ruby_source, file, line = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given? on_server(ruby_source, file, line) default_page.eval_with_opal(ruby_source, file, line) end |
#new_page(uri = nil) ⇒ Object
96 97 98 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 96 def new_page(uri = nil) session.new_page(uri) end |
#new_session(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil, env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil, headless: nil, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: nil, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 60 def new_session(app: nil, args: nil, channel: nil, default_viewport: nil, devtools: nil, dumpio: nil, env: nil, executable_path: nil, handle_SIGINT: nil, handle_SIGTERM: nil, handle_SIGHUP: nil, headless: nil, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: nil, slow_mo: nil, timeout: nil, user_data_dir: nil) if Isomorfeus::Puppetmaster. opts = Isomorfeus::Puppetmaster. app = app || opts[:app] channel = channel || opts[:channel] devtools = devtools || opts[:devtools] = || opts[:viewport] dumpio = dumpio || opts[:dumpio] env = env || opts[:env] executable_path = executable_path || opts[:executable_path] handle_SIGINT = handle_SIGINT || opts[:handle_SIGINT] handle_SIGTERM = handle_SIGTERM || opts[:handle_SIGTERM] handle_SIGHUP = handle_SIGHUP || opts[:handle_SIGHUP] headless = headless || opts[:headless] ignore_https_errors = ignore_https_errors || opts[:ignore_https_errors] pipe = pipe || opts[:pipe] product = product || opts[:product] slow_mo = slow_mo || opts[:slow_mo] timeout = timeout || opts[:timeout] user_data_dir = user_data_dir || opts[:user_data_dir] end headless = true if headless.nil? devtools = false if devtools.nil? Isomorfeus::Puppetmaster::Session.new(app: (app ? app : Isomorfeus::Puppetmaster.served_app), args: args, channel: channel&.to_s, devtools: devtools, default_viewport: , dumpio: dumpio, env: env, executable_path: executable_path, handle_SIGINT: handle_SIGINT, handle_SIGTERM: handle_SIGTERM, handle_SIGHUP: handle_SIGHUP, headless: headless, ignore_default_args: ignore_default_args, ignore_https_errors: ignore_https_errors, pipe: pipe, product: product, slow_mo: slow_mo, timeout: timeout ? timeout : Isomorfeus::Puppetmaster::Session::TIMEOUT, user_data_dir: user_data_dir) end |
#on_server(ruby_source = '', file = nil, line = nil, &block) ⇒ Object
56 57 58 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 56 def on_server(ruby_source = '', &block) Isomorfeus::Puppetmaster.served_app.on_server(ruby_source, &block) end |
#reset_session! ⇒ Object
105 106 107 108 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 105 def reset_session! @@puppetmaster_session = nil nil end |
#session(headless: nil, devtools: nil) ⇒ Object
116 117 118 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 116 def session(headless: nil, devtools: nil) @@puppetmaster_session ||= new_session(app: Isomorfeus::Puppetmaster.served_app, headless: headless, devtools: devtools) end |
#session=(s) ⇒ Object
100 101 102 103 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 100 def session=(s) @@puppetmaster_session = s nil end |
#set_launch_options(**args) ⇒ Object
31 32 33 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 31 def (**args) DSL.(**args) end |
#visit(uri, referer: nil, timeout: nil, wait_until: 'networkidle0', headless: nil, devtools: nil) ⇒ Object Also known as: goto
39 40 41 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 39 def visit(uri, referer: nil, timeout: nil, wait_until: 'networkidle0', headless: nil, devtools: nil) session(headless: headless, devtools: devtools).visit(uri, referer: referer, timeout: timeout, wait_until: wait_until, headless: headless, devtools: devtools) end |