module Aptible::CLI::Helpers::System

Public Instance Methods

ask_then_line(*args) click to toggle source
# File lib/aptible/cli/helpers/system.rb, line 18
def ask_then_line(*args)
  ret = ask(*args)
  puts ''
  ret
end
which(cmd) click to toggle source
# File lib/aptible/cli/helpers/system.rb, line 5
def which(cmd)
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']

  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{cmd}#{ext}")
      return exe if File.executable?(exe) && !File.directory?(exe)
    end
  end

  nil
end