Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created May 26, 2009 13:19
Show Gist options
  • Save leehambley/118063 to your computer and use it in GitHub Desktop.
Save leehambley/118063 to your computer and use it in GitHub Desktop.
require 'tempfile'
file_contents = <<-EOB
---
production:
database: example
usernname: test
password: #{password}
host: localhost
EOB
task :put_database_config, :roles => [:db], :only => {:primary => true} do
password = Capistrano::CLI.ui.ask "Give me a database password: "
TempFile.new do |tf|
tf.puts file_contents
put(tf, "#{release_path}/config/database.yml")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment