chromedriver-helper 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +9 -1
- data/README.md +36 -4
- data/Rakefile +3 -0
- data/bin/chromedriver +1 -1
- data/bin/chromedriver-update +1 -1
- data/chromedriver-helper.gemspec +17 -8
- data/concourse/chromedriver-helper.yml +78 -0
- data/concourse/tasks/rake-test/run.ps1 +12 -0
- data/concourse/tasks/rake-test/run.sh +12 -0
- data/lib/chromedriver/helper.rb +52 -15
- data/lib/chromedriver/helper/google_code_parser.rb +13 -6
- data/lib/chromedriver/helper/version.rb +1 -1
- data/spec/google_code_parser_spec.rb +14 -8
- metadata +22 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf62727ee028fa0e91b8867a7eae498cbc9577b
|
4
|
+
data.tar.gz: a3529789da5ffac99204f2db6dac4ea9cc893288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e89499aca520cbcb21fa7acdd387929d983eb93d624713fc1bb2b4ae9f32c11e0d8e54edc1646e0be8f33fce31fe18509902e3ad7a82092140ba76cbe86aec6
|
7
|
+
data.tar.gz: 2ab325ecd08e895c93522be086367ab396b5ba06232e72178288ad22ef2703c518e44888766418ec6c636f78f00ff20da7482b1672b38b751f71ab3cde050c16
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -35,11 +35,23 @@ then, in your specs:
|
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
|
-
#
|
38
|
+
# Specifying a version
|
39
39
|
|
40
|
-
If you
|
41
|
-
|
42
|
-
|
40
|
+
If you want to run a specific version of chromedriver, you can set the version like so:
|
41
|
+
|
42
|
+
Chromedriver.set_version "2.24"
|
43
|
+
|
44
|
+
Or, from the command line, you can run
|
45
|
+
|
46
|
+
chromedriver-update 2.24
|
47
|
+
|
48
|
+
|
49
|
+
# Updating to latest Chromedriver
|
50
|
+
|
51
|
+
If you'd like to force-upgrade to the latest version of chromedriver:
|
52
|
+
|
53
|
+
1. delete the directory `$HOME/.chromedriver-helper`
|
54
|
+
2. run `chromedriver-update`
|
43
55
|
|
44
56
|
This might be necessary on platforms on which Chrome auto-updates,
|
45
57
|
which has been known to introduce incompatibilities with older
|
@@ -55,6 +67,26 @@ The code lives at
|
|
55
67
|
Open a Github Issue, or send a pull request! Thanks! You're the best.
|
56
68
|
|
57
69
|
|
70
|
+
## CentOS 6 and 7
|
71
|
+
|
72
|
+
Apparently recent versions of `chromedriver` won't run on CentOS 6 and 7, due to the [problems explained here](https://chrome.richardlloyd.org.uk/). The error messages look something like:
|
73
|
+
|
74
|
+
```
|
75
|
+
chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)
|
76
|
+
chromedriver: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)
|
77
|
+
chromedriver: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /home/vagrant/.chromedriver-helper/linux64/chromedriver)
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
You can get `chromedriver` to work on these systems by running the `install_chrome.sh` script on the page linked to above, and then making sure your `chromedriver` process has `LD_LIBRARY_PATH` set so that `/opt/google/chrome/lib` is present, e.g.
|
82
|
+
|
83
|
+
```
|
84
|
+
$ LD_LIBRARY_PATH=/opt/google/chrome/lib chromedriver
|
85
|
+
Starting ChromeDriver 2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f) on port 9515
|
86
|
+
Only local connections are allowed.
|
87
|
+
|
88
|
+
```
|
89
|
+
|
58
90
|
# License
|
59
91
|
|
60
92
|
MIT licensed, see LICENSE.txt for full details.
|
data/Rakefile
CHANGED
data/bin/chromedriver
CHANGED
data/bin/chromedriver-update
CHANGED
data/chromedriver-helper.gemspec
CHANGED
@@ -2,24 +2,33 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "chromedriver/helper/version"
|
4
4
|
|
5
|
+
def windows?
|
6
|
+
RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/
|
7
|
+
end
|
8
|
+
|
5
9
|
Gem::Specification.new do |s|
|
6
10
|
s.name = "chromedriver-helper"
|
7
11
|
s.version = Chromedriver::Helper::VERSION
|
8
12
|
s.authors = ["Mike Dalessio"]
|
9
13
|
s.email = ["mike.dalessio@gmail.com"]
|
10
|
-
s.homepage = "https://github.com/flavorjones/
|
14
|
+
s.homepage = "https://github.com/flavorjones/chromedriver-helper"
|
11
15
|
s.summary = "Easy installation and use of chromedriver."
|
12
16
|
s.description = "Easy installation and use of chromedriver, the Chromium project's selenium webdriver adapter."
|
13
17
|
s.licenses = ["MIT"]
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
19
|
+
begin
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
rescue Exception => e
|
24
|
+
warn "WARNING: could not set spec.files: #{e.class}: #{e}"
|
25
|
+
end
|
18
26
|
s.require_paths = ["lib"]
|
19
27
|
|
20
|
-
s.add_development_dependency "rspec",
|
21
|
-
s.add_development_dependency "rake",
|
28
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
s.add_development_dependency "rake", "~> 10.0"
|
30
|
+
s.add_development_dependency "concourse", "~> 0.12"
|
22
31
|
|
23
|
-
s.add_runtime_dependency "nokogiri",
|
24
|
-
s.add_runtime_dependency "archive-zip",
|
32
|
+
s.add_runtime_dependency "nokogiri", "~> 1.6"
|
33
|
+
s.add_runtime_dependency "archive-zip", "~> 0.7.0"
|
25
34
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
resources:
|
2
|
+
- name: ci
|
3
|
+
type: git
|
4
|
+
source:
|
5
|
+
uri: https://github.com/flavorjones/chromedriver-helper/
|
6
|
+
branch: master
|
7
|
+
disable_ci_skip: true # always get the latest pipeline configuration
|
8
|
+
|
9
|
+
- name: nokogiri-ci
|
10
|
+
type: git
|
11
|
+
source:
|
12
|
+
uri: https://github.com/sparklemotion/nokogiri/
|
13
|
+
branch: master
|
14
|
+
disable_ci_skip: true # always get the latest pipeline configuration
|
15
|
+
|
16
|
+
- name: chromedriver-helper
|
17
|
+
type: git
|
18
|
+
source:
|
19
|
+
uri: https://github.com/flavorjones/chromedriver-helper/
|
20
|
+
branch: master
|
21
|
+
ignore_paths:
|
22
|
+
- concourse/**
|
23
|
+
|
24
|
+
jobs:
|
25
|
+
<% ruby_version = RUBIES[:mri].last %>
|
26
|
+
- name: ruby-<%= ruby_version %>
|
27
|
+
public: true
|
28
|
+
plan:
|
29
|
+
- get: ci
|
30
|
+
- get: chromedriver-helper
|
31
|
+
trigger: true
|
32
|
+
- task: rake-test
|
33
|
+
config:
|
34
|
+
platform: linux
|
35
|
+
image_resource:
|
36
|
+
type: docker-image
|
37
|
+
source: {repository: ruby, tag: "<%= ruby_version %>"}
|
38
|
+
inputs:
|
39
|
+
- name: ci
|
40
|
+
- name: chromedriver-helper
|
41
|
+
run:
|
42
|
+
path: ci/concourse/tasks/rake-test/run.sh
|
43
|
+
|
44
|
+
- name: windows-install-ruby-2.3
|
45
|
+
public: true
|
46
|
+
serial_groups: [windows-configuration]
|
47
|
+
plan:
|
48
|
+
- get: nokogiri-ci
|
49
|
+
- get: chromedriver-helper
|
50
|
+
trigger: true
|
51
|
+
- task: setup
|
52
|
+
config:
|
53
|
+
platform: windows
|
54
|
+
inputs:
|
55
|
+
- name: nokogiri-ci
|
56
|
+
path: ci
|
57
|
+
run:
|
58
|
+
path: powershell
|
59
|
+
args: ["-File", "ci/concourse/tasks/windows-config/install-ruby-and-devkit.ps1"]
|
60
|
+
|
61
|
+
- name: ruby-2.3-devkit
|
62
|
+
public: true
|
63
|
+
plan:
|
64
|
+
- get: ci
|
65
|
+
- get: nokogiri-ci
|
66
|
+
- get: chromedriver-helper
|
67
|
+
trigger: true
|
68
|
+
passed: ["windows-install-ruby-2.3"]
|
69
|
+
- task: rake-test
|
70
|
+
config:
|
71
|
+
platform: windows
|
72
|
+
inputs:
|
73
|
+
- name: ci
|
74
|
+
- name: nokogiri-ci
|
75
|
+
- name: chromedriver-helper
|
76
|
+
run:
|
77
|
+
path: powershell
|
78
|
+
args: ["-File", "ci/concourse/tasks/rake-test/run.ps1"]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
. "nokogiri-ci\concourse\shared\common.ps1"
|
2
|
+
|
3
|
+
prepend-path $ruby23_bin_path
|
4
|
+
$env:RUBYOPT = "-rdevkit"
|
5
|
+
|
6
|
+
push-location chromedriver-helper
|
7
|
+
|
8
|
+
stream-cmd "gem" "install bundler"
|
9
|
+
stream-cmd "bundle" "install"
|
10
|
+
stream-cmd "bundle" "exec rake spec"
|
11
|
+
|
12
|
+
pop-location
|
data/lib/chromedriver/helper.rb
CHANGED
@@ -6,37 +6,67 @@ require 'open-uri'
|
|
6
6
|
require 'archive/zip'
|
7
7
|
|
8
8
|
module Chromedriver
|
9
|
-
|
9
|
+
def self.set_version(version)
|
10
|
+
Chromedriver::Helper.new.update(version)
|
11
|
+
end
|
10
12
|
|
11
|
-
|
13
|
+
class Helper
|
14
|
+
def run(*args)
|
12
15
|
download
|
13
16
|
exec binary_path, *args
|
14
17
|
end
|
15
18
|
|
16
|
-
def download
|
17
|
-
return if File.
|
18
|
-
|
19
|
-
|
19
|
+
def download(hit_network = false)
|
20
|
+
return if File.exist?(binary_path) && !hit_network
|
21
|
+
|
22
|
+
raise "Version not found for #{download_version}" unless download_url
|
23
|
+
|
24
|
+
filename = File.basename download_url
|
20
25
|
Dir.chdir platform_install_dir do
|
21
26
|
FileUtils.rm_f filename
|
22
27
|
File.open(filename, "wb") do |saved_file|
|
23
|
-
URI.parse(
|
28
|
+
URI.parse(download_url).open("rb") do |read_file|
|
24
29
|
saved_file.write(read_file.read)
|
25
30
|
end
|
26
31
|
end
|
27
|
-
|
32
|
+
|
33
|
+
raise "Could not download #{download_url}" unless File.exists? filename
|
28
34
|
Archive::Zip.extract(filename, '.', :overwrite => :all)
|
29
35
|
end
|
30
36
|
raise "Could not unzip #{filename} to get #{binary_path}" unless File.exists? binary_path
|
31
37
|
FileUtils.chmod "ugo+rx", binary_path
|
38
|
+
File.open(version_path, 'w') { |file| file.write(download_version) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def update(version = nil)
|
42
|
+
if version
|
43
|
+
@download_version = version
|
44
|
+
end
|
45
|
+
|
46
|
+
hit_network = (current_version != download_version) ? true : false
|
47
|
+
download(hit_network)
|
32
48
|
end
|
33
49
|
|
34
|
-
def
|
35
|
-
|
50
|
+
def current_version
|
51
|
+
@current_version ||= if File.exist?(version_path)
|
52
|
+
File.read(version_path).strip
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def download_version
|
57
|
+
@download_version ||= current_version || google_code_parser.newest_download_version.to_s
|
36
58
|
end
|
37
59
|
|
38
60
|
def download_url
|
39
|
-
|
61
|
+
@download_url ||= google_code_parser.version_download_url(download_version)
|
62
|
+
end
|
63
|
+
|
64
|
+
def google_code_parser
|
65
|
+
@google_code_parser ||= GoogleCodeParser.new(platform)
|
66
|
+
end
|
67
|
+
|
68
|
+
def version_path
|
69
|
+
@version_path ||= File.join(base_install_dir, ".chromedriver-version")
|
40
70
|
end
|
41
71
|
|
42
72
|
def binary_path
|
@@ -48,17 +78,25 @@ module Chromedriver
|
|
48
78
|
end
|
49
79
|
|
50
80
|
def platform_install_dir
|
51
|
-
dir = File.join
|
81
|
+
dir = File.join version_install_dir, platform
|
52
82
|
FileUtils.mkdir_p dir
|
53
83
|
dir
|
54
84
|
end
|
55
85
|
|
56
|
-
def
|
57
|
-
dir = File.expand_path File.join(
|
86
|
+
def version_install_dir
|
87
|
+
dir = File.expand_path File.join(base_install_dir, download_version)
|
58
88
|
FileUtils.mkdir_p dir
|
59
89
|
dir
|
60
90
|
end
|
61
91
|
|
92
|
+
def base_install_dir
|
93
|
+
@base_install_dir ||= begin
|
94
|
+
dir = File.expand_path File.join(ENV['HOME'], ".chromedriver-helper")
|
95
|
+
FileUtils.mkdir_p dir
|
96
|
+
dir
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
62
100
|
def platform
|
63
101
|
cfg = RbConfig::CONFIG
|
64
102
|
case cfg['host_os']
|
@@ -68,6 +106,5 @@ module Chromedriver
|
|
68
106
|
else "win"
|
69
107
|
end
|
70
108
|
end
|
71
|
-
|
72
109
|
end
|
73
110
|
end
|
@@ -14,14 +14,21 @@ module Chromedriver
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def downloads
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
@downloads ||= begin
|
18
|
+
doc = Nokogiri::XML.parse(source)
|
19
|
+
items = doc.css("Contents Key").collect {|k| k.text }
|
20
|
+
items.reject! {|k| !(/chromedriver_#{platform}/===k) }
|
21
|
+
items.map {|k| "#{BUCKET_URL}/#{k}"}
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
|
-
def
|
24
|
-
|
25
|
+
def newest_download_version
|
26
|
+
@newest_download_version ||= downloads.map { |download| version_of(download) }.max
|
27
|
+
end
|
28
|
+
|
29
|
+
def version_download_url(version)
|
30
|
+
gem_version = Gem::Version.new(version)
|
31
|
+
downloads.find { |download_url| version_of(download_url) == gem_version }
|
25
32
|
end
|
26
33
|
|
27
34
|
private
|
@@ -19,24 +19,30 @@ describe Chromedriver::Helper::GoogleCodeParser do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe "#
|
22
|
+
describe "#newest_download_version" do
|
23
23
|
it "returns the last URL for the platform" do
|
24
|
-
expect(parser.
|
24
|
+
expect(parser.newest_download_version).to eq Gem::Version.new("2.4")
|
25
25
|
end
|
26
26
|
|
27
27
|
context "out-of-order versions" do
|
28
28
|
before do
|
29
29
|
allow(parser).to receive(:downloads).and_return([
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
"http://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
|
31
|
+
"http://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip",
|
32
|
+
"http://chromedriver.storage.googleapis.com/2.14/chromedriver_mac32.zip",
|
33
|
+
"http://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
|
34
|
+
])
|
35
35
|
end
|
36
36
|
|
37
37
|
it "returns the newest version" do
|
38
|
-
expect(parser.
|
38
|
+
expect(parser.newest_download_version).to eq(Gem::Version.new("2.14"))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
describe '#version_download_url' do
|
44
|
+
it 'returns the version asked for' do
|
45
|
+
expect(parser.version_download_url(2.0)).to eq "http://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip"
|
46
|
+
end
|
47
|
+
end
|
42
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chromedriver-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: concourse
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.12'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: nokogiri
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,6 +91,7 @@ extensions: []
|
|
77
91
|
extra_rdoc_files: []
|
78
92
|
files:
|
79
93
|
- ".gitignore"
|
94
|
+
- ".rspec"
|
80
95
|
- ".travis.yml"
|
81
96
|
- CHANGELOG.md
|
82
97
|
- Gemfile
|
@@ -86,6 +101,9 @@ files:
|
|
86
101
|
- bin/chromedriver
|
87
102
|
- bin/chromedriver-update
|
88
103
|
- chromedriver-helper.gemspec
|
104
|
+
- concourse/chromedriver-helper.yml
|
105
|
+
- concourse/tasks/rake-test/run.ps1
|
106
|
+
- concourse/tasks/rake-test/run.sh
|
89
107
|
- lib/chromedriver/helper.rb
|
90
108
|
- lib/chromedriver/helper/google_code_parser.rb
|
91
109
|
- lib/chromedriver/helper/version.rb
|
@@ -94,7 +112,7 @@ files:
|
|
94
112
|
- spec/google_code_parser_spec.rb
|
95
113
|
- spec/helper_spec.rb
|
96
114
|
- spec/spec_helper.rb
|
97
|
-
homepage: https://github.com/flavorjones/
|
115
|
+
homepage: https://github.com/flavorjones/chromedriver-helper
|
98
116
|
licenses:
|
99
117
|
- MIT
|
100
118
|
metadata: {}
|
@@ -114,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
132
|
version: '0'
|
115
133
|
requirements: []
|
116
134
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.6.10
|
118
136
|
signing_key:
|
119
137
|
specification_version: 4
|
120
138
|
summary: Easy installation and use of chromedriver.
|