Module: Venetian::Upstream
- Defined in:
- lib/venetian/upstream.rb
Overview
# Upstream
Provides platform mappings and URLs for Playwright.
Constant Summary collapse
- NATIVE_PLATFORMS =
map of gem platform strings to Playwright CDN platform strings and executable names inside the driver zip
{ "x86_64-linux" => "linux", "aarch64-linux" => "linux-arm64", "x86_64-darwin" => "mac", "arm64-darwin" => "mac-arm64", "x64-mingw-ucrt" => "win32_x64" }.freeze
- BASE_URL =
base for driver download URLs
"https://playwright.azureedge.net/builds/driver"
Class Method Summary collapse
-
.base_files ⇒ Object
Returns the gemspec files for the base gem.
-
.build_gemspec_for(platform) ⇒ Object
Builds a gemspec for the given platform, adding the files currently in the native platform directory.
-
.download_urls ⇒ Object
Returns a hash that maps platforms to download URLs.
-
.driver_download_url(playwright_platform) ⇒ Object
Returns the URL to download the driver for the given platform.
Class Method Details
.base_files ⇒ Object
Returns the gemspec files for the base gem.
33 34 35 |
# File 'lib/venetian/upstream.rb', line 33 def self.base_files GEMSPEC.files end |
.build_gemspec_for(platform) ⇒ Object
Builds a gemspec for the given platform, adding the files currently in the native platform directory.
38 39 40 41 42 43 |
# File 'lib/venetian/upstream.rb', line 38 def self.build_gemspec_for(platform) GEMSPEC.dup.tap do |s| s.platform = platform s.files += Dir["exe/#{platform}/**/*"] end end |
.download_urls ⇒ Object
Returns a hash that maps platforms to download URLs.
28 29 30 |
# File 'lib/venetian/upstream.rb', line 28 def self.download_urls NATIVE_PLATFORMS.transform_values { |value| driver_download_url(value) } end |
.driver_download_url(playwright_platform) ⇒ Object
Returns the URL to download the driver for the given platform.
23 24 25 |
# File 'lib/venetian/upstream.rb', line 23 def self.driver_download_url(playwright_platform) "#{BASE_URL}/playwright-#{Playwright::COMPATIBLE_PLAYWRIGHT_VERSION}-#{playwright_platform}.zip" end |