capybara-lightpanda 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0295a232795b3fee642523097324529b501ca520427691642949f59815794bb9'
4
- data.tar.gz: 8469cceee8e75e2d1f12f6be8528c2d80081aabb096aa0deb84bae9a2467d7b3
3
+ metadata.gz: 8d8e1d17876b5bb6bc851b841e43c5abca5d3dc6d6b491acedfc571f0022de4a
4
+ data.tar.gz: 01f631fdae83149cf643d2bffb28ff5abf21dae55fea7afec0c40b06704eea61
5
5
  SHA512:
6
- metadata.gz: f233ff2cb0f5d1f6c146c1a417360ee7f2ef630f0d82bade3afd13176ee940629254cca842ea04762d174f00a595c7950a40ceb88cc4026dc3708b90675e3750
7
- data.tar.gz: '0748a7f1786f2eded7256a9d4106ead5da15abf5be28966e4c5525f600b6a9000f11bc878b2697c1f85e315d524cc5569938c38bf2c12c6aa53bb24f7ed3c2b8'
6
+ metadata.gz: 9479e55672546d80256ace5e39fb9bf3639d2fec1cd554e1977a0a627990036cced67fbfae8e3467388ac7b9140d82c74aac21a684c98da9e3e45e4aa688eb55
7
+ data.tar.gz: 93fd13d1409125462b7931db7cc2b249916c7a05465c656492b89dac0ef137824dcd4a682e3a6df91657d34f2e0f22502faef0e13c9b79b3ddedd171cec4f345
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.1] - 2026-05-19
4
+
5
+ ### Fixed
6
+
7
+ - The gem now picks up a pre-installed `lightpanda` from `PATH` (e.g. `brew install lightpanda-io/lightpanda/lightpanda` or a manual `curl` install) instead of always re-downloading the nightly binary into `~/.cache/lightpanda/`. Test suites that block outbound HTTP via VCR/WebMock no longer crash on the surprise GET to `github.com` the first time the driver starts. Auto-download still kicks in if no `lightpanda` is on `PATH` and the gem cache is empty/stale, so default setups are unaffected.
8
+
3
9
  ## [0.4.0] - 2026-05-17
4
10
 
5
11
  > **Update Lightpanda before upgrading.** Requires a nightly build ≥ 6269 (published 2026-05-16 or later). The driver refuses to start against older binaries.
@@ -71,7 +71,10 @@ module Capybara
71
71
  # Canonical entrypoint: ensure the binary at install_path is current,
72
72
  # download if needed, return its path. Pinned (required_version set)
73
73
  # never re-downloads when present. Unpinned re-downloads when older
74
- # than cache_time.
74
+ # than cache_time. When unpinned and the gem cache is empty/stale,
75
+ # an already-installed `lightpanda` on PATH (e.g. via Homebrew) wins
76
+ # over re-downloading — keeps test suites running under VCR/WebMock
77
+ # from triggering surprise HTTP to github.com.
75
78
  def update
76
79
  destination = install_path
77
80
 
@@ -80,11 +83,19 @@ module Capybara
80
83
  log("Pinned #{required_version} present at #{destination}")
81
84
  return destination
82
85
  end
83
- elsif cached_fresh?(destination)
86
+ return download
87
+ end
88
+
89
+ if cached_fresh?(destination)
84
90
  log("Cached binary at #{destination} is fresh (< #{cache_time}s)")
85
91
  return destination
86
92
  end
87
93
 
94
+ if (system_path = system_binary_path)
95
+ log("Using lightpanda from PATH at #{system_path}")
96
+ return system_path
97
+ end
98
+
88
99
  download
89
100
  end
90
101
 
@@ -180,6 +191,20 @@ module Capybara
180
191
 
181
192
  private
182
193
 
194
+ # Scan ENV["PATH"] for an executable `lightpanda`. Returns the first
195
+ # match (PATH order), or nil. Lets `brew install lightpanda-io/
196
+ # lightpanda/lightpanda` (and Linux package installs at /usr/local/bin)
197
+ # short-circuit the auto-download path in `update`.
198
+ def system_binary_path
199
+ ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).each do |dir|
200
+ next if dir.empty?
201
+
202
+ candidate = File.join(dir, "lightpanda")
203
+ return candidate if File.file?(candidate) && File.executable?(candidate)
204
+ end
205
+ nil
206
+ end
207
+
183
208
  def cached_fresh?(path)
184
209
  return false unless File.executable?(path)
185
210
  return true if cache_time.zero?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Lightpanda
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-lightpanda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid Emad