IDE、SVN 和推送到网站!
我正在考虑更新我的做法,并寻求一些帮助和建议!
我在运行 joomla、oscommerce、drupal 等的网站上做了很多工作,因此我创建了很多自定义组件/插件和 hack 等。目前每个网站在我的 xampp 设置上都有自己的文件夹。 我想做的是(例如)Joomla 设置的默认设置,当我进行更改更新时,我可以做一些更新包含 joomla 的所有其他文件夹的操作,几乎就像自动更新一样?
我也在考虑更多地使用 Aptana IDE 和 SVN 服务,例如 unfuddle 与其他人分享我的工作,但我还没有以前使用过 SVN,不确定是否可以使用 SVN 执行上述操作?
如果能够处理主要/核心项目并将更新发送到本地更新和实际服务器,而无需维护许多不同的单独站点,那就太好了。
建议?
Im thinking of updating my practices, and looking for a little help and advice!
I do a lot of work on sites that run joomla, oscommerce, drupal etc and so I have created a lot of custom components/plugins and hacks etc. Currently each site has its own folder on my xampp setup. What I would like to do is have a default setup of (for example) a Joomla setup and when I make changes updates, I can do something which updates all the other folders that contain joomla, almost like an auto update?
Im also looking at using Aptana IDE more and SVN service such as unfuddle to share my work with others, but I have not used SVN before and not sure if its possible to do the above using SVN?
It would be great to be able to work on a main/core item and send the updates to both local updates and to actual servers, without having to maintain lots of different individual sites.
Suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,SVN 将是实现此目的的一个很好的工具。 将您的代码(例如:自定义 Joomla 组件)存储在源代码管理中。 无论您想在何处使用该组件,只需将该特定文件夹
签出
或导出
到您的实时站点即可。 这是构建存储库的一种方法:通过 SSH 登录到实时服务器并运行此命令:
任何时候更改代码,提交更改,然后重新登录到服务器并运行:
这样做的真正好处是,应该当您进行更新并破坏某些内容时,您始终可以将其回滚到最后一个已知的“良好”版本。
至于自动化此过程,如果它位于不同的服务器上,您可能会运气不好。 对于同一服务器上的多个部署,您可以非常轻松地编写 shell 脚本来为每个站点/组件运行上述命令。 如果您需要完全自动化,您甚至可以设置一个 cron 作业来每天凌晨 2 点或其他时间运行此脚本 - 就我个人而言,我会坚持使用手动方法,但这仍然是一种选择。
要在本地使用 SVN 存储库,我建议查看 TortoiseSVN (如果您使用的是 Windows) :这是使用 SVN 最简单、最容易的方式。
Yes, SVN would be a great tool for this purpose. Store your code (eg: a custom Joomla component) in source control. Wherever you want to use that component, just do a
checkout
orexport
of that particular folder into your live site. Here's one way you could structure your repository:Log in to your live server via SSH and run this command:
Any time you change your code, commit the changes and then log back into the server and run:
A real benefit of this is that should you do an update and break something, you can always roll it back to the last known "good" version.
As for automating this process, you might be out of luck if it's on different servers. For multiple deployments on the same server, you could quite easily write a shell script to run the above commands for each site/component. If you needed this to be fully automated, you could even set up a cron job to run this script every day at 2am or something - personally I'd stick with the manual approach, but it's still an option.
For working locally with your SVN repositories, I'd recommend looking at TortoiseSVN (if you're on Windows): it's the simplest and easiest way to work with SVN.
为了实现自动化,您可以使用 SVN hooks。 有一个提交后挂钩,因此每次您进行提交时,您的挂钩脚本都可以告诉其他机器进行 SVN 更新以获取最新代码。
有关详细信息,请参阅 版本使用 Subversion 进行控制 - 实施存储库挂钩。
For automating things, you could use SVN hooks for this. There is a post-commit hook, so every time you do a commit, your hook script could tell the other machines to do an SVN update to get the latest code.
For more info, see Version Control with Subversion - Implementing Repository Hooks.
对于您的情况,我没有一个好的答案,但我认为 Subversion 本身并不是答案。
这个问题解决了有关 Subversion 跨“项目”共享机制的一些问题。
Subversion 当然可以解决这个难题的源代码管理部分。 自动分发,我会使用另一个工具。
I don't have a good answer for your situation, but I don't think Subversion by itself is the answer.
This Question addresses some of the concerns about Subversion's mechanisms for sharing across 'projects'.
Subversion can certainly handle the source code management part of this puzzle. The automated distribution, well I'd use another tool.
查看 Capistrano。 我已经用过几次了,一旦你明白了,它非常好。 针对 Rails,但应该适用于需要从存储库获取代码并将其部署到不同服务器上的任何情况。
Look into Capistrano. I've used it a couple of times and once you figure it out, it's pretty good. Aimed at rails but should work for anything where you need to get code from a repository and deploy it on different servers.