chromedriver_update 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b473596d8beca3a12d6471f3b074e12f58e917af0bb2b7dbb21883e9643f0b42
4
- data.tar.gz: d9c946970c4b50c7bb0be23c4f5d9924b6cab980a9f7c8b5bf4e5ddbdabc1a9d
3
+ metadata.gz: 416da0c5fd34295e5c7c248743c7b2ba30c7c1412a2223f3fd2784447283893b
4
+ data.tar.gz: 3834bf54921a8aa790bfdb7d81845e4541f7a233e7cf3ce3e7f77c61b356c50a
5
5
  SHA512:
6
- metadata.gz: 37170f1126fe182b3242fecb4116d701543e71f39c30c8668c4afa2a133a8ad7f12593fe4cddd0dbfe0126f8cba8531010e83cdbaf9ef213a2aab8a71011ac11
7
- data.tar.gz: 56cabf7283bb98323f1bcaa0b257ea62070b2b0fa618788c03cc1c6062b642f282ce389f98887c14ee1f8a2a8f847e01974e4bbda58b8021af86b04ecbd6fc62
6
+ metadata.gz: 14e38fc43435f98e38f495e234ff0a2217967994c6175f36c72a3fe106036d6536e23acd18536dda16a618bb2be9db26b819c4438669800d3a01852cc729bcf0
7
+ data.tar.gz: 1faf56f89eb4cc745f0bf4b50586abe1064519a4f4710d4603ef0cb00f3cc3f94243cb1a7ff54d13a7a151cc4b25e0723889fd59e7cc4b5f308ecfdff040a41d
data/.gitignore CHANGED
File without changes
data/.rspec CHANGED
File without changes
data/.travis.yml CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
data/bin/console CHANGED
File without changes
data/bin/setup CHANGED
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  class ChromedriverUpdate
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
@@ -22,29 +22,36 @@ class ChromedriverUpdate
22
22
  if installed_chrome_version.split(".").first != installed_chromedriver_version.split(".").first || force
23
23
  original_chromedriver_version = installed_chromedriver_version
24
24
  original_chromedriver_path = chromedriver_path
25
+ puts "Downloading chromedriver ..."
25
26
  chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
26
27
  if chromedriver_zip.code == 404 # fallback to latest lower version
27
- chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
28
28
  puts "Could not find same chromedriver version for chrome version '#{installed_chrome_version}'. Fallback to closest version '#{installed_chrome_version}'"
29
+ puts "-> #{chromedriver_closest_link_for_version(installed_chrome_version)}"
30
+ chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
29
31
  else
30
32
  puts "Found same chromedriver version '#{installed_chrome_version}' for chrome version '#{installed_chrome_version}'"
33
+ puts "-> #{chromedriver_link_for_version(installed_chrome_version)}"
31
34
  end
32
- destination_dir = File.expand_path(File.dirname(__FILE__) + "/../tmp")
33
- FileUtils.mkdir_p destination_dir
34
- Zip::File.open_buffer(chromedriver_zip.body) do |zip_files|
35
- zip_files.each do |entry|
36
- if (entry.name.end_with?("/chromedriver") || entry.name.end_with?("/chromedriver.exe"))
37
- download_path = File.join(destination_dir, File.basename(entry.name))
38
- FileUtils.rm_f(download_path)
39
- entry.extract(download_path)
40
- FileUtils.mv(download_path, chromedriver_path, force: true)
41
- unless OS.windows?
42
- begin
43
- FileUtils.chmod("+x", original_chromedriver_path)
44
- rescue
35
+ Dir.mktmpdir do |destination_dir|
36
+ Zip::File.open_buffer(chromedriver_zip.body) do |zip_files|
37
+ zip_files.each do |entry|
38
+ if (entry.name.end_with?("/chromedriver") || entry.name.end_with?("/chromedriver.exe"))
39
+ download_path = File.join(destination_dir, File.basename(entry.name))
40
+ entry.extract(download_path)
41
+ FileUtils.chmod("+x", download_path)
42
+ unless File.writable?(original_chromedriver_path)
43
+ puts "Permission denied to overwrite current chromedriver. Please run the script as admin or change the file permissions of the current chromedriver."
44
+ exit 1
45
+ end
46
+ FileUtils.mv(download_path, chromedriver_path, force: true)
47
+ unless OS.windows?
45
48
  begin
46
- `sudo chmod +x "#{original_chromedriver_path}"`
49
+ FileUtils.chmod("+x", original_chromedriver_path)
47
50
  rescue
51
+ begin
52
+ `sudo chmod +x "#{original_chromedriver_path}"`
53
+ rescue
54
+ end
48
55
  end
49
56
  end
50
57
  end
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chromedriver_update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthäus Beyrle
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.5.22
142
+ rubygems_version: 3.4.10
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Update an existing installation of chromedriver fitting to the current installed