chromedriver_update 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4b59db9e7b39a75b4926a21e023dd615747bc3583ed1fdec4c42e123953801e
4
- data.tar.gz: 5aea95d538c13ca01c3c21ad9405c6665e83a51756593c3f04440744796f192d
3
+ metadata.gz: b473596d8beca3a12d6471f3b074e12f58e917af0bb2b7dbb21883e9643f0b42
4
+ data.tar.gz: d9c946970c4b50c7bb0be23c4f5d9924b6cab980a9f7c8b5bf4e5ddbdabc1a9d
5
5
  SHA512:
6
- metadata.gz: fb6007bf3257d32d59c12094a68f21bc4636ab9bdf88bf750e2f7cc963d2dda408f96d91960a2f0c068cbf2626b53ad4e579b952aad953c9f22b124c01cbd999
7
- data.tar.gz: a7e66a2b962aeebe9598c7d878d3e529c0b48b6ed6dabd355883a2ad6deeb1ecf48ca4c557ea0879a4ffb227ccf60c96e313768a628fd3267da1d013b4090285
6
+ metadata.gz: 37170f1126fe182b3242fecb4116d701543e71f39c30c8668c4afa2a133a8ad7f12593fe4cddd0dbfe0126f8cba8531010e83cdbaf9ef213a2aab8a71011ac11
7
+ data.tar.gz: 56cabf7283bb98323f1bcaa0b257ea62070b2b0fa618788c03cc1c6062b642f282ce389f98887c14ee1f8a2a8f847e01974e4bbda58b8021af86b04ecbd6fc62
data/.gitignore CHANGED
@@ -1,16 +1,16 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /.vscode/
11
- /.idea/
12
- *.gem
13
- playground.rb
14
-
15
- # rspec failure tracking
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.vscode/
11
+ /.idea/
12
+ *.gem
13
+ playground.rb
14
+
15
+ # rspec failure tracking
16
16
  .rspec_status
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
- --color
1
+ --format documentation
2
+ --color
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.3
5
- before_install: gem install bundler -v 1.14.6
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.14.6
data/CODE_OF_CONDUCT.md CHANGED
@@ -1,74 +1,74 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at chromedriver_update.gemspec@mail.magynhard.de. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at chromedriver_update.gemspec@mail.magynhard.de. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in chromedriver_update.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in chromedriver_update.gemspec
4
+ gemspec
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2017-2021 Matthäus J. N. Beyrle
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2017-2021 Matthäus J. N. Beyrle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,80 +1,90 @@
1
- # chromedriver_update
2
- [![Gem](https://img.shields.io/gem/v/chromedriver_update?color=default&style=plastic&logo=ruby&logoColor=red)](https://rubygems.org/gems/chromedriver_update)
3
- ![downloads](https://img.shields.io/gem/dt/chromedriver_update?color=blue&style=plastic)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-gold.svg?style=plastic&logo=mit)](LICENSE)
5
-
6
- > Update an existing installation of chromedriver fitting to the current installed version of chrome. Available for Ruby and as CLI command as well.
7
-
8
- Very basic tool, to ensure, that the current chromedriver is up to date to the current installed Chrome. Automatically fetches the same driver version or the latest version below, to ensure it will work with the current installed chrome version.
9
-
10
- The installed chromedriver is replaced with the new version. So it must have been setup already and added to the PATH environment variable to use this script from then.
11
-
12
- Implemented for Linux, Windows and Mac.
13
-
14
- ### Contents
15
- * [Installation](#installation)
16
- * [Usage](#usage)
17
- * [Command line](#command-line-usage)
18
- * [Documentation](#documentation)
19
- * [Contributing](#contributing)
20
-
21
-
22
- <a name="installation"></a>
23
- ## Installation
24
- ### Ruby
25
- Add this line to your application's Gemfile:
26
-
27
- ```ruby
28
- gem 'chromedriver_update'
29
- ```
30
-
31
- And then execute:
32
-
33
- bundle install
34
-
35
- ### Command line
36
- If you just want to use the command line then run
37
-
38
- gem install chromedriver_update
39
-
40
- Of course you need to have installed Ruby on your system and set the PATH variable, to have access to Ruby commands like `ruby` or `gem`.
41
-
42
-
43
-
44
- <a name="usage"></a>
45
- ## Usage
46
-
47
- ### Example
48
-
49
- ```ruby
50
- require 'chromedriver_update'
51
-
52
- ChromedriverUpdate.auto_update_chromedriver
53
- ```
54
-
55
-
56
- <a name="command-line-usage"></a>
57
- ## Command line
58
-
59
- `chromedriver_update` is also available on the command line after installation.
60
-
61
- ### Example
62
-
63
- Run on the command line
64
-
65
- ```ruby
66
- chromedriver_update
67
- # => Updated Chromedriver from '123.0.0' to '124.0.0'! Chrome is '124.0.1'.
68
- ```
69
-
70
- <a name="documentation"></a>
71
- ## Documentation
72
-
73
- For more details have a look at the rubydoc at [https://www.rubydoc.info/gems/chromedriver_update](https://www.rubydoc.info/gems/chromedriver_update)
74
-
75
-
76
-
77
- <a name="documentation"></a>
78
- ## Contributing
79
- Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/chromedriver_update. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
80
-
1
+ # chromedriver_update
2
+ [![Gem](https://img.shields.io/gem/v/chromedriver_update?color=default&style=plastic&logo=ruby&logoColor=red)](https://rubygems.org/gems/chromedriver_update)
3
+ ![downloads](https://img.shields.io/gem/dt/chromedriver_update?color=blue&style=plastic)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-gold.svg?style=plastic&logo=mit)](LICENSE)
5
+
6
+ > Update an existing installation of chromedriver fitting to the current installed version of chrome. Available for Ruby and as CLI command as well.
7
+
8
+ Very basic tool, to ensure, that the current chromedriver is up to date to the current installed Chrome. Automatically fetches the same driver version or the latest version below, to ensure it will work with the current installed chrome version.
9
+
10
+ The installed chromedriver is replaced with the new version. So it must have been setup already and added to the PATH environment variable to use this script from then.
11
+
12
+ Implemented for Linux, Windows and Mac.
13
+
14
+ ### Contents
15
+ * [Installation](#installation)
16
+ * [Usage](#usage)
17
+ * [Command line](#command-line-usage)
18
+ * [Documentation](#documentation)
19
+ * [Contributing](#contributing)
20
+
21
+
22
+ <a name="installation"></a>
23
+ ## Installation
24
+ ### Ruby
25
+ Add this line to your application's Gemfile:
26
+
27
+ ```ruby
28
+ gem 'chromedriver_update'
29
+ ```
30
+
31
+ And then execute:
32
+
33
+ bundle install
34
+
35
+ ### Command line
36
+ If you just want to use the command line then run
37
+
38
+ gem install chromedriver_update
39
+
40
+ Of course you need to have installed Ruby on your system and set the PATH variable, to have access to Ruby commands like `ruby` or `gem`.
41
+
42
+
43
+
44
+ <a name="usage"></a>
45
+ ## Usage
46
+
47
+ ### Example
48
+
49
+ ```ruby
50
+ require 'chromedriver_update'
51
+
52
+ ChromedriverUpdate.auto_update_chromedriver
53
+ ```
54
+
55
+
56
+ <a name="command-line-usage"></a>
57
+ ## Command line
58
+
59
+ `chromedriver_update` is also available on the command line after installation.
60
+
61
+ ### Example
62
+
63
+ Run on the command line
64
+
65
+ ```ruby
66
+ chromedriver_update
67
+ # => Updated Chromedriver from '123.0.0' to '124.0.0'! Chrome is '124.0.1'.
68
+ ```
69
+
70
+ ### Options
71
+
72
+ ```bash
73
+ chromedriver_update # automatically update the current chromedriver version fitting to the currently installed chrome
74
+ chromedriver_update -f --force # force automatic update, even if the latest version is already installed
75
+ chromedriver_update -h --help # show this info
76
+ chromedriver_update -s --status # list current and available version(s) of chromedriver and chrome
77
+ chromedriver_update -v --version # show the current version of chromedriver_update
78
+ ```
79
+
80
+ <a name="documentation"></a>
81
+ ## Documentation
82
+
83
+ For more details have a look at the rubydoc at [https://www.rubydoc.info/gems/chromedriver_update](https://www.rubydoc.info/gems/chromedriver_update)
84
+
85
+
86
+
87
+ <a name="documentation"></a>
88
+ ## Contributing
89
+ Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/chromedriver_update. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
90
+
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- #
5
- # run default task to see tasks to build and publish gem
6
- #
7
- task :default do
8
- system 'rake --tasks'
9
- end
10
-
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ #
5
+ # run default task to see tasks to build and publish gem
6
+ #
7
+ task :default do
8
+ system 'rake --tasks'
9
+ end
10
+
11
11
  RSpec::Core::RakeTask.new(:spec)
@@ -1,24 +1,27 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/chromedriver_update'
4
-
5
- arg = ARGV[0]
6
-
7
- if %w[version -v --version].include?(arg)
8
- puts "#{ChromedriverUpdate::VERSION}"
9
- elsif arg.nil? || arg == '' || %w[force -f --force].include?(arg)
10
- force = %w[force -f --force].include?(arg)
11
- ChromedriverUpdate.auto_update_chromedriver force: force
12
- else
13
- puts <<-TEXT
14
-
15
- chromedriver_update #{ChromedriverUpdate::VERSION}
16
- https://github.com/magynhard/chromedriver_update
17
-
18
- chromedriver_update # automatically update the current chromedriver version fitting to the currently installed chrome
19
- chromedriver_update -f --force # force automatic update, even if the latest version is already installed
20
- chromedriver_update -h --help # show this info
21
- chromedriver_update -v --version # show the libraries current version
22
-
23
- TEXT
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/chromedriver_update'
4
+
5
+ arg = ARGV[0]
6
+
7
+ if %w[version -v --version].include?(arg)
8
+ puts "#{ChromedriverUpdate::VERSION}"
9
+ elsif %w[status -s --status].include?(arg)
10
+ ChromedriverUpdate.print_version_status
11
+ elsif arg.nil? || arg == '' || %w[force -f --force].include?(arg)
12
+ force = %w[force -f --force].include?(arg)
13
+ ChromedriverUpdate.auto_update_chromedriver force: force
14
+ else
15
+ puts <<-TEXT
16
+
17
+ chromedriver_update #{ChromedriverUpdate::VERSION}
18
+ https://github.com/magynhard/chromedriver_update
19
+
20
+ chromedriver_update # automatically update the current chromedriver version fitting to the currently installed chrome
21
+ chromedriver_update -f --force # force automatic update, even if the latest version is already installed
22
+ chromedriver_update -h --help # show this info
23
+ chromedriver_update -s --status # list current and available version(s) of chromedriver and chrome
24
+ chromedriver_update -v --version # show the current version of chromedriver_update
25
+
26
+ TEXT
24
27
  end
@@ -1,2 +1,2 @@
1
- @ECHO OFF
1
+ @ECHO OFF
2
2
  @"%~dp0ruby.exe" "%~dpn0" %*
data/bin/console CHANGED
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require_relative '../lib/chromedriver_update'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require 'pry'
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require_relative '../lib/chromedriver_update'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require 'pry'
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,39 +1,39 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'chromedriver_update/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "chromedriver_update"
8
- spec.version = ChromedriverUpdate::VERSION
9
- spec.executables = %w[chromedriver_update]
10
- spec.authors = ["Matthäus Beyrle"]
11
- spec.email = ["chromedriver_update.gemspec@mail.magynhard.de"]
12
-
13
- spec.summary = %q{Update an existing installation of chromedriver fitting to the current installed version of chrome}
14
- spec.homepage = "https://github.com/magynhard/chromedriver_update"
15
- spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
-
30
- spec.require_paths = ['lib']
31
-
32
- spec.add_dependency 'os', '~> 1.1.4'
33
- spec.add_dependency 'rubyzip', '~> 2.3.2'
34
- spec.add_dependency 'httparty', '~> 0.22.0'
35
-
36
- spec.add_development_dependency 'bundler', '>= 1.14'
37
- spec.add_development_dependency 'rake', '>= 10.0'
38
- spec.add_development_dependency 'rspec', '>= 3.0'
39
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'chromedriver_update/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "chromedriver_update"
8
+ spec.version = ChromedriverUpdate::VERSION
9
+ spec.executables = %w[chromedriver_update]
10
+ spec.authors = ["Matthäus Beyrle"]
11
+ spec.email = ["chromedriver_update.gemspec@mail.magynhard.de"]
12
+
13
+ spec.summary = %q{Update an existing installation of chromedriver fitting to the current installed version of chrome}
14
+ spec.homepage = "https://github.com/magynhard/chromedriver_update"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_dependency 'os', '~> 1.1.4'
33
+ spec.add_dependency 'rubyzip', '~> 2.3.2'
34
+ spec.add_dependency 'httparty', '~> 0.22.0'
35
+
36
+ spec.add_development_dependency 'bundler', '>= 1.14'
37
+ spec.add_development_dependency 'rake', '>= 10.0'
38
+ spec.add_development_dependency 'rspec', '>= 3.0'
39
+ end
@@ -1,3 +1,3 @@
1
- class ChromedriverUpdate
2
- VERSION = '0.2.1'.freeze
3
- end
1
+ class ChromedriverUpdate
2
+ VERSION = '0.3.0'.freeze
3
+ end
@@ -1,156 +1,191 @@
1
- require 'os'
2
- require 'open-uri'
3
- require 'zip'
4
- require 'httparty'
5
- require 'fileutils'
6
- require 'json'
7
-
8
- require_relative 'chromedriver_update/version'
9
- require_relative 'custom_errors/chromedriver_not_found_error'
10
- require_relative 'custom_errors/chrome_not_found_error'
11
-
12
- class ChromedriverUpdate
13
-
14
- CHROME_DOWNLOADS_LIST_URL = 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json'
15
-
16
- #
17
- # Update the installed version of chromedriver automatically fitting to the currently installed version of chrome
18
- #
19
- # @param [Boolean] force=false force the update, even if the version is already installed
20
- #
21
- def self.auto_update_chromedriver(force: false)
22
- if installed_chrome_version.split(".").first != installed_chromedriver_version.split(".").first || force
23
- original_chromedriver_version = installed_chromedriver_version
24
- original_chromedriver_path = chromedriver_path
25
- chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
26
- if chromedriver_zip.code == 404 # fallback to latest lower version
27
- chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
28
- end
29
- destination_dir = File.expand_path(File.dirname(__FILE__) + "/../tmp")
30
- FileUtils.mkdir_p destination_dir
31
- Zip::File.open_buffer(chromedriver_zip.body) do |zip_files|
32
- zip_files.each do |entry|
33
- if (entry.name.end_with?("/chromedriver") || entry.name.end_with?("/chromedriver.exe"))
34
- download_path = File.join(destination_dir, File.basename(entry.name))
35
- FileUtils.rm_f(download_path)
36
- entry.extract(download_path)
37
- FileUtils.mv(download_path, chromedriver_path, force: true)
38
- unless OS.windows?
39
- begin
40
- FileUtils.chmod("+x", original_chromedriver_path)
41
- `chmod +x "#{original_chromedriver_path}"`
42
- rescue
43
- begin
44
- `chmod +x "#{original_chromedriver_path}"`
45
- rescue
46
- begin
47
- `sudo chmod +x "#{original_chromedriver_path}"`
48
- rescue
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
56
- puts "Updated Chromedriver from '#{original_chromedriver_version}' to '#{installed_chromedriver_version}'! Chrome is '#{installed_chrome_version}'."
57
- else
58
- puts "Chromedriver is already up to date at major version! Chromedriver: '#{installed_chromedriver_version}' Chrome: '#{installed_chrome_version}'"
59
- end
60
- end
61
-
62
- #
63
- # Get the currently installed version of chrome
64
- #
65
- # @return [String] current installed chrome version
66
- #
67
- def self.installed_chrome_version
68
- begin
69
- if OS.windows?
70
- version = `reg query "HKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon" /v version`
71
- version.scan(/version[^0-9]*([0-9\.]+)/).flatten.first
72
- elsif OS.mac?
73
- version = `"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version`
74
- version.scan(/([0-9\.]+)/).flatten.first
75
- else
76
- version = ""
77
- begin
78
- version = `google-chrome --version`
79
- rescue Errno::ENOENT => e
80
- version = `google-chrome-stable --version`
81
- end
82
- version.scan(/([0-9\.]+)/).flatten.first
83
- end
84
- rescue => e
85
- raise ChromeNotFoundError.new "Could not detect a installed chrome version!"
86
- end
87
- end
88
-
89
- #
90
- # Get the currently installed version of chromedriver
91
- #
92
- # @return [String] current installed chromedriver version
93
- #
94
- def self.installed_chromedriver_version
95
- `#{chromedriver_path} --version`.scan(/([0-9\.]+)/).flatten.first
96
- end
97
-
98
- def self.chromedriver_link_for_version(version)
99
- if OS.windows?
100
- "https://storage.googleapis.com/chrome-for-testing-public/#{version}/win64/chromedriver-win64.zip"
101
- elsif OS.mac?
102
- "https://storage.googleapis.com/chrome-for-testing-public/#{version}/#{mac_platform}/chromedriver-mac-arm64.zip"
103
- else
104
- "https://storage.googleapis.com/chrome-for-testing-public/#{version}/linux64/chromedriver-linux64.zip"
105
- end
106
- end
107
-
108
- #
109
- # Get the download URL of the closest chromedriver version fitting the given chrome version
110
- #
111
- # @param [String] version of chrome to find the best chromedriver version for
112
- # @return [String] link to the matching chromedriver download for the local platform
113
- #
114
- def self.chromedriver_closest_link_for_version(version)
115
- platform = if OS.windows?
116
- "win64"
117
- elsif OS.mac?
118
- mac_platform
119
- else
120
- "linux64"
121
- end
122
- list = JSON.parse(HTTParty.get(CHROME_DOWNLOADS_LIST_URL).body)
123
- latest_match = list['versions'].filter { |el| el['version'].start_with?(version.split(".")[0...1].join(".")) && el['version'].split(".")[2].to_i < version.split(".")[2].to_i && el['downloads']['chromedriver'] }.last
124
- latest_match['downloads']['chromedriver'].filter { |el| el['platform'] == platform }.first['url']
125
- end
126
-
127
- #
128
- # Detect macOS platform
129
- #
130
- # @return [String] platform for macos
131
- def self.mac_platform
132
- if RUBY_PLATFORM.include?("x86") || RUBY_PLATFORM.include?("x64")
133
- 'mac-x64'
134
- else
135
- 'mac-arm64'
136
- end
137
- end
138
-
139
- #
140
- # Get the path of the installed chromedriver
141
- #
142
- # @return [String] path to the installed chromedriver
143
- # @raise [ChromedriverNotFoundError] if no chromedriver could be found
144
- def self.chromedriver_path
145
- version = if OS.windows?
146
- `where chromedriver`.strip
147
- else
148
- `which chromedriver`.strip
149
- end
150
- if version == ""
151
- raise ChromedriverNotFoundError.new "Could not detect installed chromedriver!"
152
- else
153
- version
154
- end
155
- end
156
- end
1
+ require 'os'
2
+ require 'open-uri'
3
+ require 'zip'
4
+ require 'httparty'
5
+ require 'fileutils'
6
+ require 'json'
7
+
8
+ require_relative 'chromedriver_update/version'
9
+ require_relative 'custom_errors/chromedriver_not_found_error'
10
+ require_relative 'custom_errors/chrome_not_found_error'
11
+
12
+ class ChromedriverUpdate
13
+
14
+ CHROME_DOWNLOADS_LIST_URL = 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json'
15
+
16
+ #
17
+ # Update the installed version of chromedriver automatically fitting to the currently installed version of chrome
18
+ #
19
+ # @param [Boolean] force=false force the update, even if the version is already installed
20
+ #
21
+ def self.auto_update_chromedriver(force: false)
22
+ if installed_chrome_version.split(".").first != installed_chromedriver_version.split(".").first || force
23
+ original_chromedriver_version = installed_chromedriver_version
24
+ original_chromedriver_path = chromedriver_path
25
+ chromedriver_zip = HTTParty.get(chromedriver_link_for_version(installed_chrome_version))
26
+ if chromedriver_zip.code == 404 # fallback to latest lower version
27
+ chromedriver_zip = HTTParty.get(chromedriver_closest_link_for_version(installed_chrome_version))
28
+ puts "Could not find same chromedriver version for chrome version '#{installed_chrome_version}'. Fallback to closest version '#{installed_chrome_version}'"
29
+ else
30
+ puts "Found same chromedriver version '#{installed_chrome_version}' for chrome version '#{installed_chrome_version}'"
31
+ 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
45
+ begin
46
+ `sudo chmod +x "#{original_chromedriver_path}"`
47
+ rescue
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ puts "Updated Chromedriver from '#{original_chromedriver_version}' to '#{installed_chromedriver_version}'! Chrome is '#{installed_chrome_version}'."
55
+ else
56
+ puts "Chromedriver is already up to date at major version! Chromedriver: '#{installed_chromedriver_version}' Chrome: '#{installed_chrome_version}'"
57
+ end
58
+ end
59
+
60
+ #
61
+ # Get the currently installed version of chrome
62
+ #
63
+ # @return [String] current installed chrome version
64
+ #
65
+ def self.installed_chrome_version
66
+ begin
67
+ if OS.windows?
68
+ version = `reg query "HKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon" /v version`
69
+ version.scan(/version[^0-9]*([0-9\.]+)/).flatten.first
70
+ elsif OS.mac?
71
+ version = `"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version`
72
+ version.scan(/([0-9\.]+)/).flatten.first
73
+ else
74
+ version = ""
75
+ begin
76
+ version = `google-chrome --version`
77
+ rescue Errno::ENOENT => e
78
+ version = `google-chrome-stable --version`
79
+ end
80
+ version.scan(/([0-9\.]+)/).flatten.first
81
+ end
82
+ rescue => e
83
+ raise ChromeNotFoundError.new "Could not detect a installed chrome version!"
84
+ end
85
+ end
86
+
87
+ #
88
+ # Get the currently installed version of chromedriver
89
+ #
90
+ # @return [String] current installed chromedriver version
91
+ #
92
+ def self.installed_chromedriver_version
93
+ `#{chromedriver_path} --version`.scan(/([0-9\.]+)/).flatten.first
94
+ end
95
+
96
+ def self.chromedriver_link_for_version(version)
97
+ if OS.windows?
98
+ "https://storage.googleapis.com/chrome-for-testing-public/#{version}/win64/chromedriver-win64.zip"
99
+ elsif OS.mac?
100
+ "https://storage.googleapis.com/chrome-for-testing-public/#{version}/#{mac_platform}/chromedriver-mac-arm64.zip"
101
+ else
102
+ "https://storage.googleapis.com/chrome-for-testing-public/#{version}/linux64/chromedriver-linux64.zip"
103
+ end
104
+ end
105
+
106
+
107
+ def self.print_version_status
108
+ puts "Installed versions"
109
+ puts "- chrome: #{installed_chrome_version}"
110
+ puts "- chromedriver: #{installed_chromedriver_version} @ #{chromedriver_path}"
111
+ puts
112
+ puts "Available versions of chromedriver"
113
+ exact = if remote_file_exists? chromedriver_link_for_version(installed_chrome_version)
114
+ installed_chrome_version
115
+ else
116
+ "not found"
117
+ end
118
+ closest = if remote_file_exists? chromedriver_closest_link_for_version(installed_chrome_version)
119
+ chromedriver_closest_version_for_version(installed_chrome_version)
120
+ else
121
+ "not found"
122
+ end
123
+ puts "- exact match: #{exact}"
124
+ puts " -> #{chromedriver_link_for_version(installed_chrome_version)}" if exact != "not found"
125
+ puts "- closest lower match: #{closest}"
126
+ puts " -> #{chromedriver_closest_link_for_version(installed_chrome_version)}" if closest != "not found"
127
+ end
128
+
129
+ #
130
+ # Get the download URL of the closest chromedriver version fitting the given chrome version
131
+ #
132
+ # @param [String] version of chrome to find the best chromedriver version for
133
+ # @return [String] link to the matching chromedriver download for the local platform
134
+ #
135
+ def self.chromedriver_closest_link_for_version(version)
136
+ platform = if OS.windows?
137
+ "win64"
138
+ elsif OS.mac?
139
+ mac_platform
140
+ else
141
+ "linux64"
142
+ end
143
+ list = JSON.parse(HTTParty.get(CHROME_DOWNLOADS_LIST_URL).body)
144
+ latest_match = list['versions'].filter { |el| el['version'].start_with?(version.split(".")[0...1].join(".")) && el['version'].split(".")[2].to_i < version.split(".")[2].to_i && el['downloads']['chromedriver'] }.last
145
+ latest_match['downloads']['chromedriver'].filter { |el| el['platform'] == platform }.first['url']
146
+ end
147
+
148
+ def self.chromedriver_closest_version_for_version(version)
149
+ list = JSON.parse(HTTParty.get(CHROME_DOWNLOADS_LIST_URL).body)
150
+ latest_match = list['versions'].filter { |el| el['version'].start_with?(version.split(".")[0...1].join(".")) && el['version'].split(".")[2].to_i < version.split(".")[2].to_i && el['downloads']['chromedriver'] }.last
151
+ latest_match['version']
152
+ end
153
+
154
+ #
155
+ # Detect macOS platform
156
+ #
157
+ # @return [String] platform for macos
158
+ def self.mac_platform
159
+ if RUBY_PLATFORM.include?("x86") || RUBY_PLATFORM.include?("x64")
160
+ 'mac-x64'
161
+ else
162
+ 'mac-arm64'
163
+ end
164
+ end
165
+
166
+ #
167
+ # Get the path of the installed chromedriver
168
+ #
169
+ # @return [String] path to the installed chromedriver
170
+ # @raise [ChromedriverNotFoundError] if no chromedriver could be found
171
+ def self.chromedriver_path
172
+ version = if OS.windows?
173
+ `where chromedriver`.strip
174
+ else
175
+ `which chromedriver`.strip
176
+ end
177
+ if version == ""
178
+ raise ChromedriverNotFoundError.new "Could not detect installed chromedriver!"
179
+ else
180
+ version
181
+ end
182
+ end
183
+
184
+ #
185
+ # Check if a remote file exists, without downloading it, by checking header (OPTIONS)
186
+ # @param [String] url to check
187
+ def self.remote_file_exists?(url)
188
+ response = HTTParty.head(url)
189
+ response.success?
190
+ end
191
+ end
@@ -1,2 +1,2 @@
1
- class ChromeNotFoundError < StandardError
1
+ class ChromeNotFoundError < StandardError
2
2
  end
@@ -1,2 +1,2 @@
1
- class ChromedriverNotFoundError < StandardError
1
+ class ChromedriverNotFoundError < StandardError
2
2
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chromedriver_update
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthäus Beyrle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-01 00:00:00.000000000 Z
11
+ date: 2025-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -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.1.4
142
+ rubygems_version: 3.5.22
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Update an existing installation of chromedriver fitting to the current installed