Sha256: e302d76c68e71ee598e6988e6c207cfab8a94909052d74257aa03a7502b99a38

Contents?: true

Size: 615 Bytes

Versions: 10

Compression:

Stored size: 615 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.exist?(sample_yml) && !File.exist?(real_yml)
    Interaction.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) }

    Interaction.note "Created #{real_yml}."
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
geordi-4.2.0 lib/geordi/commands/create_database_yml.rb
geordi-4.1.1 lib/geordi/commands/create_database_yml.rb
geordi-4.1.0 lib/geordi/commands/create_database_yml.rb
geordi-4.0.1 lib/geordi/commands/create_database_yml.rb
geordi-4.0.0 lib/geordi/commands/create_database_yml.rb
geordi-3.2.0 lib/geordi/commands/create_database_yml.rb
geordi-3.1.0 lib/geordi/commands/create_database_yml.rb
geordi-3.0.3 lib/geordi/commands/create_database_yml.rb
geordi-3.0.2 lib/geordi/commands/create_database_yml.rb
geordi-3.0.1 lib/geordi/commands/create_database_yml.rb