geordi 9.1.0 → 9.2.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: 337e7767788852ee10b537112f4151f4b12e267740fa20557b7786e12babd97d
4
- data.tar.gz: 0dd146812562eb28fa115cbbdefa1bffcc8b172f1b509d44414bcca667ce3774
3
+ metadata.gz: 702407b6104865ae130f2c2793aa673f3c6f847d3652689a76e6d04c59a828e6
4
+ data.tar.gz: 4718d6e956efa941c25452f382761dcb3727db98364cfd0847c4edb0b947a608
5
5
  SHA512:
6
- metadata.gz: '07256569d49cf31224e4a69d5fc0e240d9c8df820e527fd615b1e5956f320fa01077572b4e79401bf7a5ee8b8d9bf135b94c369ef807a2bc40c36aa76eb7180a'
7
- data.tar.gz: 18bf3b9d1026575a5c0c3d33281de6b211ffa38c8c0d316656c6aee90bcdc2b81e5cec2feae0f006f2ef3fb8458834c1813dcd8d2aff5adcdf17bed732a06217
6
+ metadata.gz: b43e0bf03b775a47bfbfee4ebd87aaa615cdd1d13b9f85d0952fabb23f2591d3d736cb6ef852695bdec56d562cabd18e87abd37a8f204ca5ce9af74575c4b5bb
7
+ data.tar.gz: 4a8963f968e73e040a9486337881f52549563d019abf0601589cfaf64af28d950b921e990bd196d060c78212c5a1b7893d6f2d1fc3641c51697f18698406060c
data/CHANGELOG.md CHANGED
@@ -3,7 +3,6 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
5
 
6
-
7
6
  ## Unreleased
8
7
 
9
8
  ### Compatible changes
@@ -11,6 +10,14 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
11
10
  ### Breaking changes
12
11
 
13
12
 
13
+ ## 9.2.0 2022-02-18
14
+
15
+ ### Compatible changes
16
+ * Change the update mechanism of `geordi chromedriver-update`: This command (and `geordi cucumber`/`geordi tests` if the `auto_update_chromedriver` option is active) will now always update to the latest version of chromedriver for the current chrome version.
17
+
18
+ ### Breaking changes
19
+
20
+
14
21
  ## 9.1.0 2022-02-14
15
22
 
16
23
  ### Compatible changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (9.1.0)
4
+ geordi (9.2.0)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -53,10 +53,10 @@ installed Chrome.
53
53
 
54
54
  Setting `auto_update_chromedriver` to `true` in your global Geordi config file
55
55
  (`~/.config/geordi/global.yml`), will automatically update chromedriver before
56
- cucumber tests, in case Chrome and chromedriver versions don't match
56
+ cucumber tests if a newer chromedriver version is available.
57
57
 
58
58
  **Options**
59
- - `[--quiet-if-matching], [--no-quiet-if-matching]`: Suppress notification if chromedriver and chrome versions match
59
+ - `[--quiet-if-matching], [--no-quiet-if-matching]`: Suppress notification if chromedriver is already on the latest version
60
60
 
61
61
 
62
62
  ### `geordi clean`
@@ -7,18 +7,13 @@ module Geordi
7
7
 
8
8
  def run(options)
9
9
  chrome_version = determine_chrome_version
10
- chromedriver_version = determine_chromedriver_version
10
+ current_chromedriver_version = determine_chromedriver_version
11
11
 
12
- if skip_update?(chrome_version, chromedriver_version)
13
- Interaction.success "No update required: both Chrome and chromedriver are on v#{chrome_version}!" unless options[:quiet_if_matching]
12
+ latest_chromedriver_version = latest_version(chrome_version)
13
+ if current_chromedriver_version == latest_chromedriver_version
14
+ Interaction.success "No update required: Chromedriver is already on the latest version v#{latest_chromedriver_version}!" unless options[:quiet_if_matching]
14
15
  else
15
- chromedriver_zip = download_chromedriver(chrome_version)
16
- unzip(chromedriver_zip, File.expand_path('~/bin'))
17
-
18
- chromedriver_zip.unlink
19
-
20
- # We need to determine the version again, as it could be nil in case no chromedriver was installed before
21
- Interaction.success "Chromedriver updated to v#{determine_chromedriver_version}."
16
+ update_chromedriver(latest_chromedriver_version)
22
17
  end
