| Path: | vendor/rails/railties/lib/commands/dbconsole.rb |
| Last Update: | Fri Oct 10 10:20:41 +0000 2008 |
# File vendor/rails/railties/lib/commands/dbconsole.rb, line 22
22: def find_cmd(*commands)
23: dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
24: commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/
25: commands.detect do |cmd|
26: dirs_on_path.detect do |path|
27: File.executable? File.join(path, cmd)
28: end
29: end || abort("Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.")
30: end