gajdaw / stamp
版本管理工具,用于升级版本。
v0.2.0
2015-02-09 09:16 UTC
Requires
- php: >=5.3.3
- cypresslab/gitelephant: >=0.6.0
- symfony/config: ~2.6
- symfony/console: ~2.6
- symfony/dependency-injection: ~2.6
- symfony/process: ~2.6
- symfony/yaml: ~2.6
- twig/twig: ~1.0
Requires (Dev)
- behat/behat: ~3.0
- bossa/phpspec2-expect: ~1.0
README
使版本管理变得容易一些的应用程序。
1. 示例
假设您的应用程序包含一个名为metadata.json
的文件,其内容如下
{
"name": "gajdaw-php_phars",
"version": "0.1.4",
"author": "gajdaw"
}
要发布新版本,您可能会
- 将
metadata.json
中的版本从0.1.4
升级到0.1.5
- 提交更改,将提交消息设置为
版本 0.1.5
- 创建带有消息
发布 0.1.5
的注释标签v0.1.5
要使用stamp
应用程序执行上述操作,请从名为stamp.yml
的配置文件开始(位于您的项目根目录中)
filename: 'metadata.json'
regex: '/"version": "(?P<version>[\d\.]+)",/'
replacement: '"version": "{{ version }}",'
filename
参数设置要搜索版本的文件。
regex
参数设置用于解析文件的版本号的正则表达式。请注意,?P
将变量的名称设置为version
。
replacement
参数是表示新版本的字符串的Twig模板。此字符串将存储在由filename
定义的文件中。
2. 如何安装?
2.1. 手动下载
从以下位置下载可用的最新版本
https://github.com/gajdaw/stamp/releases/download/v0.2.0/stamp.phar
您可以使用以下方法完成此操作
wget -O stamp.phar http://github.com/gajdaw/stamp/releases/download/v0.2.0/stamp.phar
2. 运行stamp
由于stamp
尚未稳定,我建议在开始时使用--dry-run
和--verbose
选项。
以下是可用的命令列表
$ stamp patch:up --dry-run --verbose
$ stamp minor:up --dry-run --verbose
$ stamp major:up --dry-run --verbose
patch:up
命令执行以下转换
1.2.3 => 1.2.4
77.234.654 => 77.234.655
minor:up
命令增加中间的数字,并将补丁号设置为0
1.2.3 => 1.3.0
77.234.654 => 77.235.0
最后一个命令major:up
增加第一个数字,并将其他数字设置为0
1.2.3 => 2.0.0
77.234.654 => 78.0.0
3. 阅读列表
- https://github.com/vojtajina/grunt-bump
- https://github.com/maestrodev/puppet-blacksmith
- http://opensource.apple.com/source/libarchive/libarchive-30/libarchive/build/bump-version.sh
- http://stackoverflow.com/questions/4181185/what-does-bump-version-stands-for
- https://gist.github.com/pete-otaqui/4188238
- https://github.com/nvie/gitflow/blob/develop/bump-version
- https://docs.npmjs.net.cn/cli/version
4. 如何运行测试?
$ vagrant up
$ composer update
$ bin/phpspec run
$ bin/behat
5. 如何构建开发版本?
git checkout master
git checkout -b build
vagrant ssh
bin/stamp version:dev
./build.bash
git checkout master
git branch -D build
6. 致谢
本应用程序中的许多概念,尤其是测试方面,主要来自:https://github.com/phpspec/phpspec
非常感谢所有贡献者!
我直接使用了一些文件,例如在features/bootstrap/Matcher/
文件夹中的匹配器,没有进行任何修改。
对于其他片段(例如,在Stamp\Console\Application
中的parseConfigurationFile
方法),我更改了在phpspec中找到的代码。