set :application,     'application_name'
set :domain,     'mydomain'
set :repository, "myuser@myserver:/my/git/repository/"
set :user, "batitelweb"
set :deploy_to,       "/home/to/my/rails/app"

set :scm, :git
set :local_scm_command, "/usr/bin/git"
set :scm_command, "/usr/local/bin/git"
set :branch, "dev"
set :keep_releases, 3 
set :git_shallow_clone, 1


role :app, domain
role :web, domain
role :db,  domain, :primary => true

set :rails_env, :development
set :mongrel_conf, "#{shared_path}/config/mongrel_cluster_dev.yml"
set :use_sudo, false

task :default do
  transaction do
    update_code
    symlink
    migrate
    restart
  end
end

task :after_setup, :roles => [:web, :app] do
  run "mkdir #{shared_path}/config"
  run "mkdir #{shared_path}/users"
  run "mkdir #{shared_path}/pdf"
  run "mkdir #{shared_path}/pictures"
end

task :after_update_code, :roles => [:web, :app] do
  run "ln -s #{shared_path}/config/database.yml #{release_path}/config/"
  run "ln -s #{shared_path}/config/mongrel_cluster.yml #{release_path}/config/"
  run "ln -s #{shared_path}/users #{release_path}/public/users"
  run "ln -s #{shared_path}/pictures #{release_path}/public/pictures"
  run "ln -s #{shared_path}/pdf #{release_path}/pdf"  
end