corley / version-bundle
Corley版本包
0.0.6
2014-10-20 07:09 UTC
Requires
- php: >= 5.3.3
- symfony/console: ~2
- symfony/dependency-injection: ~2
- symfony/framework-bundle: ~2
- symfony/security-bundle: ~2
Requires (Dev)
- mikey179/vfsstream: 1.*
- phpunit/phpunit: ~4
README
仅为了在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中