问题描述
在查看PHP Composer的 install
命令的帮助时,我看到以下两个选项
Looking at the help for PHP Composer's install
command, I see the following two options
$ composer help install
Options:
--prefer-source Forces installation from package sources when possible, including VCS information.
--prefer-dist Forces installation from package dist even for dev versions.
什么是 dist安装?我在作曲家网站和Google周围闲逛,但似乎没有任何东西可以解决这个问题(所以我认为这对熟悉Composer的人来说是核心和显而易见的-为新手问题表示歉意)
What's a "dist" installation? I poked around the composer site and Google but there didn't seem to be anything that addressed this (So I assume it's something core and obvious to folks familiar with Composer — apologies for the newbie question)
我假设在-prefer-source
中,Composer将向Packagist询问存储库的位置,然后检出/克隆/导出/等。项目本身。
I'm assuming --prefer-source
is where Composer will ask Packagist for the repository location, and then checkout/clone/export/etc. the project itself.
如果是,那么-prefer-dist
从哪里下载?它会下载什么?
If so, then where does --prefer-dist
download from? What does it download?
推荐答案
根据,-prefer-source
选项将更喜欢创建一个包目录是版本控制存储库。这等效于您键入:
According to http://getcomposer.org/doc/03-cli.md, the --prefer-source
option will prefer to create a package directory that is a "version control repository". This is equivalent to you typing:
$ git clone ...
或
$ svn checkout ...
-prefer-dist
选项将优先创建一个非版本控制存储库,相当于您键入:
The --prefer-dist
option will prefer to create a non-"version control repository", which is equivalent to you typing:
$ git clone ... ; rm -fr dir/.git
或
$ svn export ...
也可以在您的 composer.json
source 和 dist
定义单独的存储库>。例如:
Also, you can define separate repos for source
and dist
in your composer.json
. Here's an example:
{
"repositories": [
{
"type": "package",
"package": {
"name": "joshuaclayton/blueprint-css",
"version": "master",
"source": {
"url": "git://github.com/joshuaclayton/blueprint-css.git",
"type": "git",
"reference": "master",
}
}
},
{
"type": "package",
"package": {
"name": "fiftyone/mobi-lite-php",
"version": "2013.03.06",
"dist": {
"url": "http://iweb.dl.sourceforge.net/project/fiftyone/51Degrees.mobi-Lite-2013.03.06.php.zip",
"type": "zip"
},
}
}
]
}
注意:出于任何原因,当我使用-prefer-dist
时,有时会出现诸如
NOTE: for whatever reason, when I use --prefer-dist
, I sometimes get errors such as
Fatal error: Cannot redeclare class Zend_Db_Adapter_Pdo_Abstract in ...
在使用-prefer-source
时不会出现。因此,我只使用-prefer-source
,直到找出导致此问题的原因。
which do not appear when I use --prefer-source
. For this reason, I only use --prefer-source
, until I figure out the cause of this issue.
这篇关于作曲者Preferred-dist和Preferred-source之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!