Class: Geordi::ChromedriverUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/geordi/chromedriver_updater.rb

Defined Under Namespace

Classes: ProcessingError

Constant Summary collapse

VERSIONS_PER_MILESTONES_URL =
"https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json"

Instance Method Summary collapse

Instance Method Details

#run(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/geordi/chromedriver_updater.rb', line 13

def run(options)
  chrome_version = determine_chrome_version
  current_chromedriver_version = determine_chromedriver_version

  latest_chromedriver_version = latest_version(chrome_version)
  if current_chromedriver_version == latest_chromedriver_version
    Interaction.note "No update required. Chromedriver is already on the latest version #{latest_chromedriver_version}." unless options[:quiet_if_matching]
  else
    update_chromedriver(latest_chromedriver_version)
  end

rescue ProcessingError => e
  interaction_method = (options[:exit_on_failure] == false) ? :warn : :fail
  Interaction.public_send(interaction_method, e.message)
end