versionaire 3.1.0 → 3.2.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 +4 -4
- data/README.md +50 -50
- data/lib/versionaire/identity.rb +1 -1
- metadata +24 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 272f49ce385cf3f14aaf7a289eb130d20239e7a1
|
4
|
+
data.tar.gz: 207757ea776eb589a22bfe553ee2a59b7d12d1f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c773b93fc69c83a198e75293b27b2e0ed881f67fd3e6bd62f4ee4fd89f79026d685f53323db516fa2de168ae0cf705d92e3b3e3c60191bede160fcabb9cc2d
|
7
|
+
data.tar.gz: 794d9d0ebd92dd9ca94875b2b63249afd004afada86907c04e853293df9280d87a83c79be5c3151f2f3d056e459432d8341e702dafdfb90e5bf8fa30f27cb16e
|
data/README.md
CHANGED
@@ -4,58 +4,58 @@
|
|
4
4
|
[](https://codeclimate.com/github/bkuhlmann/versionaire)
|
5
5
|
[](https://codeclimate.com/github/bkuhlmann/versionaire)
|
6
6
|
[](https://gemnasium.com/bkuhlmann/versionaire)
|
7
|
-
[](https://circleci.com/gh/bkuhlmann/versionaire)
|
8
8
|
[](https://www.patreon.com/bkuhlmann)
|
9
9
|
|
10
10
|
Provides immutable, thread-safe, semantic versioning.
|
11
11
|
|
12
12
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
13
|
|
14
|
-
|
14
|
+
## Table of Contents
|
15
15
|
|
16
|
-
- [Features](#features)
|
17
|
-
- [Screencasts](#screencasts)
|
18
|
-
- [Requirements](#requirements)
|
19
|
-
- [Setup](#setup)
|
20
|
-
- [Usage](#usage)
|
16
|
+
- [Features](#features)
|
17
|
+
- [Screencasts](#screencasts)
|
18
|
+
- [Requirements](#requirements)
|
19
|
+
- [Setup](#setup)
|
20
|
+
- [Usage](#usage)
|
21
21
|
- [Initialization](#initialization)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- [Tests](#tests)
|
35
|
-
- [Versioning](#versioning)
|
36
|
-
- [Code of Conduct](#code-of-conduct)
|
37
|
-
- [Contributions](#contributions)
|
38
|
-
- [License](#license)
|
39
|
-
- [History](#history)
|
40
|
-
- [Credits](#credits)
|
22
|
+
- [Equality](#equality)
|
23
|
+
- [Value (`#==`)](#value-)
|
24
|
+
- [Hash (`#eql?`)](#hash-eql)
|
25
|
+
- [Case (`#===`)](#case-)
|
26
|
+
- [Identity (`#equal?`)](#identity-equal)
|
27
|
+
- [Conversions](#conversions)
|
28
|
+
- [Function (Casting)](#function-casting)
|
29
|
+
- [Implicit](#implicit)
|
30
|
+
- [Explicit](#explicit)
|
31
|
+
- [Math](#math)
|
32
|
+
- [Addition](#addition)
|
33
|
+
- [Subtraction](#subtraction)
|
34
|
+
- [Tests](#tests)
|
35
|
+
- [Versioning](#versioning)
|
36
|
+
- [Code of Conduct](#code-of-conduct)
|
37
|
+
- [Contributions](#contributions)
|
38
|
+
- [License](#license)
|
39
|
+
- [History](#history)
|
40
|
+
- [Credits](#credits)
|
41
41
|
|
42
42
|
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
43
43
|
|
44
|
-
|
44
|
+
## Features
|
45
45
|
|
46
46
|
- Provides [Semantic Versioning](http://semver.org).
|
47
47
|
- Provides immutable, thread-safe version instances.
|
48
48
|
- Provides conversions (casts) from a `String`, `Array`, `Hash`, or `Version` to a `Version`.
|
49
49
|
|
50
|
-
|
50
|
+
## Screencasts
|
51
51
|
|
52
52
|
[](https://asciinema.org/a/40455)
|
53
53
|
|
54
|
-
|
54
|
+
## Requirements
|
55
55
|
|
56
56
|
0. [Ruby 2.4.x](https://www.ruby-lang.org)
|
57
57
|
|
58
|
-
|
58
|
+
## Setup
|
59
59
|
|
60
60
|
For a secure install, type the following (recommended):
|
61
61
|
|
@@ -74,7 +74,7 @@ Add the following to your Gemfile:
|
|
74
74
|
|
75
75
|
gem "versionaire"
|
76
76
|
|
77
|
-
|
77
|
+
## Usage
|
78
78
|
|
79
79
|
## Initialization
|
80
80
|
|
@@ -85,9 +85,9 @@ A new version can be initialized in a variety of ways:
|
|
85
85
|
Versionaire::Version.new major: 1, minor: 2 # "1.2.0"
|
86
86
|
Versionaire::Version.new major: 1, minor: 2, maintenance: 3 # "1.2.3"
|
87
87
|
|
88
|
-
|
88
|
+
### Equality
|
89
89
|
|
90
|
-
|
90
|
+
#### Value (`#==`)
|
91
91
|
|
92
92
|
Equality is deterimined by the state of the object. This means that a version is equal to another
|
93
93
|
version as long as all of the values (i.e. state) are equal to each other. Example:
|
@@ -106,15 +106,15 @@ Knowning this, versions can be compared against one another too:
|
|
106
106
|
version_a < version_b # true
|
107
107
|
version_a.between? version_c, version_b # true
|
108
108
|
|
109
|
-
|
109
|
+
#### Hash (`#eql?`)
|
110
110
|
|
111
111
|
Behaves exactly as `#==`.
|
112
112
|
|
113
|
-
|
113
|
+
#### Case (`#===`)
|
114
114
|
|
115
115
|
Behaves exactly as `#==`.
|
116
116
|
|
117
|
-
|
117
|
+
#### Identity (`#equal?`)
|
118
118
|
|
119
119
|
Works like any other standard Ruby object where an object is equal only to itself.
|
120
120
|
|
@@ -126,9 +126,9 @@ Works like any other standard Ruby object where an object is equal only to itsel
|
|
126
126
|
version_a.equal? version_b # false
|
127
127
|
version_a.equal? version_c # false
|
128
128
|
|
129
|
-
|
129
|
+
### Conversions
|
130
130
|
|
131
|
-
|
131
|
+
#### Function (Casting)
|
132
132
|
|
133
133
|
The `Versionaire::Version` function is provided for explicit casting to a version:
|
134
134
|
|
@@ -142,13 +142,13 @@ The `Versionaire::Version` function is provided for explicit casting to a versio
|
|
142
142
|
Each of these conversions will result in a version object that represents "1.0.0". When attempting
|
143
143
|
to convert an unsupported type, a `Versionaire::Errors::Conversion` exception will be thrown.
|
144
144
|
|
145
|
-
|
145
|
+
#### Implicit
|
146
146
|
|
147
147
|
Implicit conversion to a `String` is supported:
|
148
148
|
|
149
149
|
"1.0.0".match Versionaire::Version.new(major: 1) # <MatchData "1.0.0">
|
150
150
|
|
151
|
-
|
151
|
+
#### Explicit
|
152
152
|
|
153
153
|
Explicit conversion to a `String`, `Array`, or `Hash` is supported:
|
154
154
|
|
@@ -158,17 +158,17 @@ Explicit conversion to a `String`, `Array`, or `Hash` is supported:
|
|
158
158
|
version.to_a # [0, 0, 0]
|
159
159
|
version.to_h # {major: 0, minor: 0, maintenance: 0}
|
160
160
|
|
161
|
-
|
161
|
+
### Math
|
162
162
|
|
163
163
|
Versions can be added and subtracted from each other.
|
164
164
|
|
165
|
-
|
165
|
+
#### Addition
|
166
166
|
|
167
167
|
version_1 = Versionaire::Version.new major: 1, minor: 2, maintenance: 3
|
168
168
|
version_2 = Versionaire::Version.new major: 2, minor: 5, maintenance: 7
|
169
169
|
version_1 + version_2 # "3.7.10"
|
170
170
|
|
171
|
-
|
171
|
+
#### Subtraction
|
172
172
|
|
173
173
|
version_1 = Versionaire::Version.new major: 1, minor: 2, maintenance: 3
|
174
174
|
version_2 = Versionaire::Version.new major: 1, minor: 1, maintenance: 1
|
@@ -178,13 +178,13 @@ Versions can be added and subtracted from each other.
|
|
178
178
|
version_2 = Versionaire::Version.new major: 5
|
179
179
|
version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
|
180
180
|
|
181
|
-
|
181
|
+
## Tests
|
182
182
|
|
183
183
|
To test, run:
|
184
184
|
|
185
185
|
bundle exec rake
|
186
186
|
|
187
|
-
|
187
|
+
## Versioning
|
188
188
|
|
189
189
|
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
190
190
|
|
@@ -192,26 +192,26 @@ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
|
192
192
|
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
193
193
|
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
194
194
|
|
195
|
-
|
195
|
+
## Code of Conduct
|
196
196
|
|
197
197
|
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
198
198
|
participating in this project you agree to abide by its terms.
|
199
199
|
|
200
|
-
|
200
|
+
## Contributions
|
201
201
|
|
202
202
|
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
203
203
|
|
204
|
-
|
204
|
+
## License
|
205
205
|
|
206
206
|
Copyright (c) 2016 [Alchemists](https://www.alchemists.io).
|
207
207
|
Read [LICENSE](LICENSE.md) for details.
|
208
208
|
|
209
|
-
|
209
|
+
## History
|
210
210
|
|
211
211
|
Read [CHANGES](CHANGES.md) for details.
|
212
212
|
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
213
213
|
|
214
|
-
|
214
|
+
## Credits
|
215
215
|
|
216
216
|
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
217
217
|
[Alchemists](https://www.alchemists.io).
|
data/lib/versionaire/identity.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: versionaire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '10.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '10.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '1.
|
131
|
+
version: '1.8'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '1.
|
138
|
+
version: '1.8'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,34 +164,48 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '4.7'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: git-cop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1.3'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1.3'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: reek
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '4.
|
187
|
+
version: '4.7'
|
174
188
|
type: :development
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '4.
|
194
|
+
version: '4.7'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: rubocop
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0.
|
201
|
+
version: '0.49'
|
188
202
|
type: :development
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
206
|
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0.
|
208
|
+
version: '0.49'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: codeclimate-test-reporter
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|