如何在部署之前缩小源代码
我正在通过使用 capistrano 从 git 部署一个 php 项目。我目前正在通过一些 capistrano 任务来缩小我的 javascript (使用 jammit)和 css (使用 yui)。我看到的问题是,我是在目标服务器上进行这种缩小,而不是在本地预部署代码库。令人担忧的原因是,我将 javascript 压缩从 yui 切换到 jammit,并且当我的部署服务器已经安装了这个新的 ruby gem 时,我不想在多个生产服务器上安装它。我从另一个开发人员那里继承了 capistrano 文件,所以我不是 100% 清楚代码何时检出、何时发送到远程服务器的过程,以及我应该挂钩什么任务。
我最初的想法是在“部署”之前执行此操作,但我再次不确定是否有可用的源代码。
I am deploying a php project from git through the use of capistrano. I am currently minifying my javascript (using jammit) and css (using yui) through some capistrano tasks already. The issue I see is that I am doing this minification on the destination servers rather than once locally pre-deployment of the code base. The cause of concern is that I switched the javascript minification from yui to jammit and do not want to have to install this new ruby gem on multiple production servers when my deployment servers already have it installed. I inherited the capistrano file from anohter developer so I'm not 100% clear on the process of when the code gets checked out, and when it gets sent to the remote server, and what task I should hook into.
My initial thought is to do it before "deploy"
but again, am not sure I'll have the source code available to act on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答是“你不”。
deploy
钩子调用deploy:update_code它将一次性执行以下操作:
(根据您的部署设置,会有一些变化)。
然而,
我能够通过使用下载和上传命令来解决这个问题。
我不喜欢它,因为它不太干净,但它可以按照我需要的方式完成工作。
The short answer is "you don't". The
deploy
hook calls deploy:update_codeWhich does the following in one fell swoop:
(with some variation depending on your deployment settings).
However,
I was able to to get around this by utilizing the download and upload commands.
I don't like it as it's not quite as clean, but it gets the job done the way I need to get it done.