Composer更新未反映存储库更改

时间:2013-10-31 21:45:52

标签: php composer-php

我有跟随composer.json

{
    "name": "mjohnson/transit",
    "type": "library",
    "description": "A file uploader, validator, importer and transformer library.",
    "keywords": [
        "transit", "file", "uploader", "validator", "importer", "transformer", "transporter",
        "image", "audio", "video", "text", "application", "archive", "s3", "glacier"
    ],
    "homepage": "http://milesj.me/code/php/transit",
    "license": "MIT",
    "authors": [
        {
            "name": "Miles Johnson",
            "homepage": "http://milesj.me"
        }
    ],
    "require": {
        "php": ">=5.3.0",
        "ext-curl": "*",
        "ext-mbstring": "*",
        "aws/aws-sdk-php": "2.0.*"
    },
    "support": {
        "source": "https://github.com/milesj/php-transit"
    },
    "autoload": {
        "psr-0": { "Transit": "src/" }
    }
}

当我运行composer update时,源代码未更新以反映当前存储库:https://github.com/milesj/transit

我尝试删除锁定文件whitout成功。试过composer [update|install}

例如,我当前的(本地)代码:

src/Transit/File.php

[...]
public function __construct($path) {
    if (!file_exists($path)) {
        throw new IoException(sprintf('%s does not exist', $path));
    }

    $this->_path = $path;
}
[...]

当前repository code

[...]
public function __construct($path) {
    if (is_array($path)) {
        if (empty($path['tmp_name'])) {
            throw new IoException('Passing via array must use $_FILES data');
        }

        $this->_data = $path;
        $path = $path['tmp_name'];
    }

    if (!file_exists($path)) {
        throw new IoException(sprintf('%s does not exist', $path));
    }

    $this->_path = $path;

    // @version 1.3.2 Rename file to add ext if ext is missing
    if (!$this->ext()) {
        $this->rename();
    }

    // @version 1.4.0 Reset the cache
    $this->_cache = array();
}
[...]

1 个答案:

答案 0 :(得分:1)

你错了composer.json。你提到的那个是名为“mjohnson / transit”的图书馆 - 如果你没有开发这个确切的软件,那就错了。

您应该创建一个至少包含以下行的新composer.json文件:

{ "require": { "mjohnson/transit" : "*" } }

然后运行composer install

我不知道你为了获得composer.json文件做了什么,但如果你最初克隆了那个其他存储库,现在编辑该文件,事情就会破裂!备份您的代码(如果有)。尝试在不撤消自己的代码的情况下撤消错误。