Module: Isomorfeus::Puppetmaster::DSL
- Defined in:
- lib/isomorfeus/puppetmaster/dsl.rb
Constant Summary collapse
- @@launch_options =
nil
Instance Method Summary collapse
- #default_page ⇒ Object
- #goto(uri) ⇒ Object (also: #visit)
- #isomorphic(ruby_source = '', &block) ⇒ Object
- #isomorphic_with_opal(ruby_source = '', &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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
- #on_server(ruby_source = '', &block) ⇒ Object
- #reset_session! ⇒ Object
- #session ⇒ Object
- #session=(s) ⇒ Object
- #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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
Instance Method Details
#default_page ⇒ Object
33 34 35 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 33 def default_page session.default_page end |
#goto(uri) ⇒ Object Also known as: visit
37 38 39 40 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 37 def goto(uri) session.goto(uri) session.default_page end |
#isomorphic(ruby_source = '', &block) ⇒ Object
43 44 45 46 47 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 43 def isomorphic(ruby_source = '', &block) ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given? on_server(ruby_source) default_page.eval_ruby(ruby_source) end |
#isomorphic_with_opal(ruby_source = '', &block) ⇒ Object
49 50 51 52 53 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 49 def isomorphic_with_opal(ruby_source = '', &block) ruby_source = Isomorfeus::Puppetmaster.block_source_code(&block) if block_given? on_server(ruby_source) default_page.eval_with_opal(ruby_source) end |
#new_page(uri = nil) ⇒ Object
92 93 94 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 92 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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
59 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 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 59 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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) unless .nil? app = app || [:app] channel = channel || [:channel] devtools = [:devtools].nil? ? devtools : [:devtools] = || [:viewport] dumpio = dumpio || [:dumpio] env = env || [:env] executable_path = executable_path || [:executable_path] handle_SIGINT = handle_SIGINT || [:handle_SIGINT] handle_SIGTERM = handle_SIGTERM || [:handle_SIGTERM] handle_SIGHUP = handle_SIGHUP || [:handle_SIGHUP] headless = [:headless].nil? ? headless : [:headless].nil? ignore_https_errors = [:ignore_https_errors].nil? ? ignore_https_errors : [:ignore_https_errors] pipe = [:pipe].nil? ? pipe : [:pipe] product = product || [:product] slow_mo = slow_mo || [:slow_mo] timeout = timeout || [:timeout] user_data_dir = user_data_dir || [:user_data_dir] end 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 = '', &block) ⇒ Object
55 56 57 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 55 def on_server(ruby_source = '', &block) Isomorfeus::Puppetmaster.served_app.on_server(ruby_source, &block) end |
#reset_session! ⇒ Object
101 102 103 104 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 101 def reset_session! @@puppetmaster_session = nil nil end |
#session ⇒ Object
112 113 114 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 112 def session @@puppetmaster_session ||= new_session(app: Isomorfeus::Puppetmaster.served_app) end |
#session=(s) ⇒ Object
96 97 98 99 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 96 def session=(s) @@puppetmaster_session = s nil end |
#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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/isomorfeus/puppetmaster/dsl.rb', line 6 def (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: true, ignore_default_args: nil, ignore_https_errors: nil, pipe: nil, product: :chrome, slow_mo: nil, timeout: nil, user_data_dir: nil) = { app: 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.to_s, slow_mo: slow_mo, timeout: timeout ? timeout : Isomorfeus::Puppetmaster::Session::TIMEOUT, user_data_dir: user_data_dir, } end |