Skip to content

Commit

Permalink
rb - remove code supporting Ruby versions < 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Mar 27, 2016
1 parent fa5ac92 commit d4a7519
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 172 deletions.
5 changes: 2 additions & 3 deletions rb/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# selenium-webdriver

This gem provides Ruby bindings for WebDriver
and has been tested to work on MRI (1.9.2 through 2.1),
JRuby and Rubinius.
and has been tested to work on MRI (2.0 through 2.2),

## Install

Expand All @@ -17,7 +16,7 @@ JRuby and Rubinius.

## License

Copyright 2009-2015 Software Freedom Conservancy
Copyright 2009-2016 Software Freedom Conservancy

Licensed to the Software Freedom Conservancy (SFC) under one
or more contributor license agreements. See the NOTICE file
Expand Down
2 changes: 0 additions & 2 deletions rb/lib/selenium/webdriver/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# specific language governing permissions and limitations
# under the License.

require 'selenium/webdriver/common/core_ext/dir'
require 'selenium/webdriver/common/core_ext/base64'
require 'selenium/webdriver/common/w3c_error'
require 'selenium/webdriver/common/error'
require 'selenium/webdriver/common/platform'
Expand Down
28 changes: 0 additions & 28 deletions rb/lib/selenium/webdriver/common/core_ext/base64.rb

This file was deleted.

61 changes: 0 additions & 61 deletions rb/lib/selenium/webdriver/common/core_ext/dir.rb

This file was deleted.

3 changes: 1 addition & 2 deletions rb/lib/selenium/webdriver/common/html5/shared_web_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def fetch(key, &blk)
if block_given?
yield key
else
# should be KeyError, but it's 1.9-specific
raise IndexError, "missing key #{key.inspect}"
raise KeyError, "missing key #{key.inspect}"
end
end

Expand Down
127 changes: 63 additions & 64 deletions rb/lib/selenium/webdriver/common/keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,70 +27,69 @@ module Keys
#

KEYS = {
# \x works on both 1.8.6/1.9
:null => "\xEE\x80\x80",
:cancel => "\xEE\x80\x81",
:help => "\xEE\x80\x82",
:backspace => "\xEE\x80\x83",
:tab => "\xEE\x80\x84",
:clear => "\xEE\x80\x85",
:return => "\xEE\x80\x86",
:enter => "\xEE\x80\x87",
:shift => "\xEE\x80\x88",
:left_shift => "\xEE\x80\x88",
:control => "\xEE\x80\x89",
:left_control => "\xEE\x80\x89",
:alt => "\xEE\x80\x8A",
:left_alt => "\xEE\x80\x8A",
:pause => "\xEE\x80\x8B",
:escape => "\xEE\x80\x8C",
:space => "\xEE\x80\x8D",
:page_up => "\xEE\x80\x8E",
:page_down => "\xEE\x80\x8F",
:end => "\xEE\x80\x90",
:home => "\xEE\x80\x91",
:left => "\xEE\x80\x92",
:arrow_left => "\xEE\x80\x92",
:up => "\xEE\x80\x93",
:arrow_up => "\xEE\x80\x93",
:right => "\xEE\x80\x94",
:arrow_right => "\xEE\x80\x94",
:down => "\xEE\x80\x95",
:arrow_down => "\xEE\x80\x95",
:insert => "\xEE\x80\x96",
:delete => "\xEE\x80\x97",
:semicolon => "\xEE\x80\x98",
:equals => "\xEE\x80\x99",
:numpad0 => "\xEE\x80\x9A",
:numpad1 => "\xEE\x80\x9B",
:numpad2 => "\xEE\x80\x9C",
:numpad3 => "\xEE\x80\x9D",
:numpad4 => "\xEE\x80\x9E",
:numpad5 => "\xEE\x80\x9F",
:numpad6 => "\xEE\x80\xA0",
:numpad7 => "\xEE\x80\xA1",
:numpad8 => "\xEE\x80\xA2",
:numpad9 => "\xEE\x80\xA3",
:multiply => "\xEE\x80\xA4",
:add => "\xEE\x80\xA5",
:separator => "\xEE\x80\xA6",
:subtract => "\xEE\x80\xA7",
:decimal => "\xEE\x80\xA8",
:divide => "\xEE\x80\xA9",
:f1 => "\xEE\x80\xB1",
:f2 => "\xEE\x80\xB2",
:f3 => "\xEE\x80\xB3",
:f4 => "\xEE\x80\xB4",
:f5 => "\xEE\x80\xB5",
:f6 => "\xEE\x80\xB6",
:f7 => "\xEE\x80\xB7",
:f8 => "\xEE\x80\xB8",
:f9 => "\xEE\x80\xB9",
:f10 => "\xEE\x80\xBA",
:f11 => "\xEE\x80\xBB",
:f12 => "\xEE\x80\xBC",
:meta => "\xEE\x80\xBD",
:command => "\xEE\x80\xBD" # alias
:null => "\ue000",
:cancel => "\ue001",
:help => "\ue002",
:backspace => "\ue003",
:tab => "\ue004",
:clear => "\ue005",
:return => "\ue006",
:enter => "\ue007",
:shift => "\ue008",
:left_shift => "\ue008",
:control => "\ue009",
:left_control => "\ue009",
:alt => "\ue00A",
:left_alt => "\ue00A",
:pause => "\ue00B",
:escape => "\ue00C",
:space => "\ue00D",
:page_up => "\ue00E",
:page_down => "\ue00F",
:end => "\ue010",
:home => "\ue011",
:left => "\ue012",
:arrow_left => "\ue012",
:up => "\ue013",
:arrow_up => "\ue013",
:right => "\ue014",
:arrow_right => "\ue014",
:down => "\ue015",
:arrow_down => "\ue015",
:insert => "\ue016",
:delete => "\ue017",
:semicolon => "\ue018",
:equals => "\ue019",
:numpad0 => "\ue01A",
:numpad1 => "\ue01B",
:numpad2 => "\ue01C",
:numpad3 => "\ue01D",
:numpad4 => "\ue01E",
:numpad5 => "\ue01F",
:numpad6 => "\ue020",
:numpad7 => "\ue021",
:numpad8 => "\ue022",
:numpad9 => "\ue023",
:multiply => "\ue024",
:add => "\ue025",
:separator => "\ue026",
:subtract => "\ue027",
:decimal => "\ue028",
:divide => "\ue029",
:f1 => "\ue031",
:f2 => "\ue032",
:f3 => "\ue033",
:f4 => "\ue034",
:f5 => "\ue035",
:f6 => "\ue036",
:f7 => "\ue037",
:f8 => "\ue038",
:f9 => "\ue039",
:f10 => "\ue03A",
:f11 => "\ue03B",
:f12 => "\ue03C",
:meta => "\ue03D",
:command => "\ue03D" # alias
}

