corley/version-bundle

Corley版本包

安装: 586

依赖项: 0

建议者: 0

安全: 0

星标: 3

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

0.0.6 2014-10-20 07:09 UTC

This package is not auto-updated.

Last update: 2024-09-10 02:28:03 UTC


README

SensioLabsInsight

  • 主分支:构建状态
  • 开发:构建状态

仅为了在Symfony2应用程序中统一提升应用程序版本

在你的 AppKernel.php

public function registerBundles()
{
    ...
    $bundles = array(
        ...
        new Corley\VersionBundle\CorleyVersionBundle(),
    );
    ...
    return $bundles;
}

并使用它!

app/console corley:version:bump 0.0.1

查看实际版本

app/console corley:version:show

该包在您的 config 文件夹中创建/更新一个 version.yml 文件。就这样...没什么大不了的...

在你的 config/config.yml 中添加一个导入

imports:
    - { resource: version.yml }

如果你想在模板中打印它,只需在twig配置中添加版本号

# config/config.yml
twig:
    globals:
        version: %version%

现在你可以在模板中使用它了

<footer>
    Version: {{ version.number }}
</footer>

你还可以在静态资源后附加版本号

{% javascripts
    '@CorleyBaseBundle/Resources/public/js/jquery.min.js'
    '@CorleyBaseBundle/Resources/public/bootstrap/js/bootstrap.min.js'
    '@CorleyBaseBundle/Resources/public/select2/select2.min.js'
    '@CorleyBaseBundle/Resources/public/js/bootstrap-datepicker.js'
    '@CorleyBaseBundle/Resources/public/js/theme.js' filter='uglifyjs' output='js/compiled/base.js' %}
    <script type="text/javascript" src="{{ asset_url }}?v={{ version.number }}"></script>
{% endjavascripts %}

或者你可以在你的git流程发布过程中使用它

$ git flow release start 1.0.0
$ app/console corley:version:bump 1.0.0
$ git commit -a -m "Bumped version 1.0.0"
$ git flow release finish 1.0.0

使用composer安装

在你的 composer.json 中添加要求

"require": {
    "corley/version-bundle": "~1"
}

还将存储库添加到你的composer中