Sha256: 85389cae435c9fa14520fe5005c982bef1bf499b12726b53ba053c70c5bd5c99

Contents?: true

Size: 600 Bytes

Versions: 10

Compression:

Stored size: 600 Bytes

Contents

desc 'create-database-yml', '[sic]', :hide => true
def create_database_yml
  real_yml = 'config/database.yml'
  sample_yml = 'config/database.sample.yml'

  if File.exists?(sample_yml) and not File.exists?(real_yml)
    announce 'Creating ' + real_yml

    sample = File.read(sample_yml)
    adapter = sample.match(/adapter: (\w+)\n/).captures.first

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

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

    note "Created #{real_yml}."
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
geordi-2.12.3 lib/geordi/commands/create_database_yml.rb
geordi-2.12.2 lib/geordi/commands/create_database_yml.rb
geordi-2.12.1 lib/geordi/commands/create_database_yml.rb
geordi-2.12.0 lib/geordi/commands/create_database_yml.rb
geordi-2.11.0 lib/geordi/commands/create_database_yml.rb
geordi-2.10.1 lib/geordi/commands/create_database_yml.rb
geordi-2.10.0 lib/geordi/commands/create_database_yml.rb
geordi-2.9.0 lib/geordi/commands/create_database_yml.rb
geordi-2.8.0 lib/geordi/commands/create_database_yml.rb
geordi-2.7.0 lib/geordi/commands/create_database_yml.rb