venetian 0.2.1 → 0.2.2

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: 45874ec60b54aad7880937459b50c7f6810caf8a4879136214b5b65420a7e8f1
4
- data.tar.gz: a578ee37916a536710644e91b58ea19e866104c0212a0f8a9ea3c073e05f2638
3
+ metadata.gz: 3ee00e1fcd1d1b3976326488aa3eaa280ef4f90d12df08f19dace106544caa9c
4
+ data.tar.gz: 424a96d951611a582d5308f8039757c5924eaf5d35bc9afa4b66ba4552285e09
5
5
  SHA512:
6
- metadata.gz: 1f6f8d0da92fd1efdc4d182147b379d94e7d6c7760d5616d50b9e0d64cfae9c6131dea3062dde8d9e02178821c4d9eefe052e32b0ab75285d4551a3f8df506e8
7
- data.tar.gz: 989463ee3ae50a4d9c543c9660c51f941dbf2a8ba60f0aee635642ef2c1b4705c35945b738421a84fc81fa6e9dcdc58d11445e34bc04b3f006dd087cf600e8d0
6
+ metadata.gz: 01ccabe77ade214053540011f0c57c13fde15ccd65417f932d10e0901d91f72ab38a48dcc73891eb4efb3cd7e7c877bd3e5787b84bd38cd677b42d13df989ecc
7
+ data.tar.gz: 332c96c6d356616a18f6c4ecb599bb18fa370ecd4038311052fd8a406f740cba29aac82d4376a0fd400bda460ee5906d34edf9dd565bf10e782e99d7b67420dc
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Venetian
2
2
 
3
3
  Want stable system tests with Playwright, but don't want a Heath Robinson/Rube Goldberg setup in CI to try to keep the Ruby gem and Node
4
- package in sync? This gem packages a Node executable plus the common Playwright package, using builds produced by Playwright for other
4
+ package in sync? This gem packages a Node executable plus the common Playwright package, in the same way Playwright is packaged for other
5
5
  languages.
6
6
 
7
7
  ## Installation
@@ -143,12 +143,16 @@ module Venetian
143
143
  return custom_exe_path if ENV.key?(INSTALL_DIR_ENV_VAR)
144
144
 
145
145
  Upstream::NATIVE_PLATFORMS.select { |platform, _| Gem::Platform.match_gem?(Gem::Platform.new(platform), gem_name) }
146
- .collect { |platform, _info| File.join(exe_dir, platform, "node") }
146
+ .collect { |platform, info| File.join(exe_dir, platform, info.executable_name) }
147
147
  .detect { |candidate| File.exist?(candidate) }
148
148
  end
149
149
 
150
150
  def custom_exe_path
151
- File.join(exe_dir, "node").then { |path| path if File.exist?(path) }
151
+ File.join(exe_dir, custom_exe_name).then { |path| path if File.exist?(path) }
152
+ end
153
+
154
+ def custom_exe_name
155
+ Gem.win_platform? ? "node.exe" : "node"
152
156
  end
153
157
 
154
158
  def gem_platforms_unsupported?
@@ -7,26 +7,43 @@ module Venetian
7
7
  #
8
8
  # Provides platform mappings and URLs for Playwright.
9
9
  module Upstream
10
- # map of gem platform strings to Playwright CDN platform strings and executable names inside the driver zip
11
- NATIVE_PLATFORMS = {
12
- "x86_64-linux" => "linux",
13
- "aarch64-linux" => "linux-arm64",
14
- "x86_64-darwin" => "mac",
15
- "arm64-darwin" => "mac-arm64",
16
- "x64-mingw-ucrt" => "win32_x64"
17
- }.freeze
18
-
19
- # base for driver download URLs
20
- BASE_URL = "https://playwright.azureedge.net/builds/driver"
21
-
22
- # Returns the URL to download the driver for the given platform.
23
- def self.driver_download_url(playwright_platform)
24
- "#{BASE_URL}/playwright-#{Playwright::COMPATIBLE_PLAYWRIGHT_VERSION}-#{playwright_platform}.zip"
10
+ # Describes how to assemble the Playwright driver for a single gem platform.
11
+ #
12
+ # +node_dir+:: the platform infix used in Node.js release archive names (e.g. "linux-x64")
13
+ # +windows+:: whether this platform's Node.js archive is a Windows build (.zip, node.exe)
14
+ PlatformInfo = Data.define(:node_dir, :windows) do
15
+ # Returns the filename of the Node executable inside the assembled driver.
16
+ def executable_name
17
+ windows ? "node.exe" : "node"
18
+ end
19
+
20
+ # Returns the file extension of the Node.js release archive for this platform.
21
+ def node_archive_extension
22
+ windows ? "zip" : "tar.gz"
23
+ end
24
+
25
+ # Returns the URL to download the Node.js release archive for the given version.
26
+ def node_url_for(version)
27
+ "#{NODE_DIST_URL}/v#{version}/node-v#{version}-#{node_dir}.#{node_archive_extension}"
28
+ end
25
29
  end
26
30
 
27
- # Returns a hash that maps platforms to download URLs.
28
- def self.download_urls
29
- NATIVE_PLATFORMS.transform_values { |value| driver_download_url(value) }
31
+ # map of gem platform strings to Node.js release info
32
+ NATIVE_PLATFORMS = { "x86_64-linux" => PlatformInfo.new(node_dir: "linux-x64", windows: false),
33
+ "aarch64-linux" => PlatformInfo.new(node_dir: "linux-arm64", windows: false),
34
+ "x86_64-darwin" => PlatformInfo.new(node_dir: "darwin-x64", windows: false),
35
+ "arm64-darwin" => PlatformInfo.new(node_dir: "darwin-arm64", windows: false),
36
+ "x64-mingw-ucrt" => PlatformInfo.new(node_dir: "win-x64", windows: true) }.freeze
37
+
38
+ # base for the npm registry, source of the playwright-core package
39
+ NPM_REGISTRY_URL = "https://registry.npmjs.org"
40
+
41
+ # base for Node.js release downloads
42
+ NODE_DIST_URL = "https://nodejs.org/dist"
43
+
44
+ # Returns the URL to download the playwright-core npm package containing the driver's JS sources.
45
+ def self.playwright_core_url
46
+ "#{NPM_REGISTRY_URL}/playwright-core/-/playwright-core-#{Playwright::COMPATIBLE_PLAYWRIGHT_VERSION}.tgz"
30
47
  end
31
48
 
32
49
  # Returns the gemspec files for the base gem.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Venetian
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  COMPATIBLE_PLAYWRIGHT_VERSION = "1.62.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venetian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Malčić