instance method
find_cmd
Ruby on Rails 2.2.3
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 22
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/
commands.detect do |cmd|
dirs_on_path.detect do |path|
File.executable? File.join(path, cmd)
end
end || abort("Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.")
end
Defined in railties/lib/commands/dbconsole.rb line 22
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Object