Skip to content

Instantly share code, notes, and snippets.

@dfarrell-bloom
Created February 3, 2014 17:27
Show Gist options
  • Save dfarrell-bloom/8788254 to your computer and use it in GitHub Desktop.
Save dfarrell-bloom/8788254 to your computer and use it in GitHub Desktop.
find migration password from ARGF if any and write it out
# 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