#
Expand Down
1 change: 1 addition & 0 deletions rb/lib/selenium/webdriver/common/zipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require 'zip'
require 'tempfile'
require 'find'
require 'base64'

module Selenium
module WebDriver
Expand Down
9 changes: 2 additions & 7 deletions rb/lib/selenium/webdriver/safari/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def process_initial_http_request

def process_handshake
@ws = @server.accept
hs = WebSocket::Handshake::Server.new
hs = WebSocket::Handshake::Server.new

req = ''
until hs.finished?
Expand Down Expand Up @@ -159,12 +159,7 @@ def process_handshake
end

def encode_form_component(str)
if URI.respond_to?(:encode_www_form_component) # >= 1.9
URI.encode_www_form_component(str)
else
# best effort for 1.8
str.gsub(":", '%3A').gsub('/', '%2F')
end
URI.encode_www_form_component(str)
end

private
Expand Down
4 changes: 2 additions & 2 deletions rb/lib/selenium/webdriver/support/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Color
RGB_PCT_PATTERN = /^\s*rgb\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$/
RGBA_PATTERN = /^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0\.\d+)\s*\)\s*$/
RGBA_PCT_PATTERN = /^\s*rgba\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,\s*(0|1|0\.\d+)\s*\)\s*$/
HEX_PATTERN = /#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})/ # \p{XDigit} or \h only works on Ruby 1.9
HEX3_PATTERN = /#([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])/ # \p{XDigit} or \h only works on Ruby 1.9
HEX_PATTERN = /#(\h{2})(\h{2})(\h{2})/
HEX3_PATTERN = /#(\h)(\h)(\h)/
HSL_PATTERN = /^\s*hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)\s*$/
HSLA_PATTERN = /^\s*hsla\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*,\s*(0|1|0\.\d+)\s*\)\s*$/

Expand Down
6 changes: 3 additions & 3 deletions rb/selenium-webdriver.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Gem::Specification.new do |s|
s.name = "selenium-webdriver"
s.version = "3.0.0dev"

s.authors = ["Jari Bakken"]
s.email = "jari.bakken@gmail.com"
s.authors = ['Alex Rodionov', 'Titus Fortner']
s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
s.description = "WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application."
s.summary = "The next generation developer focused tool for automated testing of webapps"
s.homepage = "https://github.com/seleniumhq/selenium"
s.licenses = ["Apache"]

s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
s.required_ruby_version = Gem::Requirement.new(">= 2.0")

s.files = Dir[root + '/**/*'].reject { |e| e =~ /ruby\.iml|build\.desc/ }.map { |e| e.sub(root + '/', '') }
s.require_paths = ["lib"]
Expand Down

0 comments on commit d4a7519

Please sign in to comment.