Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
set :stages, %w(staging production)
set :default_stage, 'staging'
require 'capistrano/ext/multistage' rescue 'YOU NEED TO INSTALL THE capistrano-ext GEM'
require "bundler/capistrano"
set :application, "new_futuro"
set :repository, "git@github.com:obtiva/New-Futuro.git"
default_run_options[:pty] = true
set :scm, "git"
set :checkout, "export"
set :deploy_via, :remote_cache
set :git_shallow_clone, 1
set :scm_verbose, true
set :scm_prefer_prompt, true
set :bundle_flags, "--deployment"
set(:scm_password) { Capistrano::CLI.password_prompt("Git Password: ") }
set :user, "deploy"
set :group, "deploy"
set :deploy_to, "/srv/apps/new_futuro"
set :branch, "master"
set :server, :passenger
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, '1.9.2@new_futuro'
after "deploy:setup", "deploy:fix_permissions"
after "deploy:setup", "db:install"
namespace :deploy do
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Additional Symlinking"
task :additional_symlinking, :roles => :app do
run "ln -s #{shared_path}/database.yml #{release_path}/config/database.yml"
end
after "deploy:symlink", "deploy:additional_symlinking"
desc "Ensures #{deploy_to} exists and is chmodded to #{user}"
task :fix_permissions, :roles => :app do
sudo "chown -R #{user}:#{group} #{deploy_to}"
end
end
namespace :db do
desc "Installs the database.yml to /shared"
task :install, :roles => :app do
path = "#{shared_path}/database.yml"
run "rm -f #{path}"
put File.read("./config/database.yml"), path, :mode => 0644
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.