chromedriver_update 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chromedriver_update/version.rb +1 -1
- data/lib/chromedriver_update.rb +26 -4
- 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: bf5f436a17335dc1b8cf38d067e07d1b855ccd7c059c53b2c2186dee5c2d1e0c
|
4
|
+
data.tar.gz: f8047afe2976791fd8c5d30660195ebb1d8a4ea1e2c69036f6ac6d86df42a657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5439717a74dfd5cac39ecc0479241ae9c7c8965c83398271ba7d5a2ee0d1865e5a982fe88e49694ffce669032f5cfc817bf49580e1a3469551d51e16ceeab9b
|
7
|
+
data.tar.gz: 4f1b9b5c7af90029805d083eab26134f03a1fef4412dc3ec180cb0bb3b1d56af9bfccc6216839fac28b846b0ebc7eacc22c7922622ccd4f5461565a49c3477f4
|
data/lib/chromedriver_update.rb
CHANGED
@@ -16,8 +16,8 @@ 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
22
|
chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
|
23
23
|
if chromedriver_zip.code == 404 # fallback to latest lower version
|
@@ -32,6 +32,16 @@ class ChromedriverUpdate
|
|
32
32
|
FileUtils.rm_f(download_path)
|
33
33
|
entry.extract(download_path)
|
34
34
|
FileUtils.mv(download_path, chromedriver_path, force: true)
|
35
|
+
begin
|
36
|
+
FileUtils.chmod("+x", chromedriver_path)
|
37
|
+
rescue
|
38
|
+
unless OS.windows?
|
39
|
+
begin
|
40
|
+
`sudo chmod +x "#{chromedriver_path}"`
|
41
|
+
rescue
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
@@ -81,7 +91,7 @@ class ChromedriverUpdate
|
|
81
91
|
if OS.windows?
|
82
92
|
"https://storage.googleapis.com/chrome-for-testing-public/#{version}/win64/chromedriver-win64.zip"
|
83
93
|
elsif OS.mac?
|
84
|
-
"https://storage.googleapis.com/chrome-for-testing-public/#{version}/
|
94
|
+
"https://storage.googleapis.com/chrome-for-testing-public/#{version}/#{mac_platform}/chromedriver-mac-arm64.zip"
|
85
95
|
else
|
86
96
|
"https://storage.googleapis.com/chrome-for-testing-public/#{version}/linux64/chromedriver-linux64.zip"
|
87
97
|
end
|
@@ -97,7 +107,7 @@ class ChromedriverUpdate
|
|
97
107
|
platform = if OS.windows?
|
98
108
|
"win64"
|
99
109
|
elsif OS.mac?
|
100
|
-
|
110
|
+
mac_platform
|
101
111
|
else
|
102
112
|
"linux64"
|
103
113
|
end
|
@@ -106,6 +116,18 @@ class ChromedriverUpdate
|
|
106
116
|
latest_match['downloads']['chromedriver'].filter { |el| el['platform'] == platform }.first['url']
|
107
117
|
end
|
108
118
|
|
119
|
+
#
|
120
|
+
# Detect macOS platform
|
121
|
+
#
|
122
|
+
# @return [String] platform for macos
|
123
|
+
def self.mac_platform
|
124
|
+
if RUBY_PLATFORM.include?("x86") || RUBY_PLATFORM.include?("x64")
|
125
|
+
'mac-x64'
|
126
|
+
else
|
127
|
+
'mac-arm64'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
109
131
|
#
|
110
132
|
# Get the path of the installed chromedriver
|
111
133
|
#
|