Class: PlaywrightRails::LaunchesPlaywright
- Inherits:
-
Object
- Object
- PlaywrightRails::LaunchesPlaywright
- Defined in:
- lib/playwright-rails/launches_playwright.rb
Instance Method Summary collapse
- #call(command, config = Config.new) ⇒ Object
-
#initialize ⇒ LaunchesPlaywright
constructor
A new instance of LaunchesPlaywright.
Constructor Details
#initialize ⇒ LaunchesPlaywright
Returns a new instance of LaunchesPlaywright.
9 10 11 12 13 14 |
# File 'lib/playwright-rails/launches_playwright.rb', line 9 def initialize @initializer_hooks = InitializerHooks.instance @manages_transactions = ManagesTransactions.instance @starts_rails_server = StartsRailsServer.new @finds_bin = FindsBin.new end |
Instance Method Details
#call(command, config = Config.new) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/playwright-rails/launches_playwright.rb', line 16 def call(command, config = Config.new) puts config.to_s @initializer_hooks.run(:before_server_start) if config.transactional_server @manages_transactions.begin_transaction end server = @starts_rails_server.call( host: config.host, port: config.port, transactional_server: config.transactional_server, ) bin = @finds_bin.call(config.dir) set_exit_hooks!(config) command = " BASE_URL=\"http://\#{server.host}:\#{server.port}\#{config.base_path}\" \"\#{bin}\" \#{command} \#{config.playwright_cli_opts}\n EXEC\n\n puts \"\\nLaunching Playwright\u2026\\n$ \#{command}\\n\"\n system command\nend\n" |