Skip to content

Commit

Permalink
Move websocket dependency to selenium-devtools gem
Browse files Browse the repository at this point in the history
Even though Selenium::WebDriver::DevTools actively uses WebSocket gem,
it cannot be loaded and work without first requiring selenium-devtools
gem. However, if the user doesn't intend to use
Selenium::WebDriver::DevTools, there is no need for them to even install
websocket gem. Hence, it makes sense to actually move this dependency
into selenium-devtools gem.
  • Loading branch information
p0deje committed May 3, 2021
1 parent 8d80348 commit 973ab84
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion rb/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# frozen_string_literal: true

source 'https://rubygems.org'
gemspec name: 'selenium-webdriver'
Dir["#{__dir__}/*.gemspec"].each do |spec|
gemspec name: File.basename(spec, '.gemspec')
end
9 changes: 7 additions & 2 deletions rb/build.desc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rubygem(
]
)

rubydevtoolsgem(
rubygem(
gemspec = "build/rb/selenium-devtools.gemspec",
name = "devtools",
deps = [
Expand Down Expand Up @@ -90,6 +90,7 @@ ruby_test(name = "chrome",
],
deps = [
":chrome",
":devtools",
":bidi"
]
)
Expand All @@ -106,6 +107,7 @@ ruby_test(name = "remote-chrome",
],
deps = [
":chrome",
":devtools",
":bidi",
":remote"
]
Expand All @@ -130,6 +132,7 @@ ruby_test(name = "edge",
],
deps = [
":edge",
":devtools",
":bidi"
]
)
Expand All @@ -146,6 +149,7 @@ ruby_test(name = "remote-edge",
],
deps = [
":edge",
":devtools",
":bidi",
":remote"
]
Expand Down Expand Up @@ -182,6 +186,7 @@ ruby_test(name = "firefox-nightly",
],
deps = [
":firefox",
":devtools",
":bidi"
]
)
Expand Down Expand Up @@ -327,7 +332,6 @@ ruby_library(name = "bidi",
],
deps = [
":common",
":devtools"
],
resources = [
{ "../javascript/cdp-support/mutation-listener.js": "rb/lib/selenium/webdriver/atoms/mutationListener.js" }
Expand All @@ -339,6 +343,7 @@ ruby_library(name = "devtools",
"selenium-devtools.gemspec",
"lib/selenium/devtools.rb",
"lib/selenium/devtools/version.rb",
"Gemfile",
"NOTICE",
"CHANGES",
"README.md"
Expand Down
2 changes: 2 additions & 0 deletions rb/lib/selenium/devtools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# specific language governing permissions and limitations
# under the License.

require 'websocket'

module Selenium
module DevTools
class << self
Expand Down
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
require 'date'
require 'json'
require 'set'
require 'websocket'

require 'selenium/webdriver/atoms'
require 'selenium/webdriver/common'
Expand Down
2 changes: 2 additions & 0 deletions rb/selenium-devtools.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ Gem::Specification.new do |s|

s.files = Dir.glob('{lib/selenium/devtools}/**/*')
s.require_paths = ["lib"]

s.add_runtime_dependency 'websocket', ['~> 1.0']
end
1 change: 0 additions & 1 deletion rb/selenium-webdriver.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 5.0']
s.add_runtime_dependency 'rexml', ['~> 3.2']
s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']
s.add_runtime_dependency 'websocket', ['~> 1.0']

# childprocess requires ffi on windows but doesn't declare it in its dependencies
s.add_development_dependency 'ffi'
Expand Down

0 comments on commit 973ab84

Please sign in to comment.