chromedriver_update 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chromedriver_update/version.rb +1 -1
- data/lib/chromedriver_update.rb +18 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f80bc896506e0820d75a9ce024aea0a0069141ec9c5abc7f3dc91f79f227d9f
|
4
|
+
data.tar.gz: af1b2b07f17b299ea4e06be84ca09a5ecd5d6a19a56235d8fa5892c1a8e6ca9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4be72e197c5cea4742c6d3978f2519c4fcffc448349d90edc71b736fece56e0f0f2f2c1e13d5710d4b838ec8ffa6c7f9eb1183eb6fc87f636a66cfef0569669a
|
7
|
+
data.tar.gz: 5ab81ae391c125c1188368b3b4c67063c5c2e9e7088a493a00cc20c09180a7a09fa40c4a4d6d6249b2b60f9bc03f3915add5d51fe8b6704967f5529ebe1d8ab9
|
data/lib/chromedriver_update.rb
CHANGED
@@ -16,9 +16,10 @@ class ChromedriverUpdate
|
|
16
16
|
#
|
17
17
|
# Update the installed version of chromedriver automatically fitting to the currently installed version of chrome
|
18
18
|
#
|
19
|
-
def self.auto_update_chromedriver
|
20
|
-
if installed_chrome_version.split(".").first != installed_chromedriver_version.split(".").first
|
19
|
+
def self.auto_update_chromedriver(force: false)
|
20
|
+
if installed_chrome_version.split(".").first != installed_chromedriver_version.split(".").first || force
|
21
21
|
original_chromedriver_version = installed_chromedriver_version
|
22
|
+
original_chromedriver_path = chromedriver_path
|
22
23
|
chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
|
23
24
|
if chromedriver_zip.code == 404 # fallback to latest lower version
|
24
25
|
chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
|
@@ -32,6 +33,21 @@ class ChromedriverUpdate
|
|
32
33
|
FileUtils.rm_f(download_path)
|
33
34
|
entry.extract(download_path)
|
34
35
|
FileUtils.mv(download_path, chromedriver_path, force: true)
|
36
|
+
unless OS.windows?
|
37
|
+
begin
|
38
|
+
FileUtils.chmod("+x", original_chromedriver_path)
|
39
|
+
`chmod +x "#{original_chromedriver_path}"`
|
40
|
+
rescue
|
41
|
+
begin
|
42
|
+
`chmod +x "#{original_chromedriver_path}"`
|
43
|
+
rescue
|
44
|
+
begin
|
45
|
+
`sudo chmod +x "#{original_chromedriver_path}"`
|
46
|
+
rescue
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
35
51
|
end
|
36
52
|
end
|
37
53
|
end
|