Class: PersistentSelenium::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/persistent_selenium/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/persistent_selenium/cli.rb', line 8

def self.source_root
  File.expand_path('../../../skel', __FILE__)
end

Instance Method Details

#installObject



42
43
44
# File 'lib/persistent_selenium/cli.rb', line 42

def install
  directory '.', '.'
end

#startObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/persistent_selenium/cli.rb', line 17

def start
  require 'persistent_selenium/browser'
  require 'persistent_selenium/drb'

  PersistentSelenium.configure do |c|
    c.port = options[:port]
    c.browser = options[:browser] if options[:browser]
    c.timeout = options[:timeout]
    c.chrome_extensions = options[:chrome_extensions] if !options[:chrome_extensions].empty?
  end

  puts "Starting persistent_selenium on #{PersistentSelenium.port} with #{PersistentSelenium.browser}"

  @browser = Browser.new(PersistentSelenium.browser)
  @browser.browser

  DRb.start_service PersistentSelenium.url, @browser

  trap('TERM') { exit }
  trap('INT') { exit }

  DRb.thread.join
end