Skip to content

Instantly share code, notes, and snippets.

@regedarek
Created October 23, 2013 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save regedarek/a20d10a8a25c64c2d238 to your computer and use it in GitHub Desktop.
Save regedarek/a20d10a8a25c64c2d238 to your computer and use it in GitHub Desktop.
require 'rvm/capistrano'
require 'capistrano/ext/multistage'
require 'capistrano-lazy-assets'
require 'bundler/capistrano'
require 'puma/capistrano'
require 'capistrano-db-tasks'
#############################################################
# Settings
#############################################################
set :stages, %w(staging production)
set :default_stage, "staging"
set :rvm_type, :user
set :normalize_asset_timestamps, false
set :bundle_without, %w(development test)
set :application, "CardioGO"
set :scm, :git
set :repository, "gitserver:cardiogo"
set :branch, 'staging'
set :keep_releases, 10
#############################################################
# Additional Capistrano Tasks
#############################################################
desc "Create all necessary directories for a new server."
after "deploy:setup" do
run "mkdir -pm 700 #{shared_path}"
run "mkdir -pm 700 #{shared_path}/config"
run "mkdir -pm 700 #{shared_path}/assets"
run "mkdir -pm 700 #{shared_path}/log"
run "mkdir -pm 700 #{releases_path}"
end
namespace :deploy do
desc "Create all shared links"
task :create_symlinks, :roles => :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
end
namespace :deploy do
desc "Create data folder"
task :create_data_folder, :roles => :app do
run "mkdir #{release_path}/data"
end
end
namespace :deploy do
task :compile_edffile, :roles => :app do
run "cd #{release_path}/ && bundle exec rake compile:edffile"
end
end
#############################################################
# Overwritten Capistrano Tasks
#############################################################
#############################################################
# Hooks
#############################################################
after 'deploy', 'deploy:cleanup'
before 'deploy:create_symlink', 'deploy:create_symlinks'
after 'deploy:create_symlinks', 'deploy:create_data_folder'
after "deploy:create_data_folder", "deploy:compile_edffile"
after 'deploy:compile_ext', 'deploy:migrate'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment