我deploy.rb
的如下
我不断收到以下错误cap deploy:setup
错误信息var/lib/gems/1.9.1/gems/
capistrano-2.15.5 /lib/capistrano/configuration/variables.rb:122:in
method_missing_with_variables': undefined local variable or method shared_children' for #<Capistrano::Configuration:0x00000000daf048> (NameError)
capistrano version capistrano-2.15.5
rails version Rails 4.0.0
ruby versionruby 1.9.3p194 (2012-04-20 revision 35410)
任何帮助都将受到高度评价
require "rvm/capistrano"
set :rvm_ruby_string, 'default'
set :rvm_type, :user
require "bundler/capistrano"
set :application, "past"
set :ip, "xxx.xxx.xxx.xxx"
set :domain,"paste.com"
set :user, "okli"
set :scm, :none
set :repository, "."
set :deploy_via, :copy
set :deploy_to, "/home/#{user}/#{domain}"
set :use_sudo, false
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
after "deploy:update_code", "deploy:copy_old_sitemap"
namespace :deploy do
task :copy_old_sitemap do
run "if [ -e #{previous_release}/public/sitemap.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi"
end
end
after "deploy", "refresh_sitemaps"
task :refresh_sitemaps do
run "cd #{latest_release} && RAILS_ENV=#{rails_env} rake sitemap:refresh"
end
set :whenever_identifier, "homeworkly"
set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"
after "deploy:create_symlink", "deploy:update_crontab"
namespace :deploy do
desc "Update the crontab file"
task :update_crontab, :roles => :db do
run "cd #{release_path} && whenever --update-crontab #{application}"
end
end
task :cleanup, :except => { :no_release => true } do
count = fetch(:keep_releases, 2).to_i
rsudo <<-CMD
all=$(ls -x1 #{releases_path} | sort -n);
keep=$(ls -x1 #{releases_path} | sort -n | tail -n #{count});
remove=$(comm -23 <(echo -e "$all") <(echo -e "$keep"));
for r in $remove; do rm -rf #{releases_path}/$r; done;
CMD
run <<-CMD
rm -rf #{latest_release}/public/images &&
ln -s #{shared_path}/images #{latest_release}/public/images
CMD
run <<-CMD
rm -rf #{latest_release}/uploads &&
ln -s #{shared_path}/uploads #{latest_release}/uploads
CMD
end
desc "tail production log files"
task :tail_logs, :roles => :app do
run "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end
after 'deploy:finalize_update', 'bundle:install'
after "deploy:restart", "deploy:cleanup"