Skip to content

Commit

Permalink
Show adapter type before asking for the DB password
Browse files Browse the repository at this point in the history
  • Loading branch information
dastra-mak committed Nov 15, 2019
1 parent 895f16b commit b455263
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/geordi/commands/create_database_yml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ def create_database_yml
if File.exists?(sample_yml) and not File.exists?(real_yml)
announce 'Creating ' + real_yml

print 'Please enter your DB password: '
sample = File.read(sample_yml)
adapter = sample.match(/adapter: (\w+)\n/).captures.first

print "Please enter your #{adapter} password: "
db_password = STDIN.gets.strip

sample = File.read(sample_yml)
real = sample.gsub(/password:.*$/, "password: #{db_password}")
File.open(real_yml, 'w') { |f| f.write(real) }

Expand Down

0 comments on commit b455263

Please sign in to comment.