/config/deploy.rb
Ruby | 109 lines | 59 code | 30 blank | 20 comment | 1 complexity | b01f2b498aeb87884b622558c48ed35f MD5 | raw file
- load "deploy/assets"
- set :default_stage, "staging"
- set :stages, %w(production staging)
- require 'capistrano/ext/multistage'
- require 'rvm/capistrano'
- set :rvm_ruby_string, 'ruby-1.9.3-p194@global'
- set :rvm_type, :system
- set :rvm_install_type, :stable
- require "bundler/capistrano"
- #before 'deploy:setup', 'rvm:install_rvm'
- #set :bundle_without, [:development, :test]
- #set :bundle_gemfile, "Gemfile"
- #set :bundle_flags, "--deployment --quiet"
- #set :bundle_dir, fetch(:shared_path)+"/bundle"
- set :application, "AppFellas"
- set :repository, "git@bitbucket.org:appfellas/appfellasweb.git "
- set :user, "appfellas"
- set :use_sudo, false
- set :keep_releases, 3
- set :scm, :git
- set :deploy_via, :export
- set :git_enable_submodules, 1
- #set :stack, :passenger_nginx
- #ssh_options[:forward_agent] = true
- default_run_options[:pty] = true
- #default_run_options[:shell] = '/bin/bash'
- # Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
- # role :web, "appfellas.co" # Your HTTP server, Apache/etc
- # role :app, "appfellas.co" # This may be the same as your `Web` server
- #role :db, "mongo", :primary => true # This is where Rails migrations will run
- #role :db, "your slave db-server here"
- # if you're still using the script/reaper helper you will need
- # these http://github.com/rails/irs_process_scripts
- #before 'deploy:setup', 'rvm:install_ruby'
- # If you are using Passenger mod_rails uncomment this:
- namespace :deploy do
- task :start do ; end
- task :stop do ; end
- task :restart, :roles => :app, :except => { :no_release => true } do
- run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
- end
- end
- namespace :rvm do
- task :trust_rvmrc do
- run "rvm rvmrc trust #{release_path}"
- end
- end
- #after "deploy", "rvm:trust_rvmrc"
- namespace :assets do
-
- desc "Create symlink for shared static resources, fx user avatars, etc."
- task :symlink, :roles => :app do
- assets.create_dirs
- run <<-CMD
- ln -nfs #{shared_path}/static #{release_path}/public/static
- CMD
- end
-
- desc "Create dirs"
- task :create_dirs, :roles => :app do
- %w(static).each do |name|
- run "mkdir -p #{shared_path}/#{name}"
- end
-
- #subdirs
- %w(uploads).each do |name|
- run "mkdir -p #{shared_path}/static/#{name}"
- end
-
- end
- end
- ## Run manual
- namespace :crontab do
- desc "Update crontab"
- task :update do
- run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec whenever --set 'enviroment=#{rails_env}&cron_log=#{current_path}/log/cron.log' --update-crontab #{application}_#{rails_env}"
- end
- desc "Clear crontab"
- task :clear do
- run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec whenever --set 'enviroment=#{rails_env}' --clear-crontab #{application}_#{rails_env}"
- end
- end
- after "deploy:update_code", "assets:symlink"