Skip to content

Commit a9e5b7e

Browse files
author
Audrius Karabanovas
authored
Merge pull request #32 from afoeder/master
[BUGFIX] Remove b/c incompatible changes
2 parents 8ae4316 + 0963729 commit a9e5b7e

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

Command/VersionBumpCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ protected function configure()
3636

3737
protected function execute(InputInterface $input, OutputInterface $output)
3838
{
39-
$kernelRoot = $this->getContainer()->getParameter('kernel.project_dir');
39+
$projectDir = $this->getContainer()->getParameter('kernel.project_dir');
4040
$file = $this->getContainer()->getParameter('shivas_versioning.version_file');
4141
$param = $this->getContainer()->getParameter('shivas_versioning.version_parameter');
42-
$paramFile = "{$kernelRoot}/config/{$file}";
42+
$paramFile = "{$projectDir}/app/config/{$file}";
4343

4444
/** @var VersionsManager $manager */
4545
$manager = $this->getContainer()->get('shivas_versioning.manager');

DependencyInjection/Configuration.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
55
use Symfony\Component\Config\Definition\ConfigurationInterface;
6+
use Symfony\Component\HttpKernel\Kernel;
67

78
class Configuration implements ConfigurationInterface
89
{
@@ -20,7 +21,11 @@ public function getConfigTreeBuilder()
2021
->defaultValue('application_version')
2122
->end()
2223
->scalarNode('version_file')
23-
->defaultValue('parameters.yaml')
24+
->defaultValue(
25+
version_compare(Kernel::VERSION, '4.0', '>=')
26+
? 'parameters.yaml'
27+
: 'parameters.yml'
28+
)
2429
->end()
2530
->scalarNode(('version_formatter'))
2631
->defaultValue('shivas_versioning.formatters.git')

README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Simple way to version your Symfony application.
1010
What it is:
1111
-
1212

13-
- Adds additional parameter to your parameters.yml file and keeps it inline with your current application version.
13+
- Adds additional parameter to your parameters.yaml file and keeps it inline with your current application version.
1414
- Basic Version providers implemented for manual and *git tag* versioning
1515
- Easy to extend with new providers for different SCM's or needs
1616
- Uses Semantic Versioning 2.0.0 recommendations using https://github.com/nikolaposa/version library
@@ -65,35 +65,35 @@ Default configuration of bundle looks like this:
6565
# Default configuration for "ShivasVersioningBundle"
6666
shivas_versioning:
6767
version_parameter: application_version
68-
version_file: parameters.yml
68+
version_file: parameters.yaml
6969
version_formatter: shivas_versioning.formatters.git
7070
```
7171

72-
That means in the parameters file the `application_version` variable will be created and updated on every version bump, you can change the name to anything you want by writing that in your config.yml file.
73-
You may also specify a file other than `parameters.yml` if you would like to use a custom file. If so, make sure to import it in your config.yml file - you may want to use `ignore_errors` on the import
72+
That means in the parameters file the `application_version` variable will be created and updated on every version bump, you can change the name to anything you want by writing that in your config.yaml file.
73+
You may also specify a file other than `parameters.yaml` if you would like to use a custom file. If so, make sure to import it in your config.yaml file - you may want to use `ignore_errors` on the import
7474
to avoid issues if the file does not yet exist.
7575

7676
```yaml
77-
# app/config/config.yml
77+
# app/config/config.yaml
7878
imports:
79-
- { resource: sem_var.yml, ignore_errors: true }
79+
- { resource: sem_var.yaml, ignore_errors: true }
8080

8181
shivas_versioning:
82-
version_file: sem_var.yml
82+
version_file: sem_var.yaml
8383
```
8484
8585
The default version formatter is `shivas_versioning.formatters.git`. This formatter shows the version from the Git tag and adds dev.commithash as a prerelease when not on the tag commit. If you want you can disable this formatter or create your own.
8686

8787
```yaml
88-
# app/config/config.yml
88+
# app/config/config.yaml
8989
shivas_versioning:
9090
version_formatter: ~
9191
```
9292

9393
Displaying version
9494
-
9595

96-
To display the version in the page title for example, you can add the following to your config.yml:
96+
To display the version in the page title for example, you can add the following to your config.yaml:
9797
```yaml
9898
twig:
9999
globals:
@@ -105,7 +105,7 @@ And then, in your Twig layout display it with the global variable:
105105
<title>{{ app_version }}</title>
106106
```
107107

108-
Alternatively, if you want to display the version automatically without having to bump it first, set `config.yml` to :
108+
Alternatively, if you want to display the version automatically without having to bump it first, set `config.yaml` to :
109109
```yaml
110110
twig:
111111
globals:
@@ -159,15 +159,15 @@ Run in console
159159
And notice your new provider is above old one:
160160
```
161161
Registered Version providers
162-
============ ========== ===================================== ===========
162+
============ ========== ====================================== ===========
163163
Alias Priority Name Supported
164-
============ ========== ===================================== ===========
165-
my_own_git 20 Git tag describe provider Yes
166-
git 0 Git tag describe provider Yes
167-
revision -25 REVISION file provider Yes
168-
parameter -50 parameters.yml file version provider Yes
169-
init -100 Initial version (0.1.0) provider Yes
170-
============ ========== ===================================== ===========
164+
============ ========== ====================================== ===========
165+
my_own_git 20 Git tag describe provider Yes
166+
git 0 Git tag describe provider Yes
167+
revision -25 REVISION file provider Yes
168+
parameter -50 parameters.yaml file version provider Yes
169+
init -100 Initial version (0.1.0) provider Yes
170+
============ ========== ====================================== ===========
171171
```
172172
173173
So, the next time you execute a version bump, your custom git provider will provide the version string.
@@ -206,15 +206,15 @@ Add the formatter to the container using your services file (xml in my case):
206206

207207
Finally register your own formatter in the configuration.
208208
```yaml
209-
# app/config/config.yml
209+
# app/config/config.yaml
210210
shivas_versioning:
211211
version_formatter: mycustom_git_formatter
212212
```
213213
214214
Make Composer bump your version on install
215215
-
216216
217-
Add script handler
217+
Add script handler
218218
219219
```
220220
Shivas\\VersioningBundle\\Composer\\ScriptHandler::bumpVersion

0 commit comments

Comments
 (0)