Sha256: 9eaac677c86b0db7af42289bb51e5364e2dd744850528f18f7e9de25f36c8d7c
Contents?: true
Size: 733 Bytes
Versions: 5
Compression:
Stored size: 733 Bytes
Contents
require 'securerandom' module Foreman module Util # searches for binaries in predefined directories and user PATH # accepts a binary name and an array of paths to search first # if path is omitted will search only in user PATH def which(bin, *path) path += ENV['PATH'].split(File::PATH_SEPARATOR) path.flatten.uniq.each do |dir| dest = File.join(dir, bin) return dest if FileTest.file? dest and FileTest.executable? dest end return false rescue StandardError => e logger.warn e return false end # Generates a URL-safe token for use with Rails for signing cookies def secure_token SecureRandom.base64(96).tr('+/=', '-_*') end end end
Version data entries
5 entries across 5 versions & 1 rubygems