使用git标签支持包版本

时间:2014-03-11 09:56:19

标签: json git composer-php restler packagist

我是Restler框架的作者,现在尝试使用正确命名的标签进行包版本控制。

我正在使用以下composer.json并按照https://getcomposer.org/doc/02-libraries.md#tags中的建议命名我的标记,您可以在https://github.com/Luracast/Restler/releases

看到

但是packagist没有列出版本包!

{
    "name": "luracast/restler",
    "type": "library",
    "description": "Restler is a simple and effective multi-format Web API Server framework written in PHP. Just deal with your business logic in php, Restler will take care of the REST!",
    "keywords": ["server", "api", "framework", "REST"],
    "homepage": "http://luracast.com/products/restler/",
    "license": "LGPL-2.1",
    "authors": [
        {
            "name": "Luracast",
            "email": "arul@luracast.com"
        },
        {
            "name": "Nick nickl- Lombard",
            "email": "github@jigsoft.co.za"
        }
    ],
    "require": {
        "php": ">=5.3.3"
    },
    "require-dev": {
        "luracast/explorer": "*",
        "guzzle/guzzle": "~3.1.1",
        "behat/behat": "2.4.*@stable",
        "rodneyrehm/plist": "dev-master",
        "zendframework/zendamf": "dev-master",
        "symfony/yaml": "*",
        "mustache/mustache": "dev-master",
        "twig/twig": "v1.13.0",
        "bshaffer/oauth2-server-php": "v1.0"
    },
    "suggest": {
        "luracast/explorer": "Restler's very own api explorer (see require-dev for details)",
        "guzzle/guzzle": "RESTful api HTTP client framework (see require-dev for details)",
        "behat/behat": "Behaviour driven development testing framework (see require-dev for details)",
        "rodneyrehm/plist": "Restler supports tho Apple plist xml format (see require-dev for details)",
        "zendframework/zendamf": "Support for the amf document format  (see require-dev for details)",
        "symfony/yaml": "Restler can produce content in yaml format as well (see require-dev for details)",
        "twig/twig": "Restler can render HtmlView using twig templates (see require-dev for details)",
        "mustache/mustache": "Restler can render HtmlView using mustache/handlebar templates (see require-dev for details)",
        "bshaffer/oauth2-server-php": "Restler can provide OAuth2 authentication using this library (see require-dev for details)"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/zendframework/ZendAmf.git"
        },
        {
            "type": "package",
            "package": {
                "name": "luracast/explorer",
                "version": "v3.0.0",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/Luracast/Restler-API-Explorer/zipball/v3.0.0"
                }
            }
        }
    ],
    "autoload": {
        "psr-0": {
            "Luracast\\Restler": "vendor/"
        }
    },
    "minimum-stability": "dev",
    "extra": {
        "branch-alias": {
            "v3": "3.0.x-dev"
        }
    }
}

我可以看到像symfony/symfony这样的项目正在使用类似的composer.json和类似的分支名称,但它们在包装上显示得很好

无法找出任何解决方案!非常感谢任何帮助

1 个答案:

答案 0 :(得分:1)

有一种简单的方法来调试它,你创建一个包含你的存储库的composer.json,即:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Luracast/Restler"
        }
    ]
}

然后运行composer show -v luracast/restler,-v将在解析git repo时显示详细信息。该命令的输出是:

Reading composer.json of luracast/restler (3.0.0-RC1)
Skipped tag 3.0.0-RC1, tag (3.0.0.0-RC1) does not match version (3.0.0.0) in composer.json
Reading composer.json of luracast/restler (3.0.0)
Importing tag 3.0.0 (3.0.0.0)
Reading composer.json of luracast/restler (2.2.0)
Skipped tag 2.2.0, no composer file
Reading composer.json of luracast/restler (1.0.20)
Skipped tag 1.0.20, no composer file
Reading composer.json of luracast/restler (features/AOP)
Importing branch features/AOP (dev-features/AOP)
Reading composer.json of luracast/restler (features/forms)
Importing branch features/forms (dev-features/forms)
Reading composer.json of luracast/restler (features/html)
Importing branch features/html (dev-features/html)
Reading composer.json of luracast/restler (features/oauth)
Importing branch features/oauth (dev-features/oauth)
Reading composer.json of luracast/restler (features/router)
Importing branch features/router (dev-features/router)
Reading composer.json of luracast/restler (features/swagger1.2)
Importing branch features/swagger1.2 (dev-features/swagger1.2)
Reading composer.json of luracast/restler (master)
Importing branch master (dev-master)
Reading composer.json of luracast/restler (v1)
Skipped branch v1, no composer file
Reading composer.json of luracast/restler (v2)
Skipped branch v2, no composer file
Reading composer.json of luracast/restler (v3)
Importing branch v3 (3.x-dev)

name     : luracast/restler
descrip. : Restler is a simple and effective multi-format Web API Server framework written in PHP. Just deal with your business logic in php, Restler will take care of the REST!
keywords : server, api, framework, REST
versions : dev-master, 3.x-dev, v3.0.0, dev-features/swagger1.2, dev-features/AOP, dev-features/forms, dev-features/oauth, dev-features/html, dev-features/router

如您所见,标签已被跳过,因为它们缺少composer.json或版本不匹配(我看到您删除了主分支中的版本,这是正确的做法)。仅成功导入了一个标记(3.0.0),并显示在版本列表的第二位输出中。

所以换句话说,一切都很好,你从master分支创建的新标签应该在packagist上显示没有问题,以及已经存在的3.0.0。