【问题标题】:In capistrano3 can you change the symlink destination when using the linked_files directive?在 capistrano3 中,您可以在使用 linked_files 指令时更改符号链接目标吗?
【发布时间】:2016-06-03 06:31:32
【问题描述】:

例如创建符号链接 vi deploy.rb

set :linked_files, %w{path/to/shared/file}

使用类似...的方式更改符号链接目标

set :linked_files, {'path/to/shared/file' => 'destination/path'}

【问题讨论】:

    标签: capistrano capistrano3


    【解决方案1】:

    不,写你自己的任务

    namespace :deploy do
        task :create_symlink do
            on roles(:web) do
                execute "ln -s #{deploy_to}/shared/prod/config.php #{deploy_to}/current/config.php"
            end
        end
    end
    after :deploy, "deploy:create_symlink"
    

    reference

    【讨论】:

      【解决方案2】:

      为了补充 Ben 的答案,我经常逐字使用linked_files,然后创建了一个从共享到最终目的地的符号链接。

      【讨论】:

      • 谢谢 will_in_wi,但请您添加示例,因为我发现 ruby​​/capistrano 文档有点稀疏。
      猜你喜欢
      • 2010-11-30
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多