Class: Playwright::CLI::Commands::Generate::Command

Inherits:
Object
  • Object
show all
Includes:
Utils::Ask, Utils::Display, Utils::FileManager
Defined in:
lib/playwright/cli/commands/generate/command.rb

Constant Summary collapse

TEMPLATE_FILE =
'new_script.erb'.freeze
PATH_BIN_DIR =
Pathname.new(File.join('/', 'usr', 'local', 'bin'))

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::FileManager

#file_manager

Methods included from Utils::Ask

#ask

Methods included from Utils::Display

#display

Constructor Details

#initialize(name, type) ⇒ Command

Returns a new instance of Command.



21
22
23
24
# File 'lib/playwright/cli/commands/generate/command.rb', line 21

def initialize(name, type)
  @name = name
  @type = type
end

Class Method Details

.run(name, type) ⇒ Object



17
18
19
# File 'lib/playwright/cli/commands/generate/command.rb', line 17

def self.run(name, type)
  new(name, type).run
end

Instance Method Details

#runObject



26
27
28
# File 'lib/playwright/cli/commands/generate/command.rb', line 26

def run
  file_manager.install_script script_name: @name, type: @type
end