Sha256: c0b20e4c35da36356179b7c8a57b8af7fa89c562b593b3744c47169697526b9c

Contents?: true

Size: 613 Bytes

Versions: 35

Compression:

Stored size: 613 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+)/).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

35 entries across 35 versions & 1 rubygems

Version Path
geordi-11.2.0 lib/geordi/commands/create_database_yml.rb
geordi-11.1.0 lib/geordi/commands/create_database_yml.rb
geordi-11.0.0 lib/geordi/commands/create_database_yml.rb
geordi-10.1.0 lib/geordi/commands/create_database_yml.rb
geordi-10.0.1 lib/geordi/commands/create_database_yml.rb
geordi-10.0.0 lib/geordi/commands/create_database_yml.rb
geordi-9.6.1 lib/geordi/commands/create_database_yml.rb
geordi-9.6.0 lib/geordi/commands/create_database_yml.rb
geordi-9.5.1 lib/geordi/commands/create_database_yml.rb
geordi-9.5.0 lib/geordi/commands/create_database_yml.rb
geordi-9.4.1 lib/geordi/commands/create_database_yml.rb
geordi-9.4.0 lib/geordi/commands/create_database_yml.rb
geordi-9.3.1 lib/geordi/commands/create_database_yml.rb
geordi-9.3.0 lib/geordi/commands/create_database_yml.rb
geordi-9.2.0 lib/geordi/commands/create_database_yml.rb
geordi-9.1.0 lib/geordi/commands/create_database_yml.rb
geordi-9.0.0 lib/geordi/commands/create_database_yml.rb
geordi-8.0.0 lib/geordi/commands/create_database_yml.rb
geordi-7.0.2 lib/geordi/commands/create_database_yml.rb
geordi-7.0.1 lib/geordi/commands/create_database_yml.rb