Skip to content

Instantly share code, notes, and snippets.

@dsimard
Created October 20, 2009 17:23
Show Gist options
  • Save dsimard/214438 to your computer and use it in GitHub Desktop.
Save dsimard/214438 to your computer and use it in GitHub Desktop.
set :shared_database_path, "#{shared_path}/db"
set :shared_config_path, "#{shared_path}/config"
# snip...
after "deploy:setup", "sqlite3:make_shared_folder"
after "deploy:setup", "sqlite3:build_configuration"
after "deploy:symlink", "sqlite3:link_configuration_file"
# snip...
namespace :sqlite3 do
desc "Generate a database configuration file"
task :build_configuration, :roles => :db do
db_options = {
"adapter" => "sqlite3",
"database" => "#{shared_database_path}/production.sqlite3"
}
config_options = {"production" => db_options}.to_yaml
put config_options, "#{shared_config_path}/sqlite_config.yml"
end
desc "Links the configuration file"
task :link_configuration_file, :roles => :db do
run "ln -nsf #{shared_config_path}/sqlite_config.yml #{release_path}/config/database.yml"
end
desc "Make a shared database folder"
task :make_shared_folder, :roles => :db do
run "mkdir -p #{shared_database_path}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment