instance method
find_cmd
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
find_cmd(*commands)
No documentation comment.
Parameters
-
commandsrest
Source
# File railties/lib/commands/dbconsole.rb, line 33
def find_cmd(*commands)
dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/
full_path_command = nil
found = commands.detect do |cmd|
dir = dirs_on_path.detect do |path|
full_path_command = File.join(path, cmd)
File.executable? full_path_command
end
end
found ? full_path_command : abort("Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.")
end
Defined in railties/lib/commands/dbconsole.rb line 33
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object