Sha256: 7e1bd6ae37e48d8c83ce776a57113187b2d1534980a333a9ed4c62e36e1f3b9d
Contents?: true
Size: 1.54 KB
Versions: 6
Compression:
Stored size: 1.54 KB
Contents
Capistrano::Configuration.instance(:must_exist).load do ssh_options[:forward_agent] = true set(:application) { repository.slice(/[^\/:]+?(?=\.git$)/) } set(:repository) { abort "Please specify repository, set :repository, 'foo'" } set(:deploy_to) { abort "Please specify deploy directory, set :deploy_to, '/deploy/to/path'" } set :branch, 'master' set(:current_revision) { capture("cd #{deploy_to} && git rev-parse HEAD").chomp } namespace :deploy do desc 'Deploy' task :default do update restart end desc 'Deploy & migrate' task :migrations do update_code migrate restart end desc 'Setup' task :setup, :except => {:no_release => true} do run "mkdir -p `dirname #{deploy_to}` && git clone --no-checkout #{repository} #{deploy_to}" update_code end desc 'Update' task :update do update_code end desc 'Update the deployed code' task :update_code, :except => {:no_release => true} do run "cd #{deploy_to} && git fetch origin && git reset --hard origin/#{branch}" end desc 'Run migrations' task :migrate, :roles => :db, :only => {:primary => true} do rake = fetch(:rake, 'rake') rails_env = fetch(:rails_env, 'production') run "cd #{deploy_to} && RAILS_ENV=#{rails_env} #{rake} db:migrate" end desc 'Restart' task :restart do # nothing end desc 'Show pending commits' task :pending do system("git log --pretty=medium --stat #{current_revision}..origin/#{branch}") end end end
Version data entries
6 entries across 6 versions & 1 rubygems