-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
059f29e
commit c10c6ba
Showing
5 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'webdrivers' | ||
|
||
path = File.expand_path(__dir__) | ||
Dir.glob("#{path}/tasks/*.rake").each { |f| import f } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :webdrivers do | ||
require 'optparse' | ||
require 'webdrivers/chromedriver' | ||
|
||
namespace :chromedriver do | ||
Webdrivers.logger.level = :info | ||
|
||
desc 'Remove and download updated chromedriver if necessary' | ||
task :update do | ||
options = {cache_time: 86_400} # 24 hours | ||
opts = OptionParser.new | ||
opts.banner = 'Usage: webdrivers::chromedriver::update [options]' | ||
|
||
opt_desc = '(Optional) Number of Seconds to wait between update checks' | ||
opts.on('-c', '--cache-time SECONDS', Integer, opt_desc) do |time| | ||
options[:cache_time] = time | ||
end | ||
|
||
opts.on('-v', '--required-version VERSION', Float, '(Optional) chromedriver version to download') do |version| | ||
options[:required_version] = version | ||
end | ||
|
||
options[:help] = opts.help | ||
args = opts.order!(ARGV) {} | ||
opts.parse!(args) | ||
|
||
Webdrivers.cache_time = options[:cache_time] | ||
Webdrivers::Chromedriver.required_version = options[:required_version] | ||
Webdrivers::Chromedriver.update | ||
Webdrivers.logger.info "Updated to chromedriver #{Webdrivers::Chromedriver.current_version}." | ||
exit | ||
end | ||
|
||
desc 'Force remove chromedriver' | ||
task :remove do | ||
unless File.exist? Webdrivers::Chromedriver.driver_path | ||
Webdrivers.logger.info 'No existing chromedriver to remove.' | ||
exit | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :webdrivers do | ||
require 'optparse' | ||
require 'webdrivers/geckodriver' | ||
|
||
namespace :geckodriver do | ||
Webdrivers.logger.level = :info | ||
|
||
desc 'Remove and download updated geckodriver if necessary' | ||
task :update do | ||
options = {cache_time: 86_400} # 24 hours | ||
opts = OptionParser.new | ||
opts.banner = 'Usage: webdrivers::geckodriver::update [options]' | ||
|
||
opt_desc = '(Optional) Number of Seconds to wait between update checks' | ||
opts.on('-c', '--cache-time SECONDS', Integer, opt_desc) do |time| | ||
options[:cache_time] = time | ||
end | ||
|
||
opts.on('-v', '--required-version VERSION', Float, '(Optional) geckodriver version to download') do |version| | ||
options[:required_version] = version | ||
end | ||
|
||
options[:help] = opts.help | ||
args = opts.order!(ARGV) {} | ||
opts.parse!(args) | ||
|
||
Webdrivers.cache_time = options[:cache_time] | ||
Webdrivers::Geckodriver.required_version = options[:required_version] | ||
Webdrivers::Geckodriver.update | ||
Webdrivers.logger.info "Updated to geckodriver #{Webdrivers::Geckodriver.current_version}." | ||
exit | ||
end | ||
|
||
desc 'Force remove geckodriver' | ||
task :remove do | ||
unless File.exist? Webdrivers::Geckodriver.driver_path | ||
Webdrivers.logger.info 'No existing geckodriver to remove.' | ||
exit | ||
end | ||
|
||
cur_version = Webdrivers::Geckodriver.current_version | ||
Webdrivers::Geckodriver.remove | ||
|
||
if File.exist? Webdrivers::Geckodriver.driver_path # Failed for some reason | ||
Webdrivers.logger.error 'Failed to remove geckodriver. Please try removing manually.' | ||
else | ||
Webdrivers.logger.info "Removed geckodriver #{cur_version}." | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :webdrivers do | ||
require 'optparse' | ||
require 'webdrivers/iedriver' | ||
|
||
namespace :iedriver do | ||
Webdrivers.logger.level = :info | ||
|
||
desc 'Remove and download updated IEDriverServer if necessary' | ||
task :update do | ||
options = {cache_time: 86_400} # 24 hours | ||
opts = OptionParser.new | ||
opts.banner = 'Usage: webdrivers::iedriver::update [options]' | ||
|
||
opt_desc = '(Optional) Number of Seconds to wait between update checks' | ||
opts.on('-c', '--cache-time SECONDS', Integer, opt_desc) do |time| | ||
options[:cache_time] = time | ||
end | ||
|
||
opts.on('-v', '--required-version VERSION', Float, '(Optional) IEDriverServer version to download') do |version| | ||
options[:required_version] = version | ||
end | ||
|
||
options[:help] = opts.help | ||
args = opts.order!(ARGV) {} | ||
opts.parse!(args) | ||
|
||
Webdrivers.cache_time = options[:cache_time] | ||
Webdrivers::IEdriver.required_version = options[:required_version] | ||
Webdrivers::IEdriver.update | ||
Webdrivers.logger.info "Updated to IEDriverServer #{Webdrivers::IEdriver.current_version}." | ||
exit | ||
end | ||
|
||
desc 'Force remove IEDriverServer' | ||
task :remove do | ||
unless File.exist? Webdrivers::IEdriver.driver_path | ||
Webdrivers.logger.info 'No existing IEDriverServer to remove.' | ||
exit | ||
end | ||
|
||
cur_version = Webdrivers::IEdriver.current_version | ||
Webdrivers::IEdriver.remove | ||
|
||
if File.exist? Webdrivers::IEdriver.driver_path # Failed for some reason | ||
Webdrivers.logger.error 'Failed to remove IEDriverServer. Please try removing manually.' | ||
else | ||
Webdrivers.logger.info "Removed IEDriverServer #{cur_version}." | ||
end | ||
end | ||
end | ||
end |