Class: Speednode::NodeCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/speednode/node_command.rb

Class Method Summary collapse

Class Method Details

.cached(command) ⇒ Object



14
15
16
# File 'lib/speednode/node_command.rb', line 14

def self.cached(command)
  @cached_command ||= which(command)
end

.which(command) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/speednode/node_command.rb', line 3

def self.which(command)
  Array(command).find do |name|
    name, args = name.split(/\s+/, 2)
    path = locate_executable(name)

    next unless path

    args ? "#{path} #{args}" : path
  end
end