作曲者Preferred-dist和Preferred-source之间的区别? [英] Difference between composer prefer-dist and prefer-source?

查看:134
本文介绍了作曲者Preferred-dist和Preferred-source之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查看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?

推荐答案

根据 http://getcomposer.org/doc/03-cli.md -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 ...



<中重新声明类Zend_Db_Adapter_Pdo_Abstract p>在使用-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之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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