sycersion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.sycersion/environment.yml +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +121 -0
- data/LICENSE.txt +21 -0
- data/README.md +133 -0
- data/Rakefile +13 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/sycersion +9 -0
- data/lib/sycersion/options.rb +96 -0
- data/lib/sycersion/semver.rb +40 -0
- data/lib/sycersion/version.rb +5 -0
- data/lib/sycersion/version_compare.rb +90 -0
- data/lib/sycersion/version_environment.rb +169 -0
- data/lib/sycersion/version_incrementer.rb +40 -0
- data/lib/sycersion/version_info.rb +20 -0
- data/lib/sycersion/version_setter.rb +38 -0
- data/lib/sycersion.rb +57 -0
- data/man/sycersion.1 +184 -0
- data/man/sycersion.1.html +211 -0
- data/man/sycersion.1.ronn +114 -0
- data/notes/design.md +2 -0
- data/notes/setup.md +106 -0
- data/notes/versioning.md +167 -0
- data/sycersion.gemspec +45 -0
- metadata +129 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>sycersion(1) - manage application versions according to semantic versioning</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#Description">Description</a>
|
59
|
+
<a href="#FILES">FILES</a>
|
60
|
+
<a href="#OPTIONS">OPTIONS</a>
|
61
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
62
|
+
<a href="#ENVIRONMENT">ENVIRONMENT</a>
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<ol class='man-decor man-head man head'>
|
66
|
+
<li class='tl'>sycersion(1)</li>
|
67
|
+
<li class='tc'></li>
|
68
|
+
<li class='tr'>sycersion(1)</li>
|
69
|
+
</ol>
|
70
|
+
|
71
|
+
<h2 id="NAME">NAME</h2>
|
72
|
+
<p class="man-name">
|
73
|
+
<code>sycersion</code> - <span class="man-whatis">manage application versions according to semantic versioning</span>
|
74
|
+
</p>
|
75
|
+
|
76
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
77
|
+
|
78
|
+
<pre><code>`sycersion` `--init`
|
79
|
+
`sycersion` `-i`|`--info`
|
80
|
+
`sycersion` `--inc major|minor|patch`
|
81
|
+
`sycersion` `--set major.minor.patch[+build|-pre-release+build]`
|
82
|
+
`sycersion` `-p`|`--pre` `pre-release`
|
83
|
+
`sycersion` `-b`|`--build` `build`
|
84
|
+
`sycersion` `-c`|`--compare` `version`
|
85
|
+
`sycersion` `-h`|`--help`
|
86
|
+
</code></pre>
|
87
|
+
|
88
|
+
<h2 id="Description">Description</h2>
|
89
|
+
|
90
|
+
<p><strong>sycersion</strong> is a command-line tool to manage application versions following
|
91
|
+
the guiding principles of <em>semantic versioning</em> found at
|
92
|
+
<a href="https://semver.org">semver.org</a>.</p>
|
93
|
+
|
94
|
+
<p><strong>sycersion</strong> has a default start version of 0.1.0. This can be activitated with
|
95
|
+
the initalization running <code>sycersion --init</code>. During this intialization another
|
96
|
+
version can be chosen. The version is saved to the <em>version-file</em> and also the
|
97
|
+
<em>configuration-directory</em> is created. While initialization <strong>sycersion</strong>
|
98
|
+
additionally searches for files that contain a version according to semantic
|
99
|
+
versioning and the user can select out of the list of files which version out of
|
100
|
+
that files to intially start with.</p>
|
101
|
+
|
102
|
+
<p>The <em>version-file</em> and <em>configuration-directory</em> are also created it the user is
|
103
|
+
setting an initial version with <code>sycersion --set 0.1.1</code>.</p>
|
104
|
+
|
105
|
+
<p>If the version is updated the version is written into the <em>version-file</em>. Within
|
106
|
+
the application the version can be read from the file and displayed somewhere in
|
107
|
+
the application's UI.</p>
|
108
|
+
|
109
|
+
<p><strong>sycersion</strong> evaluates version numbers provided that they comply to semantic
|
110
|
+
versioning.</p>
|
111
|
+
|
112
|
+
<p>If <strong>sycersion</strong> is used within a <em>Ruby</em> application, it can be added to the
|
113
|
+
development section within the Gemfile.</p>
|
114
|
+
|
115
|
+
<h2 id="FILES">FILES</h2>
|
116
|
+
|
117
|
+
<pre><code>`.sycersion` is the configuration directory
|
118
|
+
`.sycersion/environment.yml` holds the version file and the version
|
119
|
+
`.sycersion/version` contains the version
|
120
|
+
</code></pre>
|
121
|
+
|
122
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
123
|
+
|
124
|
+
<ul>
|
125
|
+
<li><code>--init</code>
|
126
|
+
Initializes the <strong>sycersion</strong> environment with <em>version</em> and <em>version-file</em></li>
|
127
|
+
<li><code>-i</code>, <code>--info VERSION|SUMMARY</code>
|
128
|
+
Shows the current <em>version</em> (default) or additionally information about the
|
129
|
+
<em>version-file</em>, the <em>configuration-directory</em> and <em>code</em> how to read the
|
130
|
+
version within an application.</li>
|
131
|
+
<li><code>--inc MAJOR|MINOR|PATCH</code>
|
132
|
+
increments the major, minor, patch part of the version.</li>
|
133
|
+
<li><code>--set MAJOR.MINOR.PATCH[+BUILD|-PRE_RELEASE[+BUILD]]</code>
|
134
|
+
sets the version where all three version parts need to be provided,
|
135
|
+
major.minor.patch with optionally adding a pre-release part and/or a build
|
136
|
+
part.</li>
|
137
|
+
<li><code>--pre PRE-RELEASE</code>
|
138
|
+
Set the pre-release part in the version</li>
|
139
|
+
<li><code>--build BUILD</code>
|
140
|
+
Set the build part in the version</li>
|
141
|
+
<li><code>-c</code>, <code>--compare VERSION</code>
|
142
|
+
Compares the current version with the version provided following the semver
|
143
|
+
precedence guidline</li>
|
144
|
+
<li><code>--help</code>
|
145
|
+
Prints the command line help</li>
|
146
|
+
</ul>
|
147
|
+
|
148
|
+
|
149
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
150
|
+
|
151
|
+
<p>Initialize <strong>sycersion</strong></p>
|
152
|
+
|
153
|
+
<pre><code>$ sycersion --init
|
154
|
+
</code></pre>
|
155
|
+
|
156
|
+
<p>Set the version with pre-release</p>
|
157
|
+
|
158
|
+
<pre><code>$ sycersion --set 0.1.1-beta.1.0
|
159
|
+
</code></pre>
|
160
|
+
|
161
|
+
<p>Set the version with a build</p>
|
162
|
+
|
163
|
+
<pre><code>$ sycersion --set 0.1.1+build-a.1
|
164
|
+
</code></pre>
|
165
|
+
|
166
|
+
<p>Set the version with a pre-release and a build</p>
|
167
|
+
|
168
|
+
<pre><code>$ sycersion --set 0.1.1-beta.1.0+build-a.1
|
169
|
+
</code></pre>
|
170
|
+
|
171
|
+
<p>Show the current version</p>
|
172
|
+
|
173
|
+
<pre><code>$ sycersion -i
|
174
|
+
0.1.1-beta.1.0+build-a.1
|
175
|
+
</code></pre>
|
176
|
+
|
177
|
+
<p>Increment minor part of the version 0.1.1, which will lead to 0.2.0</p>
|
178
|
+
|
179
|
+
<pre><code>$ sycersion --inc minor
|
180
|
+
$ sycersion -i
|
181
|
+
0.2.0
|
182
|
+
</code></pre>
|
183
|
+
|
184
|
+
<p>When increasing one of major, minor or patch, the subsequent numbers are eather
|
185
|
+
reset to 0 or pre-release and build are removed.</p>
|
186
|
+
|
187
|
+
<p>Compare the assumed current version 0.1.1 to the provided version</p>
|
188
|
+
|
189
|
+
<pre><code>$ sycersion -c 0.1.1-alpha
|
190
|
+
0.1.1 > 0.1.1-alpha
|
191
|
+
</code></pre>
|
192
|
+
|
193
|
+
<h2 id="ENVIRONMENT">ENVIRONMENT</h2>
|
194
|
+
|
195
|
+
<ul>
|
196
|
+
<li>SYC_DEBUG=true
|
197
|
+
Will display erros and show contents of the parsed options. To be called as
|
198
|
+
<code>SYC_DEBUG=true sycersion [options]</code></li>
|
199
|
+
</ul>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<ol class='man-decor man-foot man foot'>
|
204
|
+
<li class='tl'></li>
|
205
|
+
<li class='tc'>January 2025</li>
|
206
|
+
<li class='tr'>sycersion(1)</li>
|
207
|
+
</ol>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
</body>
|
211
|
+
</html>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
sycersion(1) -- manage application versions according to semantic versioning
|
2
|
+
============================================================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`sycersion` `--init`
|
7
|
+
`sycersion` `-i`|`--info`
|
8
|
+
`sycersion` `--inc major|minor|patch`
|
9
|
+
`sycersion` `--set major.minor.patch[+build|-pre-release+build]`
|
10
|
+
`sycersion` `-p`|`--pre` `pre-release`
|
11
|
+
`sycersion` `-b`|`--build` `build`
|
12
|
+
`sycersion` `-c`|`--compare` `version`
|
13
|
+
`sycersion` `-h`|`--help`
|
14
|
+
|
15
|
+
## Description
|
16
|
+
|
17
|
+
**sycersion** is a command-line tool to manage application versions following
|
18
|
+
the guiding principles of _semantic versioning_ found at
|
19
|
+
[semver.org](https://semver.org).
|
20
|
+
|
21
|
+
**sycersion** has a default start version of 0.1.0. This can be activitated with
|
22
|
+
the initalization running `sycersion --init`. During this intialization another
|
23
|
+
version can be chosen. The version is saved to the _version-file_ and also the
|
24
|
+
_configuration-directory_ is created. While initialization **sycersion**
|
25
|
+
additionally searches for files that contain a version according to semantic
|
26
|
+
versioning and the user can select out of the list of files which version out of
|
27
|
+
that files to intially start with.
|
28
|
+
|
29
|
+
The _version-file_ and _configuration-directory_ are also created it the user is
|
30
|
+
setting an initial version with `sycersion --set 0.1.1`.
|
31
|
+
|
32
|
+
If the version is updated the version is written into the _version-file_. Within
|
33
|
+
the application the version can be read from the file and displayed somewhere in
|
34
|
+
the application's UI.
|
35
|
+
|
36
|
+
**sycersion** evaluates version numbers provided that they comply to semantic
|
37
|
+
versioning.
|
38
|
+
|
39
|
+
If **sycersion** is used within a _Ruby_ application, it can be added to the
|
40
|
+
development section within the Gemfile.
|
41
|
+
|
42
|
+
## FILES
|
43
|
+
|
44
|
+
`.sycersion` is the configuration directory
|
45
|
+
`.sycersion/environment.yml` holds the version file and the version
|
46
|
+
`.sycersion/version` contains the version
|
47
|
+
|
48
|
+
## OPTIONS
|
49
|
+
|
50
|
+
* `--init`
|
51
|
+
Initializes the **sycersion** environment with _version_ and _version-file_
|
52
|
+
* `-i`, `--info VERSION|SUMMARY`
|
53
|
+
Shows the current _version_ (default) or additionally information about the
|
54
|
+
_version-file_, the _configuration-directory_ and _code_ how to read the
|
55
|
+
version within an application.
|
56
|
+
* `--inc MAJOR|MINOR|PATCH`
|
57
|
+
increments the major, minor, patch part of the version.
|
58
|
+
* `--set MAJOR.MINOR.PATCH[+BUILD|-PRE_RELEASE[+BUILD]]`
|
59
|
+
sets the version where all three version parts need to be provided,
|
60
|
+
major.minor.patch with optionally adding a pre-release part and/or a build
|
61
|
+
part.
|
62
|
+
* `--pre PRE-RELEASE`
|
63
|
+
Set the pre-release part in the version
|
64
|
+
* `--build BUILD`
|
65
|
+
Set the build part in the version
|
66
|
+
* `-c`, `--compare VERSION`
|
67
|
+
Compares the current version with the version provided following the semver
|
68
|
+
precedence guidline
|
69
|
+
* `--help`
|
70
|
+
Prints the command line help
|
71
|
+
|
72
|
+
## EXAMPLES
|
73
|
+
|
74
|
+
Initialize **sycersion**
|
75
|
+
|
76
|
+
$ sycersion --init
|
77
|
+
|
78
|
+
Set the version with pre-release
|
79
|
+
|
80
|
+
$ sycersion --set 0.1.1-beta.1.0
|
81
|
+
|
82
|
+
Set the version with a build
|
83
|
+
|
84
|
+
$ sycersion --set 0.1.1+build-a.1
|
85
|
+
|
86
|
+
Set the version with a pre-release and a build
|
87
|
+
|
88
|
+
$ sycersion --set 0.1.1-beta.1.0+build-a.1
|
89
|
+
|
90
|
+
Show the current version
|
91
|
+
|
92
|
+
$ sycersion -i
|
93
|
+
0.1.1-beta.1.0+build-a.1
|
94
|
+
|
95
|
+
Increment minor part of the version 0.1.1, which will lead to 0.2.0
|
96
|
+
|
97
|
+
$ sycersion --inc minor
|
98
|
+
$ sycersion -i
|
99
|
+
0.2.0
|
100
|
+
|
101
|
+
When increasing one of major, minor or patch, the subsequent numbers are eather
|
102
|
+
reset to 0 or pre-release and build are removed.
|
103
|
+
|
104
|
+
Compare the assumed current version 0.1.1 to the provided version
|
105
|
+
|
106
|
+
$ sycersion -c 0.1.1-alpha
|
107
|
+
0.1.1 > 0.1.1-alpha
|
108
|
+
|
109
|
+
## ENVIRONMENT
|
110
|
+
|
111
|
+
* SYC_DEBUG=true
|
112
|
+
Will display erros and show contents of the parsed options. To be called as
|
113
|
+
`SYC_DEBUG=true sycersion [options]`
|
114
|
+
|
data/notes/design.md
ADDED
data/notes/setup.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# Setting up the project
|
2
|
+
We are creating an application that is creating versions for applications
|
3
|
+
following the semantic versioning as defined in [semver.org](sever.org).
|
4
|
+
|
5
|
+
## Development environment
|
6
|
+
The application is written in Ruby in a test driven development manner using
|
7
|
+
rspec and cucumber with aruba. We are managing our source code in git.
|
8
|
+
|
9
|
+
There are two ways of setting up the development environment.
|
10
|
+
|
11
|
+
1. Using bundler to create a standard directory structure with most of the
|
12
|
+
files or
|
13
|
+
2. Set up the structure manually
|
14
|
+
|
15
|
+
### Setup with bundler
|
16
|
+
To use bundler [bundler.io](https://bundler.io/guides/creating_gem.html) we just go into our working directory, select the Ruby version
|
17
|
+
we want to work with and then issue the bundle command
|
18
|
+
|
19
|
+
$ cd ~/Work
|
20
|
+
$ rvm ruby-2.5.7
|
21
|
+
$ rvm gemset create sycersion
|
22
|
+
$ rvm ruby-2.5.7@sycersio
|
23
|
+
$ bundle gem sycersion
|
24
|
+
|
25
|
+
This will create a directory `~/Work/sycersion` with a directory structure
|
26
|
+
|
27
|
+
+-- bin
|
28
|
+
| +-- console
|
29
|
+
| +-- setup
|
30
|
+
+-- CODE_OF_CONDUCT.md
|
31
|
+
+-- Gemfile
|
32
|
+
+-- Gemfile.lock
|
33
|
+
+-- lib
|
34
|
+
| +-- sycersion
|
35
|
+
| | +-- version.rb
|
36
|
+
| +-- sycersion.rb
|
37
|
+
+-- LICENSE.txt
|
38
|
+
+-- Rakefile
|
39
|
+
+-- README.md
|
40
|
+
+-- spec
|
41
|
+
| +-- spec_helper.rb
|
42
|
+
| +-- sycersion_spec.rb
|
43
|
+
+-- sycersion.gemspec
|
44
|
+
|
45
|
+
The `bundle gem sycersion` is also installing rspec and intializtion our git
|
46
|
+
repository. To also install _aruba_ we add it as an development dependency
|
47
|
+
to `sycersion.gemspec and run "bundle install".
|
48
|
+
|
49
|
+
In order to use _aruba_ with _cucumber_ we have to run
|
50
|
+
|
51
|
+
$ cucumber --init
|
52
|
+
create features
|
53
|
+
create features/step_definitions
|
54
|
+
create features/support
|
55
|
+
create features/support/env.rb
|
56
|
+
|
57
|
+
### Setup manually
|
58
|
+
To set up the environment manually we do
|
59
|
+
|
60
|
+
* create a working directory
|
61
|
+
* create a gemset for the application
|
62
|
+
* install rspec and aruba
|
63
|
+
* add the application directory to git
|
64
|
+
|
65
|
+
$ mkdir ~/Work/sycversion
|
66
|
+
$ cd ~/Work/sycversion
|
67
|
+
$ mkdir bin
|
68
|
+
$ mkdir doc
|
69
|
+
$ mkdir lib
|
70
|
+
$ touch README.rdoc
|
71
|
+
|
72
|
+
We select the ruby version we want to develop the application with and create
|
73
|
+
the gemset for that ruby version
|
74
|
+
|
75
|
+
$ rvm 2.5.7
|
76
|
+
$ rvm gemset create sycversion
|
77
|
+
|
78
|
+
Change to the gemset sycversion
|
79
|
+
|
80
|
+
$ rvm ruby-2.5.7@sycversion
|
81
|
+
|
82
|
+
Install respec and aruba for tests
|
83
|
+
|
84
|
+
$ gem install rspec
|
85
|
+
$ gem install aruba
|
86
|
+
|
87
|
+
Initialize test environment
|
88
|
+
|
89
|
+
$ rspec --init
|
90
|
+
|
91
|
+
Add the working directory to git
|
92
|
+
|
93
|
+
$ git init
|
94
|
+
$ git add .
|
95
|
+
$ git commit -am "initial commit"
|
96
|
+
|
97
|
+
Directory struckture after setup
|
98
|
+
|
99
|
+
+-bin
|
100
|
+
+-doc
|
101
|
+
+-setup.md
|
102
|
+
+-lib
|
103
|
+
+-spec
|
104
|
+
+-spec_helper.rb
|
105
|
+
|
106
|
+
|
data/notes/versioning.md
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# Versioning
|
2
|
+
`sycversion` is based on
|
3
|
+
|
4
|
+
* the article [A successful Git branching model](https://nvie.com/posts/a-successful-git-branching-model/) from Vincent Driessen and
|
5
|
+
* the [semantic versioning](https://semver.org) philosophy
|
6
|
+
|
7
|
+
## Git Branching Model
|
8
|
+
With branching we organize the code with clear responsibilities for each
|
9
|
+
branch and a clear purpose and stage of software being in a specific branch.
|
10
|
+
|
11
|
+
Following the meaning of a branch is explained and how we branch in
|
12
|
+
different stages.
|
13
|
+
|
14
|
+
The tabel shows the relation of branches between each other. To be read from
|
15
|
+
top, down to right, e.g. Master branches into Development. Hotfix merges into
|
16
|
+
Master.
|
17
|
+
|
18
|
+
--------------------------------------------------------------------------------
|
19
|
+
Master Development Feature Release Hotfix
|
20
|
+
---------- ----------------- ----------- ----------- --------- -----------------
|
21
|
+
- merge - merge merge Master
|
22
|
+
|
23
|
+
branch - merge merge merge Development
|
24
|
+
|
25
|
+
- branch - - - Feature
|
26
|
+
|
27
|
+
- branch - - - Release
|
28
|
+
|
29
|
+
branch - - - - Hotfix
|
30
|
+
|
31
|
+
--------------------------------------------------------------------------------
|
32
|
+
|
33
|
+
### Master
|
34
|
+
The master branch contains code that is allways in a production state. All
|
35
|
+
software that is in the master branch is released. Each released version is
|
36
|
+
tagged with a Git tag.
|
37
|
+
|
38
|
+
### Development
|
39
|
+
Branched off from Master
|
40
|
+
|
41
|
+
$ git checkout -b development master
|
42
|
+
|
43
|
+
Code in the development branch most likely will have code that is between
|
44
|
+
different releases it has more functions as the last release and is intended
|
45
|
+
to be released with the next version.
|
46
|
+
|
47
|
+
Branched into Master
|
48
|
+
|
49
|
+
$ git checkout master
|
50
|
+
$ git merge development
|
51
|
+
|
52
|
+
### Feature
|
53
|
+
Branched off from Development
|
54
|
+
|
55
|
+
$ git checkout -b feature development
|
56
|
+
|
57
|
+
When a new feature for the software is developed this is done in a feature
|
58
|
+
branch that is branched off from development. In this branch only the specific
|
59
|
+
feature is developed. After the feature is tested and the tests are green it
|
60
|
+
is merged back to development
|
61
|
+
|
62
|
+
Merged into Development
|
63
|
+
|
64
|
+
$ git checkout development
|
65
|
+
$ git merge feature
|
66
|
+
|
67
|
+
### Release
|
68
|
+
Branched off from Development
|
69
|
+
|
70
|
+
$ git checkout -b release-0.1.0 develop
|
71
|
+
|
72
|
+
When the software is ready to be released as a new version it is as an
|
73
|
+
intermediate step branched into a release branch where it is tested. If the
|
74
|
+
code has bugs these are fixed in the release branch. No new features are
|
75
|
+
added in the release branch.
|
76
|
+
|
77
|
+
A release branch goes through 3 stages indicated by a version suffix.
|
78
|
+
|
79
|
+
* Beta (version x.y.z-beta) is deployed to the beta server and tested by few
|
80
|
+
persons to test the functionality.
|
81
|
+
|
82
|
+
* Staging (version x.y.z-staging) is deployed to the staging server and is
|
83
|
+
tested simultaniously by more people to test load behaviour.
|
84
|
+
|
85
|
+
* Production (verion x.y.z). The release branch is merged to production and
|
86
|
+
back to development.
|
87
|
+
|
88
|
+
Merged into Master
|
89
|
+
Merged into Development
|
90
|
+
|
91
|
+
$ git checkout master
|
92
|
+
$ git merge release-0.1.0
|
93
|
+
$ git checkout development
|
94
|
+
$ git merge release-0.1.0
|
95
|
+
|
96
|
+
### Hotfix
|
97
|
+
Branched off from Master
|
98
|
+
|
99
|
+
$ git checkout -b hoftix-0.1.1
|
100
|
+
|
101
|
+
If a released software version has an identified bug the software is branched
|
102
|
+
off into a hotfix branch.
|
103
|
+
|
104
|
+
Merged back to Master
|
105
|
+
Merged to Deveopment
|
106
|
+
Merged to Release if currently open
|
107
|
+
|
108
|
+
$ git checkout master
|
109
|
+
$ git merge hotfix-0.1.1
|
110
|
+
$ git checkout development
|
111
|
+
$ git merge hotfix-0.1.1
|
112
|
+
|
113
|
+
## Versioning
|
114
|
+
A version number consist of 3 digits separated by dots `.` and optionally a
|
115
|
+
suffix (beta, staging).
|
116
|
+
|
117
|
+
Version 1.2.3-suffix
|
118
|
+
| | | + stage of stability
|
119
|
+
| | + Patch
|
120
|
+
| + Minor
|
121
|
+
+ Major
|
122
|
+
|
123
|
+
* _Major_ changes if
|
124
|
+
* new language implementation e.g. from Rails to Pheonix
|
125
|
+
* Needs a new runtime environment, that is the application cannot be
|
126
|
+
deployed to the existing environment because of a new Rails version
|
127
|
+
|
128
|
+
* _Minor_ changes if
|
129
|
+
* new features are added to the application e.g. a user statistics page
|
130
|
+
|
131
|
+
* _Patch_ changes if
|
132
|
+
* an error is fixed
|
133
|
+
* docmentation is extended
|
134
|
+
* refactoring of code has done
|
135
|
+
|
136
|
+
* _Suffix_ has two stages
|
137
|
+
* Beta - the application is deployed to beta server where a few users are
|
138
|
+
testing the application based on a test catalog
|
139
|
+
* Staging - the application is deployed to the staging server where several
|
140
|
+
users do a load test
|
141
|
+
* no suffix - the application is in production
|
142
|
+
|
143
|
+
## Versioning with sycversion
|
144
|
+
_sycersion_ is incrementing the current version of the application at the
|
145
|
+
position that is indicated as a parameter (major, minor, patch) and
|
146
|
+
optionally appended the suffix if provided.
|
147
|
+
|
148
|
+
$ sycersion --increment minor --suffix staging
|
149
|
+
|
150
|
+
If the there is no version set yet this will create a version 0.1.0-beta.
|
151
|
+
Alternatively an initial version can be provided
|
152
|
+
|
153
|
+
$ sycersion --major 1 --minor 1 --patch 0 --suffix beta
|
154
|
+
|
155
|
+
Which will create a version __1.1.0-beta__.
|
156
|
+
|
157
|
+
Determining the current version is following a retrievement strategy from 1
|
158
|
+
to 3:
|
159
|
+
|
160
|
+
1. Read from Git the current version tag
|
161
|
+
2. Read from a version file
|
162
|
+
3. Setting the version to 0.0.0
|
163
|
+
|
164
|
+
If the version file is available but the version cannot be read the
|
165
|
+
application informs about the issue and propose to set the version. The
|
166
|
+
original version file will then be backed up.
|
167
|
+
|
data/sycersion.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'sycersion/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.required_ruby_version = '>=2.7.2'
|
9
|
+
spec.name = 'sycersion'
|
10
|
+
spec.version = Sycersion::VERSION
|
11
|
+
spec.authors = ['Pierre Sugar']
|
12
|
+
spec.email = ['pierre@sugaryourcoffee.de']
|
13
|
+
|
14
|
+
spec.summary = 'Managing (set, increment) application versions'
|
15
|
+
spec.description = 'Sets the versions according semver.org'
|
16
|
+
spec.homepage = 'https://github.com/sugaryourcoffee/sycersion'
|
17
|
+
spec.license = 'MIT'
|
18
|
+
|
19
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
+
# if spec.respond_to?(:metadata)
|
22
|
+
# spec.metadata['allowed_push_host'] = "'https://rubygems.org'"
|
23
|
+
#
|
24
|
+
# spec.metadata['homepage_uri'] = spec.homepage
|
25
|
+
# # spec.metadata["source_code_uri"] = ""
|
26
|
+
# # spec.metadata["changelog_uri"] = ""
|
27
|
+
# else
|
28
|
+
# raise 'RubyGems 2.0 or newer is required to protect against ' \
|
29
|
+
# 'public gem pushes.'
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Specify which files should be added to the gem when it is released.
|
33
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
34
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
35
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
36
|
+
end
|
37
|
+
spec.bindir = 'bin'
|
38
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
39
|
+
spec.require_paths = ['lib']
|
40
|
+
|
41
|
+
spec.add_development_dependency 'aruba', '~> 1.0'
|
42
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
43
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
44
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
45
|
+
end
|