Created
February 3, 2014 17:27
-
-
Save dfarrell-bloom/8788254 to your computer and use it in GitHub Desktop.
find migration password from ARGF if any and write it out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read argf, find migration password if any and write it out. Grep doesn't do a great job of this beacuse we don't know the format of the file, but ruby can just read the json. | |
require 'json' | |
data = JSON.parse( ARGF.read ) | |
id = data['id'] || "Unknown ID" | |
if data['database_schema'] and | |
data['database_schema']['grants'] and | |
data['database_schema']['grants']['migration'] and | |
data['database_schema']['grants']['migration']['password'] | |
puts "\033[33;1m" << "ID #{id}: " << "\033[0m" << | |
data['database_schema']['grants']['migration']['password'] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment