chromedriver2-helper 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
7
7
  s.version = Chromedriver::Helper::VERSION
8
8
  s.authors = ["Mike Dalessio","Zsolt Sztupak"]
9
9
  s.email = ["mike@csa.net","mail@sztupy.hu"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/sztupy/chromedriver-helper"
11
11
  s.summary = "Easy installation and use of chromedriver2, the Chromium project's selenium webdriver adapter."
12
- s.description = "Easy installation and use of chromedriver2, the Chromium project's selenium webdriver adapter."
12
+ s.description = "Downloads and installs chromedriver2 from google's page and uses it for running the selenium tests. Contains fixes for mac builds, and changes to the google URLs"
13
13
 
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,12 +1,10 @@
1
1
  require "chromedriver2/helper/version"
2
2
  require "chromedriver2/helper/google_code_parser"
3
3
  require 'fileutils'
4
- require 'open-uri'
5
4
  require 'rbconfig'
6
5
 
7
6
  module Chromedriver
8
7
  class Helper
9
- DOWNLOAD_URL = "http://code.google.com/p/chromedriver/downloads/list"
10
8
 
11
9
  def run *args
12
10
  download
@@ -18,11 +16,10 @@ module Chromedriver
18
16
  url = download_url
19
17
  filename = File.basename url
20
18
  Dir.chdir platform_install_dir do
21
- unless File.exists? filename
22
- system("wget -c -O #{filename} #{url}") || system("curl -C - -o #{filename} #{url}")
23
- raise "Could not download #{url}" unless File.exists? filename
24
- system "unzip -o #{filename}"
25
- end
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}"
26
23
  end
27
24
  raise "Could not unzip #{filename} to get #{binary_path}" unless File.exists? binary_path
28
25
  end
@@ -32,10 +29,7 @@ module Chromedriver
32
29
  end
33
30
 
34
31
  def download_url
35
- downloads = GoogleCodeParser.new(open(DOWNLOAD_URL)).downloads
36
- url = downloads.grep(/chromedriver2?_#{platform}_.*\.zip/).first
37
- url = "http:#{url}" if url !~ /^http/
38
- url
32
+ GoogleCodeParser.new(platform).newest_download
39
33
  end
40
34
 
41
35
  def binary_path
@@ -43,7 +37,7 @@ module Chromedriver
43
37
  end
44
38
 
45
39
  def platform_install_dir
46
- dir = File.join install_dir, platform
40
+ dir = File.join install_dir, platform.gsub('?','')
47
41
  FileUtils.mkdir_p dir
48
42
  dir
49
43
  end
@@ -1,17 +1,27 @@
1
1
  require 'nokogiri'
2
+ require 'open-uri'
2
3
 
3
4
  module Chromedriver
4
5
  class Helper
5
6
  class GoogleCodeParser
6
- attr_reader :html
7
+ BUCKET_URL = 'http://chromedriver.storage.googleapis.com'
7
8
 
8
- def initialize html
9
- @html = html
9
+ attr_reader :source, :platform
10
+
11
+ def initialize(platform)
12
+ @platform = platform
13
+ @source = open(BUCKET_URL)
10
14
  end
11
15
 
12
16
  def downloads
13
- doc = Nokogiri::HTML html
14
- doc.css("td.vt a[@title=Download]").collect {|_| _["href"]}
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
15
25
  end
16
26
  end
17
27
  end
@@ -1,5 +1,5 @@
1
1
  module Chromedriver
2
2
  class Helper
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  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>
@@ -1,27 +1,25 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Chromedriver::Helper::GoogleCodeParser do
4
- describe ".new" do
5
- it "takes HTML" do
6
- html = "<html><body><div>hello</div></body></html>"
7
- parser = Chromedriver::Helper::GoogleCodeParser.new html
8
- parser.html.should == html
9
- end
4
+ before(:each) do
5
+ Chromedriver::Helper::GoogleCodeParser.any_instance.stub(:open).and_return(File.read(File.join(File.dirname(__FILE__), "assets/google-code-bucket.xml")))
10
6
  end
7
+ let!(:parser) { Chromedriver::Helper::GoogleCodeParser.new('mac') }
11
8
 
12
9
  describe "#downloads" do
13
- it "returns a hash of names and urls" do
14
- parser = Chromedriver::Helper::GoogleCodeParser.new File.read(File.join(File.dirname(__FILE__), "assets/google-code.html"))
10
+ it "returns an array of URLs for the platform" do
15
11
  parser.downloads.should == [
16
- "//chromium.googlecode.com/files/chromedriver2_win_16.0.902.0.zip",
17
- "//chromium.googlecode.com/files/chromedriver2_mac32_16.0.902.0.zip",
18
- "//chromium.googlecode.com/files/chromedriver2_linux64_16.0.902.0.zip",
19
- "//chromium.googlecode.com/files/chromedriver2_linux32_16.0.902.0.zip",
20
- "//chromium.googlecode.com/files/Chrome552.215.exe",
21
- "//chromium.googlecode.com/files/Chrome517.41.exe",
22
- "//chromium.googlecode.com/files/codesite.crx",
23
- "//chromium.googlecode.com/files/chromecomicJPGS.zip"
24
- ]
12
+ "http://chromedriver.storage.googleapis.com/2.0/chromedriver_mac32.zip",
13
+ "http://chromedriver.storage.googleapis.com/2.1/chromedriver_mac32.zip",
14
+ "http://chromedriver.storage.googleapis.com/2.2/chromedriver_mac32.zip",
15
+ "http://chromedriver.storage.googleapis.com/2.3/chromedriver_mac32.zip",
16
+ "http://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip"]
17
+ end
18
+ end
19
+
20
+ describe "#newest_download" do
21
+ it "returns the last URL for the platform" do
22
+ parser.newest_download.should == "http://chromedriver.storage.googleapis.com/2.4/chromedriver_mac32.zip"
25
23
  end
26
24
  end
27
25
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chromedriver2-helper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Dalessio
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-07-18 00:00:00 Z
19
+ date: 2013-11-11 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rspec
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: "0"
47
47
  type: :runtime
48
48
  version_requirements: *id002
49
- description: Easy installation and use of chromedriver2, the Chromium project's selenium webdriver adapter.
49
+ description: Downloads and installs chromedriver2 from google's page and uses it for running the selenium tests. Contains fixes for mac builds, and changes to the google URLs
50
50
  email:
51
51
  - mike@csa.net
52
52
  - mail@sztupy.hu
@@ -69,10 +69,11 @@ files:
69
69
  - lib/chromedriver2/helper.rb
70
70
  - lib/chromedriver2/helper/google_code_parser.rb
71
71
  - lib/chromedriver2/helper/version.rb
72
+ - spec/assets/google-code-bucket.xml
72
73
  - spec/assets/google-code.html
73
74
  - spec/google_code_parser_spec.rb
74
75
  - spec/spec_helper.rb
75
- homepage: ""
76
+ homepage: https://github.com/sztupy/chromedriver-helper
76
77
  licenses: []
77
78
 
78
79
  post_install_message:
@@ -106,6 +107,7 @@ signing_key:
106
107
  specification_version: 3
107
108
  summary: Easy installation and use of chromedriver2, the Chromium project's selenium webdriver adapter.
108
109
  test_files:
110
+ - spec/assets/google-code-bucket.xml
109
111
  - spec/assets/google-code.html
110
112
  - spec/google_code_parser_spec.rb
111
113
  - spec/spec_helper.rb