Module: Venetian::Executable
- Defined in:
- lib/venetian/executable.rb
Overview
# Executable
Provides methods for locating the Playwright executable.
Defined Under Namespace
Classes: ExecutableNotFoundError, UnsupportedPlatformError
Constant Summary collapse
- DEFAULT_DIR =
:nodoc:
File.(File.join(__dir__, "..", "..", "exe"))
- INSTALL_DIR_ENV_VAR =
:nodoc:
"VENETIAN_INSTALL_DIR"
Class Method Summary collapse
-
.base_command ⇒ Object
Returns the base command to execute Playwright.
-
.execute(*args, echo: true) ⇒ Object
Executes the Playwright executable with the given arguments.
-
.path ⇒ Object
Returns the path to the Node executable.
-
.system(*args, echo: true) ⇒ Object
Runs the Playwright executable with the given arguments.
Class Method Details
.base_command ⇒ Object
Returns the base command to execute Playwright.
104 105 106 |
# File 'lib/venetian/executable.rb', line 104 def base_command [path, File.join(File.dirname(path), "package", "cli.js")] end |
.execute(*args, echo: true) ⇒ Object
Executes the Playwright executable with the given arguments.
85 86 87 88 89 90 91 92 93 |
# File 'lib/venetian/executable.rb', line 85 def execute(*args, echo: true) [base_command, *args].then do |command| puts command.inspect if echo # due to mysterious Windows behavior; see equivalent in `tailwindcss-ruby` next system(*command, exception: true) if Gem.win_platform? exec(*command) end end |
.path ⇒ Object
Returns the path to the Node executable. Raises an error if the executable cannot be found.
76 77 78 79 80 81 82 |
# File 'lib/venetian/executable.rb', line 76 def path ensure_exe_dir_exists! ensure_gem_platform_supported! unless ENV.key?(INSTALL_DIR_ENV_VAR) ensure_executable_exists! exe_path end |
.system(*args, echo: true) ⇒ Object
Runs the Playwright executable with the given arguments.
96 97 98 99 100 101 |
# File 'lib/venetian/executable.rb', line 96 def system(*args, echo: true, **) [*base_command, *args].then do |command| puts command.inspect if echo super(*command, exception: true) end end |