class IEDriverServer::Helper
Constants
- BUCKET_URL
- VERSION
Public Instance Methods
binary_path()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 45 def binary_path File.join install_dir, "IEDriverServer.exe" end
download(hit_network=false)
click to toggle source
# File lib/ie_driver_server/helper.rb, line 21 def download hit_network=false return if File.exists?(binary_path) && ! hit_network url = download_url filename = File.basename url FileUtils.mkdir_p install_dir Dir.chdir install_dir do FileUtils.rm_f filename File.open(filename, "wb") do |saved_file| URI.parse(url).open("rb") do |read_file| saved_file.write(read_file.read) end end raise "Could not download #{url}" unless File.exists? filename extract filename FileUtils.rm_f filename end raise "Could not unzip #{filename} to get #{binary_path}" unless File.exists? binary_path FileUtils.chmod "ugo+rx", binary_path end
remove()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 41 def remove FileUtils.rm binary_path end
run(*args)
click to toggle source
# File lib/ie_driver_server/helper.rb, line 12 def run *args download exec binary_path, *args end
update()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 17 def update download true end
Private Instance Methods
download_url()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 64 def download_url GoogleCodeParser.new(driver_name, url: BUCKET_URL).newest_download end
driver_name()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 60 def driver_name 'IEDriverServer_' + platform end
extract(filename)
click to toggle source
# File lib/ie_driver_server/helper.rb, line 51 def extract filename Zip::File.open(filename) do |zip_file| zip_file.each do |entry| FileUtils.rm_f entry.name entry.extract(entry.name) end end end
home_dir()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 76 def home_dir ENV['HOME'] || ENV['HOMEPATH'] end
install_dir()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 68 def install_dir File.expand_path File.join(home_dir, ".IEDriverServer-helper", platform) end
platform()
click to toggle source
# File lib/ie_driver_server/helper.rb, line 72 def platform !!(RbConfig::CONFIG['arch'] =~ /_64/) ? 'x64' : 'Win32' end