Sha256: 143c57679eb92bb7f88c119262de4ef7a24f6b3cd186afa5f74226d426069169
Contents?: true
Size: 688 Bytes
Versions: 22
Compression:
Stored size: 688 Bytes
Contents
#-- # Copyright (c) 2010-2012 Engine Yard, Inc. # Copyright (c) 2007-2009 Sun Microsystems, Inc. # This source code is available under the MIT license. # See the file LICENSE.txt for details. #++ module Warbler module PlatformHelper # Cross-platform way of finding an executable in the $PATH. # Thanks to @mislav # # which('ruby') #=> /usr/bin/ruby def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable? exe } end return nil end end end
Version data entries
22 entries across 22 versions & 2 rubygems