Sha256: 3658efdf64053c440efdb5081f1236e9811689900a92f22cd105517432082940

Contents?: true

Size: 1.39 KB

Versions: 22

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

namespace :webdrivers do
  require 'webdrivers/chromedriver'

  namespace :chromedriver do
    Webdrivers.logger.level = :info

    desc 'Print current chromedriver version'
    task :version do
      gem_ver = Webdrivers::Chromedriver.current_version
      if gem_ver
        Webdrivers.logger.info "chromedriver #{gem_ver.version}"
      else
        Webdrivers.logger.warn 'No existing chromedriver found.'
      end
    end

    desc 'Remove and download updated chromedriver if necessary'
    task :update, [:version] do |_, args|
      args.with_defaults(version: 0)
      Webdrivers::Chromedriver.required_version = args.version
      Webdrivers::Chromedriver.update
      Webdrivers.logger.info "Updated to chromedriver #{Webdrivers::Chromedriver.current_version}"
    end

    desc 'Force remove chromedriver'
    task :remove do
      unless File.exist? Webdrivers::Chromedriver.driver_path
        Webdrivers.logger.info 'No existing chromedriver to remove.'
        next # Return early
      end

      cur_version = Webdrivers::Chromedriver.current_version
      Webdrivers::Chromedriver.remove

      if File.exist? Webdrivers::Chromedriver.driver_path # Failed for some reason
        Webdrivers.logger.error 'Failed to remove chromedriver. Please try removing manually.'
      else
        Webdrivers.logger.info "Removed chromedriver #{cur_version}."
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
webdrivers-5.3.1 lib/webdrivers/tasks/chromedriver.rake
webdrivers-5.3.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-5.2.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-5.1.0 lib/webdrivers/tasks/chromedriver.rake
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/webdrivers-5.0.0/lib/webdrivers/tasks/chromedriver.rake
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/webdrivers-5.0.0/lib/webdrivers/tasks/chromedriver.rake
webdrivers-5.0.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.7.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.6.1 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.6.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.5.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.4.2 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.4.1 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.4.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.3.0 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.2.0 lib/webdrivers/tasks/chromedriver.rake
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webdrivers-4.1.3/lib/webdrivers/tasks/chromedriver.rake
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webdrivers-4.1.3/lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.1.3 lib/webdrivers/tasks/chromedriver.rake
webdrivers-4.1.2 lib/webdrivers/tasks/chromedriver.rake