Skip to content

Commit ad05497

Browse files
committed
Supported Ruby 2.6
1 parent 9d27ae0 commit ad05497

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x]
15-
ruby: [2.7, 3.0, 3.1]
15+
ruby: [2.6, 2.7, 3.0, 3.1]
1616
runs-on: ubuntu-latest
1717
env:
1818
FERRUM_PROCESS_TIMEOUT: 20

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.7
2+
TargetRubyVersion: 2.6
33
NewCops: enable
44

55
Layout/FirstArrayElementIndentation:

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ a block with this page, after which the page is closed.
2828
### Changed
2929

3030
- Use `Concurrent::MVar` as `execution_id` in `Ferrum::Frame`
31-
- Min Ruby version >= 2.7
31+
- Min Ruby version is 2.6 and 3.0 is supported
3232
- `Ferrum::Page#bypass_csp` accepts hash as argument `enabled: true` by default
3333
- `Ferrum::Context#has_target?` -> `Ferrum::Context#target?`
3434
- We now start looking for Chrome first instead of Chromium, the order for checking binaries has changed

ferrum.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323
"rubygems_mfa_required" => "true"
2424
}
2525

26-
s.required_ruby_version = ">= 2.7.0"
26+
s.required_ruby_version = ">= 2.6.0"
2727

2828
s.add_runtime_dependency "addressable", "~> 2.5"
2929
s.add_runtime_dependency "concurrent-ruby", "~> 1.1"

lib/ferrum/browser/binary.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ def prepare_paths
2828
end
2929

3030
def lazy_find(cmds)
31-
cmds.lazy.filter_map do |cmd, path, ext|
32-
cmd = File.expand_path("#{cmd}#{ext}", path) unless File.absolute_path?(cmd)
31+
cmds.lazy.map do |cmd, path, ext|
32+
absolute_path = File.absolute_path(cmd)
33+
is_absolute_path = absolute_path == cmd
34+
cmd = File.expand_path("#{cmd}#{ext}", path) unless is_absolute_path
3335

3436
next unless File.executable?(cmd)
3537
next if File.directory?(cmd)
3638

3739
cmd
38-
end
40+
end.reject(&:nil?)
3941
end
4042
end
4143
end

spec/browser/binary_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class Browser
4545
expect(Binary.find(%w[bin4])).to eq(bin4_exe)
4646
end
4747

48+
it "finds binary with absolute path" do
49+
expect(Binary.find(bin4_exe)).to eq(bin4_exe)
50+
end
51+
4852
it "finds binary without ext" do
4953
ENV["PATHEXT"] = ".com;.exe"
5054

0 commit comments

Comments
 (0)