简体   繁体   English

Symfony2:只更新一个供应商包

[英]Symfony2: updating just one vendor bundle

Is there a way to update just one bundle without updating every bundle in your deps file? 有没有办法只更新一个包而不更新deps文件中的每个包? I am currently using "php vendors install" to install all vendor bundles and am not aware of any commands that will update just one bundle at a time. 我目前正在使用“php供应商安装”来安装所有供应商捆绑包,并且我不知道任何一次只更新一个捆绑包的命令。

1) Just open your deps file (./deps) 1)只需打开你的deps文件(./deps)

2) Remove all bundles except the one you want to update and save the deps file 2)删除除要更新的包之外的所有包,并保存deps文件

3) Let's run the command: php bin/vendors update 3)让我们运行命令:php bin / vendors update

It will update the bundle. 它会更新捆绑包。

4) Go back in your deps file and rewrite all the previous removed bundle lines ! 4)返回你的deps文件并重写之前删除的所有捆绑行!

Cheers ! 干杯!

Short version: The "best way" to do this depends on your setup. 简短版本:执行此操作的“最佳方式”取决于您的设置。 If you've run "php bin/vendors update" before, then it would probably be best to remove the line for the bundle you want to update from your deps.lock file, then run "php bin/vendors install" from your base symfony folder. 如果您之前运行过“php bin / vendors update”,那么最好从deps.lock文件中删除要更新的包的行,然后从您的库中运行“php bin / vendors install” symfony文件夹。

Long version: I think some clarification of what the various vendor commands do is in order. 长版:我认为对各种供应商命令的作用进行了一些澄清。

1) php bin/vendors install 1)php bin / vendors安装

This command downloads (if necessary) and installs vendor bundle source files into symfony/vendor. 此命令下载(如有必要)并将供应商包源文件安装到symfony / vendor中。 This command will first look at deps.lock to see what git commits/versions are listed there, then it will look at your deps file to see what versions are listed there. 此命令将首先查看deps.lock以查看其中列出的git提交/版本,然后它将查看您的deps文件以查看其中列出的版本。 If no version is specified in either for a certain bundle, it will download the most recent version of the bundle code for that bundle. 如果没有为某个捆绑包指定任何版本,它将下载该捆绑包的最新版本的捆绑包代码。 If a version is found, it will download and install that version of the vendor bundle code. 如果找到版本,它将下载并安装该版本的供应商包代码。

This command will not put anything in deps.lock. 此命令不会在deps.lock中放入任何内容。

2) php bin/vendors install --reinstall 2)php bin / vendors install --reinstall

This command does the same thing as php bin/vendors install, except it will always download the code before installing it into symfony/vendor. 这个命令与php bin / vendors安装的功能相同,只是它会在将代码安装到symfony / vendor之前下载代码。

This command will not put anything in deps.lock. 此命令不会在deps.lock中放入任何内容。

3) php bin/vendors update 3)php bin / vendors更新

This command will ignore deps.lock, and will download (if necessary) and install the versions of bundle code listed in the deps file into symfony/vendor. 此命令将忽略deps.lock,并将下载(如有必要)并将deps文件中列出的bundle代码版本安装到symfony / vendor中。

After it is done downloading and installing code, it will put the git commit id / version of the downloaded code for each bundle into your deps.lock file. 在完成下载和安装代码之后,它会将每个包的下载代码的git commit id / version放入deps.lock文件中。 That way, when you go to run one of the install commands listed above, the version of code that is downloaded won't change unless you remove the related line from the deps.lock file or if your run the update command again. 这样,当您运行上面列出的某个安装命令时,除非从deps.lock文件中删除相关行或者再次运行update命令,否则下载的代码版本不会更改。

The idea behind the deps.lock file is that it prevents you from accidentally upgrading your bundles to a more recent bug non-working version of the 3rd party bundle code. deps.lock文件背后的想法是,它可以防止您意外地将捆绑包升级到更新的第三方捆绑代码的错误非工作版本。 Symfony and it's bundles are under constant development, so changes (even if they're not bugs) happen pretty frequently and will break your code. Symfony和它的捆绑包都在不断发展,所以变化(即使它们不是错误)经常发生并且会破坏你的代码。 You'll probably want to get your versions locked down in deps.lock as soon as possible and only update when you feel like going out of your way to do so. 您可能希望尽快将您的版本锁定在deps.lock中,并且只有在您不想这样做时才会更新。

Once you've locked down your bundle versions in deps.lock, you'll just need to remove the related line from your deps.lock file the run one of the install commands to update a specific bundle, like I said in the short answer above. 一旦你在deps.lock中锁定了bundle版本,你只需要从deps.lock文件中删除相关的一行,运行一个install命令来更新一个特定的bundle,就像我在简短的回答中所说的那样以上。 If you then want to lock that code down to the version you just installed, you'll want to add a line to deps.lock yourself, or remove everything from deps and run php bin/vendor update like the answer above indicates. 如果您想将该代码锁定到刚刚安装的版本,您将需要自己为deps.lock添加一行,或者从deps中删除所有内容并运行php bin / vendor update,如上面的答案所示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM