服务器上的Ruby rake任务

时间:2018-04-25 17:08:12

标签: ruby-on-rails capistrano

我正在使用capistrano将我的网站部署到登台和生产服务器。我想使用类似于下面的内容来检查我是否在登台或生产上进行部署并运行相应的命令。由于某种原因,比较运算符不起作用。我是在比较错误的变量值类型还是类似的东西?

namespace :deploy do
    task :published do
        on release_roles :all do

            if :deploy_to == "/home/master/applications/STAGING/public_html/"
                # RUN THIS COMMAND...
                execute "cd /in/to/a/directory/on/staging/server/"
            end

            if :deploy_to == "/home/master/applications/PRODUCTION/public_html/"
                # RUN THIS COMMAND...
                execute "cd /in/to/a/directory/on/production/server/"
            end

        end
    end
end

0 个答案:

没有答案