Skip to content

Commit 2af270d

Browse files
authored
Merge pull request #266 from rubycdp/ruby-2.6
Supported Ruby 2.6
2 parents 9d27ae0 + 73a360a commit 2af270d

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,20 @@ def prepare_paths
2727
[paths, exts]
2828
end
2929

30+
# rubocop:disable Style/CollectionCompact
3031
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)
32+
cmds.lazy.map do |cmd, path, ext|
33+
absolute_path = File.absolute_path(cmd)
34+
is_absolute_path = absolute_path == cmd
35+
cmd = File.expand_path("#{cmd}#{ext}", path) unless is_absolute_path
3336

3437
next unless File.executable?(cmd)
3538
next if File.directory?(cmd)
3639

3740
cmd
38-
end
41+
end.reject(&:nil?) # .compact isn't defined on Enumerator::Lazy
3942
end
43+
# rubocop:enable Style/CollectionCompact
4044
end
4145
end
4246
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)