23
18
  end
24
19
 
@@ -27,13 +22,13 @@ module Geordi
27
22
  def determine_chrome_version
28
23
  stdout_str, _error_str, status = Open3.capture3('google-chrome', '--version')
29
24
  chrome_version = unless stdout_str.nil?
30
- stdout_str[/\AGoogle Chrome (\d+)/, 1]
25
+ stdout_str[/\AGoogle Chrome ([\d.]+)/, 1]
31
26
  end
32
27
 
33
28
  if !status.success? || chrome_version.nil?
34
29
  Interaction.fail('Could not determine the version of Google Chrome.')
35
30
  else
36
- chrome_version.to_i
31
+ chrome_version
37
32
  end
38
33
  end
39
34
 
@@ -42,23 +37,32 @@ module Geordi
42
37
 
43
38
  stdout_str, _error_str, status = Open3.capture3('chromedriver', '-v')
44
39
  chromedriver_version = unless stdout_str.nil?
45
- stdout_str[/\AChromeDriver (\d+)/, 1]
40
+ stdout_str[/\AChromeDriver ([\d.]+)/, 1]
46
41
  end
47
42
 
48
43
  if !status.success? || chromedriver_version.nil?
49
44
  Interaction.fail('Could not determine the version of chromedriver.')
50
45
  else
51
- chromedriver_version.to_i
46
+ chromedriver_version
52
47
  end
53
48
  end
54
49
 
55
- def skip_update?(chrome_version, chromedriver_version)
56
- chrome_version == chromedriver_version
50
+ # Check https://groups.google.com/a/chromium.org/g/chromium-discuss/c/4BB4jmsRyv8/m/TY3FXS4HBgAJ
51
+ # for information how chrome version numbers work
52
+ def major_version(full_version)
53
+ full_version.match(/^(\d+\.\d+\.\d+)\.\d+$/)[1]
57
54
  end
58
55
 
59
- def download_chromedriver(chrome_version)
60
- latest_version = latest_version(chrome_version)
56
+ def update_chromedriver(latest_chromedriver_version)
57
+ chromedriver_zip = download_chromedriver(latest_chromedriver_version)
58
+
59
+ unzip(chromedriver_zip, File.expand_path('~/bin'))
61
60
 
61
+ # We need to determine the version again, as it could be nil in case no chromedriver was installed before
62
+ Interaction.success "Chromedriver updated to v#{determine_chromedriver_version}."
63
+ end
64
+
65
+ def download_chromedriver(latest_version)
62
66
  uri = URI("https://chromedriver.storage.googleapis.com/#{latest_version}/chromedriver_linux64.zip")
63
67
  response = Net::HTTP.get_response(uri)
64
68
 
@@ -73,11 +77,13 @@ module Geordi
73
77
  end
74
78
 
75
79
  def latest_version(chrome_version)
76
- uri = URI("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_#{chrome_version}")
80
+ return @latest_version if @latest_version
81
+
82
+ uri = URI("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_#{major_version(chrome_version)}")
77
83
  response = Net::HTTP.get_response(uri)
78
84
 
79
85
  if response.is_a?(Net::HTTPSuccess)
80
- response.body.to_s
86
+ @latest_version = response.body.to_s
81
87
  else
82
88
  Interaction.fail("Could not download the chromedriver v#{chrome_version}.")
83
89
  end
@@ -7,11 +7,11 @@ installed Chrome.
7
7
 
8
8
  Setting `auto_update_chromedriver` to `true` in your global Geordi config file
9
9
  (`~/.config/geordi/global.yml`), will automatically update chromedriver before
10
- cucumber tests, in case Chrome and chromedriver versions don't match
10
+ cucumber tests if a newer chromedriver version is available.
11
11
  LONGDESC
12
12
 
13
13
  option :quiet_if_matching, type: :boolean, default: false,
14
- desc: 'Suppress notification if chromedriver and chrome versions match'
14
+ desc: 'Suppress notification if chromedriver is already on the latest version'
15
15
 
16
16
  def chromedriver_update
17
17
  require 'geordi/chromedriver_updater'
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '9.1.0'.freeze
2
+ VERSION = '9.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.0
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubygems_version: 3.0.3
119
+ rubygems_version: 3.2.26
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Collection of command line tools we use in our daily work with Ruby, Rails