dotfiles/fish/bin/parse_db_yml

15 lines
326 B
Ruby

#!/usr/bin/env ruby
exit(1) unless ARGV[0] && File.exist?(ARGV[0])
require 'yaml'
dbs = YAML.load_file(ARGV[0]).collect do |name,info|
adapter = info['adapter'] || info[:adapter]
db = info['database'] || info[:database]
[adapter,db]
end.uniq.each do |(adapter,db)|
puts "%s\t%s" % [adapter, db]
end
exit 0