#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) require "rvm/capistrano" set :rvm_ruby_string, 'default' set :rvm_type, :user
require "bundler/capistrano"
set :application, "app_name"
set :repository, "." set :scm, :none set :deploy_via, :copy
set :checkout, 'export'
set :user, "user"
set :use_sudo, true
set :deploy_to, "/var/www/#{application}"
set :server_name, "domain.com"
role :app, server_name role :web, server_name role :db, server_name, :primary => true
default_run_options[:pty] = true namespace :deploy do task :restart do run "touch #{deploy_to}current/tmp/restart.txt" end task :start do run "cd #{deploy_to} && ln -s current/public public_html" run "touch #{deploy_to}current/tmp/restart.txt" end task :symlink do run "cd #{deploy_to} && rm current ; ln -s releases/#{release_name} current" run <<-CMD rm -rf #{latest_release}/log /home/#{user}/#{latest_release}/public/system #{latest_release}/tmp/pids && ln -s /home/#{user}#{shared_path}/log /home/#{user}#{latest_release}/log && ln -s /home/#{user}#{shared_path}/system /home/#{user}#{latest_release}/public/system && ln -s /home/#{user}#{shared_path}/pids /home/#{user}#{latest_release}/tmp/pids CMD end task :stop do run "rm #{deploy_to}public_html" end namespace :web do task :disable do run "cd #{deploy_to} && rm public_html && ln -s static_site public_html" end task :enable do run "cd #{deploy_to} && rm public_html && ln -s current/public public_html" end end end task :after_setup do run "rm -rf #{deploy_to}public_html" run "mkdir #{deploy_to}static_site" end
#1 楼 @geekontheway 哈哈哈 吴依洁嘛 一眼就被你认出来了