Skip to content

Instantly share code, notes, and snippets.

@stojg
Last active December 14, 2015 19:59
Show Gist options
  • Save stojg/5140534 to your computer and use it in GitHub Desktop.
Save stojg/5140534 to your computer and use it in GitHub Desktop.
Capistrano testing
# Arbitrary variable, useful to store your application name within.
set :application, "project"
# The URL of the repository that hosts our code for example
# http://github.com/capistrano/capistrano.git
set :repository, "ssh://git@gitorious/project/repo.git"
# The path on the servers we’re going to be deploying the application to.
# The default is /u/apps/.
set :deploy_to, "/tmp/#{application}"
# Defines for the default deployment recipes whether we want to use sudo or not.
set :use_sudo, false
# This a space separated list of folders that will be shared between deploys
set :shared_children, %w(assets)
# Your HTTP server
server "localhost", :web, :db, :primary=>true
# The number of old releases to keep, defaults to 5, can be overridden with
# any positive integer.
set :keep_releases, 5
after "deploy:restart", "deploy:cleanup"
# Keep set to false, RubyOnRails behaviour, will brake in Silverstripe
set :normalize_asset_timestamps, false
# Deploy the code by copying it up to the server so the target servers don't need
# to have access to the git repo
set :deploy_via, :copy
# Set a build script that is run before the code .tar.gz and sent to the server
set :build_script, "/Users/stig/pear/bin/phing composer"
# The migrate task takes care of doing the dev/build
namespace :deploy do
task :migrate, :roles => :db, :only => { :primary => true } do
run "#{latest_release}/framework/sake dev/build"
end
end
# Change the deploy target folder to the current branch name if the :branch
# is set, otherwise use default timestamp
before "deploy:update" do
# check if the branch is set to head and .. do something?
set :release_name, "#{branch}" if exists?(:branch)
end
after "deploy:finalize_update", "deploy:migrate"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment