带有Composer的供应商中的SVN回购 [英] SVN Repo in vendor with Composer

查看:61
本文介绍了带有Composer的供应商中的SVN回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我在与Composer一起使用的供应商目录中签出了一个私人SVN存储库。效果很好,但前提是我不更改/提交内容。在对SVN存储库进行更改后,当我 composer更新时,我得到了清晰的这是不建议使用我的工作方式的消息,以及我的.svn目录丢失的消息。 (缺少的.svn目录可能是因为我从单个存储库中签出了多个供应商软件包)

Currently, I have a private SVN repo checked out in my vendor directory that works with Composer. It works pretty fine, but only as long as I don't change/commit stuff. When I composer update after committing a change to the SVN repo I get the clear message that my way of working is not recommended, along with the message my .svn directory is missing. (The missing .svn directory may be because I have a checkout of multiple vendor packages from a single repo)

我知道在供应商目录中拥有签出权限是'完全是最佳做法。但是感觉很舒服(如果可以的话)。现在,由于我不是一个喜欢坚持不良做法的人,因此我想对此加以改进。

I understand that having a checkout right in the vendor directory isn't exactly best practice. But it feels rather comfortable (if it works ofcourse). Now, since I'm not someone who likes to stick with bad practices I'd like to improve on this.

Composer的建议仅向我提供了一些示例,无论如何都要在供应商目录中运行SVN,最佳实践一词对我也不是很清楚。另外,这篇文章并没有真正的帮助,因为我没有收到Seldaek演示的消息。

The Composer recommendation only gives me some examples on how to get SVN in the vendor directory running anyway and the "best practice" sentence isn't exactly clear to me either. Also, this post isn't really helping either as I am not getting the message Seldaek is demonstrating.

我的问题是,用SVN管理供应商的正确方法是什么?

My question is, what is the correct way to manage a vendor with SVN?

推荐答案

推荐的方法是仅提交 composer.lock composer.json 文件。这使您的存储库轻巧,因为您不必提交构成所包含库的所有那些文件。如果您调用 composer install ,Composer承诺会安装完全相同的文件。

The recommended way is to commit only the composer.lock and composer.json files. This makes your repository lightweight, as you don't have to commit all those files that make up the included libraries. Composer promises to install exactly the same files if you call composer install.

实际上,它的工作方式是将所有包含的供应商文件提交到您的项目存储库中。我之所以在某些项目中这样做是因为除了将所有内容都存储在存储库中之外,还没有一种部署这些方法的方法。好处是,每个签出或更新存储库的人都立即拥有该软件的工作副本。不好的部分是,一旦从存储库中导出了依赖项,您将拥有更加复杂的更新和提交过程,因为您必须手动删除外部存储库的所有标志(例如 .git 目录-如果您使用git作为存储库,则不希望拥有git子模块;如果您使用SVN,则不希望提交完整的git历史记录)-相同的处理方式

The way it also works is to actually commit all the included vendor files into your project repository. I did it in some projects because there was not yet a way to deploy these besides having everything in the repository. The good part is that everyone checking out or updating the repository instantly has a working copy of the software. The bad part is that as soon as the dependencies are exported from a repository, you have a much more complicated update and commit process, because you manually have to delete all signs of the foreign repository (like the .git directories - you do not want to have git submodules if you are using git as the repo, and you do not want to commit the complete git history if you are using SVN) - it is the same way with a library checked out from SVN.

如果不创建一个更新脚本来完成将依赖项提交到存储库所需的一切,除非强制执行以下操作,否则您将永远不会更新软件: 。在不提交依赖项的情况下,更新就像调用 composer update 然后在 composer.json composer.lock

Without creating an update script that does everything you need to commit your dependencies into your repository, you will never ever update your software unless forces to. Without committing the dependencies, updating is as easy as calling composer update and then committing the changes in composer.json and composer.lock.

如果依赖项不在项目存储库中,如何将其部署到生产服务器?在将文件复制到生产系统之前,请调用 composer install 。 :)

How are the dependencies deployed to the production server if they are not in the projects repository? Call composer install before copying the files to the production system. :)

这篇关于带有Composer的供应商中的SVN回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