Deployment 在deploy.rb中创建符号链接的正确方法

Deployment 在deploy.rb中创建符号链接的正确方法,deployment,capistrano,symlink,Deployment,Capistrano,Symlink,部署应用程序时出现错误: [neon.locum.ru] executing command *** [err :: neon.locum.ru] find: `/home/hosting_grandinvest/projects/demo/releases/20130116145843/public/images /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/stylesheets /hom

部署应用程序时出现错误:

    [neon.locum.ru] executing command
*** [err :: neon.locum.ru] find: `/home/hosting_grandinvest/projects/demo/releases/20130116145843/public/images /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/stylesheets /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/javascripts': Нет такого файла или каталога
    command finished in 91ms
    triggering after callbacks for `deploy:update_code'
  * 2013-01-16 16:58:45 executing `make_images_link'
  * executing "ln -s /home/hosting_grandinvest/projects/demo/shared/public/images /home/hosting_grandinvest/projects/demo/releases/20130116145843/public/images"
正如您所看到的,这是因为它首先尝试查找/public/images目录。然后才为该目录创建一个符号链接。 请求我的deploy.rb

require 'bundler/capistrano'
after "deploy:update_code", :make_images_link
task :make_images_link, roles => :app do
  images_dir = "#{shared_path}/public/images"
  run "ln -s #{images_dir} #{release_path}/public/images"
end
部署结束

Gem.source_index called from /home/hosting_grandinvest/projects/demo/shared/gems/ruby/1.8/gems/rails-2.3.15/lib/rails/gem_dependency.rb:21.
master process ready
worker=0 ready
reaped #<Process::Status: pid=18656,exited(0)> worker=0
master complete

当我部署错误仍然存在,但图像出现

最后,我在我的存储库中加入了“public”images目录。
作为步骤2,我运行了一个在更新1中指定的回调

after "deploy:update_code", :make_images_link
task :make_images_link, roles => :app do
  images_dir = "#{shared_path}/public/images"
  realease_images = "#{release_path}/public/images"
  run "rm -rf #{realease_images}"
  run "ln -s #{images_dir} #{realease_images}"
end