Class: Extension::Tasks::ChooseNextAvailablePort

Inherits:
Object
  • Object
show all
Includes:
ShopifyCLI::MethodObject
Defined in:
lib/project_types/extension/tasks/choose_next_available_port.rb

Instance Method Summary collapse

Methods included from ShopifyCLI::MethodObject

included, #to_proc

Instance Method Details

#callObject

Raises:

  • (ArgumentError)


14
15
16
17
18
# File 'lib/project_types/extension/tasks/choose_next_available_port.rb', line 14

def call
  available_port = port_range(from: from, to: to).find { |p| available?(host, p) }
  raise ArgumentError, "Ports between #{from} and #{to} are unavailable" if available_port.nil?
  available_port
end