instance method
find_cmd
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.2.22.5Signature
find_cmd(*commands)
No documentation comment.
Parameters
-
commandsrest
Source
# File railties/lib/rails/commands/dbconsole.rb, line 49
def find_cmd(*commands)
dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
commands += commands.map{|cmd| "#{cmd}.exe"} if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
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/rails/commands/dbconsole.rb line 49
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::DBConsole