ikm-chromedriver-helper 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 898e98c2fc33ce58694cab8b5fd70782e1ad77fd
4
+ data.tar.gz: 57c771b021c0b8de769bb78c795a72dcddc8789e
5
+ SHA512:
6
+ metadata.gz: 6d687cd841373f7a09413f9c2efcf5f2f6249ec4690aded1505826be1673d585493def395684930358b8ff80c3dd0023cebbf49330ee6b8eaaf6ac1d7e87ef74
7
+ data.tar.gz: cc7a3b3dacca94404394ac4d0832729719871b784a961ce632cb3258a61921f998e5c12af96d15ca7d95c926a46605140d40d8bd0d150a396c5552ac04f4b846
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ chromedriver.log
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ Changelog
2
+ ==========
3
+
4
+ 0.0.7 - 26 Aug 2014
5
+ ----------
6
+
7
+ * Added support for windows binaries. (Thanks, @elementc!)
8
+
9
+
10
+ 0.0.6 - 26 Aug 2014
11
+ ----------
12
+
13
+ * Fixed to work with new Google download page. #7 (Thanks, @mars!)
14
+
15
+
16
+ 0.0.5 - 15 Aug 2012
17
+ ----------
18
+
19
+ * Fixed support for JRuby on non-Windows platforms. #4 (Thanks, Tim Olsen!)
20
+
21
+
22
+ 0.0.4 - 1 Aug 2012
23
+ ----------
24
+
25
+ * Including `chromedriver-update` to easily allow people to force-upgrade. #3
26
+
27
+
28
+ 0.0.3 - 20 Mar 2012
29
+ ----------
30
+
31
+ * Updated download URL. #2 (Thanks, Alistair Hutchison!)
32
+
33
+
34
+ 0.0.2 - 6 December 2011
35
+ ----------
36
+
37
+ * Birthday!
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in chromedriver-helper.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # chromedriver-helper
2
+
3
+ [![Build status](https://api.travis-ci.org/flavorjones/chromedriver-helper.svg)](https://travis-ci.org/flavorjones/chromedriver-helper)
4
+
5
+ Easy installation and use of chromedriver, the Chromium project's
6
+ selenium webdriver adapter.
7
+
8
+ * [http://github.com/flavorjones/chromedriver-helper](http://github.com/flavorjones/chromedriver-helper)
9
+
10
+
11
+ # Description
12
+
13
+ `chromedriver-helper` installs an executable, `chromedriver`, in your
14
+ gem path.
15
+
16
+ This script will, if necessary, download the appropriate binary for
17
+ your platform and install it into `~/.chromedriver-helper`, then exec
18
+ it. Easy peasy!
19
+
20
+ chromedriver is fast. By my unscientific benchmark, it's around 20%
21
+ faster than webdriver + Firefox 8. You should use it!
22
+
23
+
24
+ # Usage
25
+
26
+ If you're using Bundler and Capybara, it's as easy as:
27
+
28
+ # Gemfile
29
+ gem "chromedriver-helper"
30
+
31
+ then, in your specs:
32
+
33
+ Capybara.register_driver :selenium do |app|
34
+ Capybara::Selenium::Driver.new(app, :browser => :chrome)
35
+ end
36
+
37
+
38
+ # Updating Chromedriver
39
+
40
+ If you'd like to force-upgrade to the latest version of chromedriver,
41
+ run the script `chromedriver-update` that also comes packaged with
42
+ this gem.
43
+
44
+ This might be necessary on platforms on which Chrome auto-updates,
45
+ which has been known to introduce incompatibilities with older
46
+ versions of chromedriver (see
47
+ [Issue #3](https://github.com/flavorjones/chromedriver-helper/issues/3)
48
+ for an example).
49
+
50
+
51
+ # Support
52
+
53
+ The code lives at
54
+ [http://github.com/flavorjones/chromedriver-helper](http://github.com/flavorjones/chromedriver-helper).
55
+ Open a Github Issue, or send a pull request! Thanks! You're the best.
56
+
57
+
58
+ # License
59
+
60
+ (The MIT License)
61
+
62
+ Copyright (c) 2011: [Mike Dalessio](http://mike.daless.io)
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining
65
+ a copy of this software and associated documentation files (the
66
+ 'Software'), to deal in the Software without restriction, including
67
+ without limitation the rights to use, copy, modify, merge, publish,
68
+ distribute, sublicense, and/or sell copies of the Software, and to
69
+ permit persons to whom the Software is furnished to do so, subject to
70
+ the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be
73
+ included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
76
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
77
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
78
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
79
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
80
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
81
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
82
+
83
+ # Credit
84
+
85
+ The idea for this gem comes from @brianhempel's project
86
+ `chromedriver-gem` which, despite the name, is not currently published
87
+ on http://rubygems.org/.
88
+
89
+ Some improvements on the idea were taken from the installation process
90
+ for standalone Phusion Passenger.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/chromedriver ADDED
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require "chromedriver/helper"
4
+
5
+ Chromedriver::Helper.new.run *ARGV
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require "chromedriver/helper"
4
+
5
+ Chromedriver::Helper.new.update
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "chromedriver/helper/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ikm-chromedriver-helper"
7
+ s.version = Chromedriver::Helper::VERSION
8
+ s.authors = ["Mike Dalessio"]
9
+ s.email = ["mike@csa.net"]
10
+ s.homepage = "https://github.com/a2ikm/chromedriver-helper"
11
+ s.summary = "Easy installation and use of chromedriver, the Chromium project's selenium webdriver adapter. Forked from chromedriver-helper."
12
+ s.description = "Easy installation and use of chromedriver, the Chromium project's selenium webdriver adapter. Forked from chromedriver-helper."
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_development_dependency "rspec", "~> 3.0"
20
+ s.add_development_dependency "rake"
21
+ s.add_runtime_dependency "nokogiri"
22
+ end
@@ -0,0 +1,28 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+ module Chromedriver
5
+ class Helper
6
+ class GoogleCodeParser
7
+ BUCKET_URL = 'http://chromedriver.storage.googleapis.com'
8
+
9
+ attr_reader :source, :platform
10
+
11
+ def initialize(platform, open_uri_provider=OpenURI)
12
+ @platform = platform
13
+ @source = open_uri_provider.open_uri(BUCKET_URL)
14
+ end
15
+
16
+ def downloads
17
+ doc = Nokogiri::XML.parse(source)
18
+ items = doc.css("Contents Key").collect {|k| k.text }
19
+ items.reject! {|k| !(/chromedriver_#{platform}/===k) }
20
+ items.map {|k| "#{BUCKET_URL}/#{k}"}
21
+ end
22
+
23
+ def newest_download
24
+ downloads.last
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module Chromedriver
2
+ class Helper
3
+ VERSION = "0.0.8"
4
+ end
5
+ end
@@ -0,0 +1,66 @@
1
+ require "chromedriver/helper/version"
2
+ require "chromedriver/helper/google_code_parser"
3
+ require 'fileutils'
4
+ require 'rbconfig'
5
+
6
+ module Chromedriver
7
+ class Helper
8
+
9
+ def run *args
10
+ download
11
+ exec binary_path, *args
12
+ end
13
+
14
+ def download hit_network=false
15
+ return if File.exists?(binary_path) && ! hit_network
16
+ url = download_url
17
+ filename = File.basename url
18
+ Dir.chdir platform_install_dir do
19
+ system "rm #{filename}"
20
+ system("wget -c -O #{filename} #{url}") || system("curl -C - -o #{filename} #{url}")
21
+ raise "Could not download #{url}" unless File.exists? filename
22
+ system "unzip -o #{filename}"
23
+ end
24
+ raise "Could not unzip #{filename} to get #{binary_path}" unless File.exists? binary_path
25
+ end
26
+
27
+ def update
28
+ download true
29
+ end
30
+
31
+ def download_url
32
+ GoogleCodeParser.new(platform).newest_download
33
+ end
34
+
35
+ def binary_path
36
+ if platform == "win"
37
+ File.join platform_install_dir, "chromedriver.exe"
38
+ else
39
+ File.join platform_install_dir, "chromedriver"
40
+ end
41
+ end
42
+
43
+ def platform_install_dir
44
+ dir = File.join install_dir, platform
45
+ FileUtils.mkdir_p dir
46
+ dir
47
+ end
48
+
49
+ def install_dir
50
+ dir = File.expand_path File.join(ENV['HOME'], ".chromedriver-helper")
51
+ FileUtils.mkdir_p dir
52
+ dir
53
+ end
54
+
55
+ def platform
56
+ cfg = RbConfig::CONFIG
57
+ case cfg['host_os']
58
+ when /linux/ then
59
+ cfg['host_cpu'] =~ /x86_64|amd64/ ? "linux64" : "linux32"
60
+ when /darwin/ then "mac"
61
+ else "win"
62
+ end
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1 @@
1
+ <?xml version='1.0' encoding='UTF-8'?><ListBucketResult xmlns='http://doc.s3.amazonaws.com/2006-03-01'><Name>chromedriver</Name><Prefix></Prefix><Marker></Marker><IsTruncated>false</IsTruncated><Contents><Key>2.0/chromedriver_linux32.zip</Key><Generation>1380149859530000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:39.349Z</LastModified><ETag>"c0d96102715c4916b872f91f5bf9b12c"</ETag><Size>7262134</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.0/chromedriver_linux64.zip</Key><Generation>1380149860664000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:40.449Z</LastModified><ETag>"858ebaf47e13dce7600191ed59974c09"</ETag><Size>7433593</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.0/chromedriver_mac32.zip</Key><Generation>1380149857425000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:37.204Z</LastModified><ETag>"efc13db5afc518000d886c2bdcb3a4bc"</ETag><Size>7614601</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.0/chromedriver_win32.zip</Key><Generation>1380149858370000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:38.165Z</LastModified><ETag>"bbf8fd0fe525a06dda162619cac2b200"</ETag><Size>3048831</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.1/chromedriver_linux32.zip</Key><Generation>1380149869675000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:49.481Z</LastModified><ETag>"1d7e908253f7240d1596332082cc5742"</ETag><Size>7197760</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.1/chromedriver_linux64.zip</Key><Generation>1380149870889000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:50.738Z</LastModified><ETag>"de406b5a1aac2bfb2f419ac01d7231e2"</ETag><Size>7367074</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.1/chromedriver_mac32.zip</Key><Generation>1380149867471000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:47.251Z</LastModified><ETag>"41d718a956392c78d788eedd2e0723a5"</ETag><Size>7611294</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.1/chromedriver_win32.zip</Key><Generation>1380149868374000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:48.143Z</LastModified><ETag>"d48fd6bce0c6131caa8aad6b5b02b9aa"</ETag><Size>2961443</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.2/chromedriver_linux32.zip</Key><Generation>1380149878519000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:58.374Z</LastModified><ETag>"801b9f6c28a32575d8eae2abb1cdecd5"</ETag><Size>7252879</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.2/chromedriver_linux64.zip</Key><Generation>1380149879600000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:59.432Z</LastModified><ETag>"d5b73ee424717e45601553e91e204ad6"</ETag><Size>7417835</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.2/chromedriver_mac32.zip</Key><Generation>1380149876563000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:56.408Z</LastModified><ETag>"e904e2ed0ebcc453492a9fe0550665ee"</ETag><Size>7634565</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.2/chromedriver_win32.zip</Key><Generation>1380149877467000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:57:57.313Z</LastModified><ETag>"c86ce20925db2d16118559cbe6693c6f"</ETag><Size>2978752</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.3/chromedriver_linux32.zip</Key><Generation>1380149888081000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:58:07.947Z</LastModified><ETag>"f3af4d92060e6d61c2d2ed86ad584246"</ETag><Size>7310301</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.3/chromedriver_linux64.zip</Key><Generation>1380149889817000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:58:09.620Z</LastModified><ETag>"1a816cc185a15af4d450805629790b0a"</ETag><Size>7481138</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.3/chromedriver_mac32.zip</Key><Generation>1380149885736000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:58:05.567Z</LastModified><ETag>"4d72ca0fa6dbddfa1e42dbd1ef0045cc"</ETag><Size>7678021</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.3/chromedriver_win32.zip</Key><Generation>1380149886823000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:58:06.499Z</LastModified><ETag>"3226a146a6b97f2a111d3b2be9b0193f"</ETag><Size>3001138</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.3/notes.txt</Key><Generation>1380149888474000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T22:58:08.474Z</LastModified><ETag>"3ddc6ac82f5acc8d248b117146ab9b1b"</ETag><Size>591</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.4/chromedriver_linux32.zip</Key><Generation>1380606156436000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-10-01T05:42:36.371Z</LastModified><ETag>"3f8ef2f01a7fb5805bed2d644569acba"</ETag><Size>7365316</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.4/chromedriver_linux64.zip</Key><Generation>1380605124572000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-10-01T05:25:24.406Z</LastModified><ETag>"5e70555cbbf75e3480dd1629a35bc7e3"</ETag><Size>7536826</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.4/chromedriver_mac32.zip</Key><Generation>1380615154239000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-10-01T08:12:34.120Z</LastModified><ETag>"0816b2a06428962b1a2da103eb59323c"</ETag><Size>7727580</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>2.4/chromedriver_win32.zip</Key><Generation>1380667399987000</Generation><MetaGeneration>1</MetaGeneration><LastModified>2013-10-01T22:43:19.814Z</LastModified><ETag>"0280d3a9e713a38216a4e34a9ec1fba2"</ETag><Size>2980414</Size><Owner><ID>00b4903a97c5747d42831d561f5c5006971ba7454104797e276e7489aa9357d7</ID></Owner></Contents><Contents><Key>2.4/notes.txt</Key><Generation>1380605131079000</Generation><MetaGeneration>4</MetaGeneration><LastModified>2013-10-01T05:25:31.079Z</LastModified><ETag>"91ac3af6739a33188186e16c6a76d179"</ETag><Size>1089</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>icons/back.gif</Key><Generation>1380130924972000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T17:42:04.972Z</LastModified><ETag>"4bce9846e05d3bffdfb293d47c840a8e"</ETag><Size>216</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>icons/binary.gif</Key><Generation>1380130933627000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T17:42:13.627Z</LastModified><ETag>"96bd4beed88ff93356586485c13e5d89"</ETag><Size>246</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>icons/blank.gif</Key><Generation>1380130941334000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T17:42:21.333Z</LastModified><ETag>"19517fb39a31be6b8d7ccf53ad84908f"</ETag><Size>148</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>icons/folder.gif</Key><Generation>1380130950680000</Generation><MetaGeneration>2</MetaGeneration><LastModified>2013-09-25T17:42:30.680Z</LastModified><ETag>"d342cba375fea336967317bdb5d7cf19"</ETag><Size>225</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents><Contents><Key>index.html</Key><Generation>1380128358912000</Generation><MetaGeneration>3</MetaGeneration><LastModified>2013-09-25T16:59:18.911Z</LastModified><ETag>"704b0f841aad1b1428481b7ff3c759c0"</ETag><Size>10574</Size><Owner><ID>00b4903a97149f98c03d9e192e5baa7ac7cdac7c396df4e4648822c1c13b5bcd</ID></Owner></Contents></ListBucketResult>