Skip to content

Commit 1cc9148

Browse files
committed
changed package and group name to de.voize
1 parent 92f7a8b commit 1cc9148

File tree

13 files changed

+90
-88
lines changed

13 files changed

+90
-88
lines changed

LICENSE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-present Vincent DURMONT <vdurmont@gmail.com>
3+
Copyright (c) 2021 voize GmbH
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Semver4k
22

3-
[![Build Status](https://travis-ci.org/vdurmont/semver4j.svg?branch=master)](https://travis-ci.org/vdurmont/semver4j)
4-
[![Coverage Status](https://coveralls.io/repos/vdurmont/semver4j/badge.svg?branch=master&service=github)](https://coveralls.io/github/vdurmont/semver4j?branch=master)
5-
[![License Info](http://img.shields.io/badge/license-The%20MIT%20License-brightgreen.svg)](https://github.com/vdurmont/semver4j/blob/master/LICENSE.md)
3+
**Semver4k** is a lightweight Kotlin Multiplatform library that helps you handling versions. It follows the rules of the [semantic versioning](http://semver.org) specification and provides several versioning modes: strict, NPM, CocoaPods...
64

7-
**Semver4k** is a lightweight Java library that helps you handling versions. It follows the rules of the [semantic versioning](http://semver.org) specification and provides several versioning modes: strict, NPM, CocoaPods...
5+
This library is a frok of [semver4j](https://github.com/vdurmont/semver4j) completly rewritten in kotlin.
6+
7+
Supported Kotlin Multiplatform targets:
8+
* jvm
9+
* ios
810

911
## Installation
1012

@@ -14,16 +16,16 @@ Add the dependency to your project:
1416

1517
```xml
1618
<dependency>
17-
<groupId>com.vdurmont</groupId>
19+
<groupId>de.voize</groupId>
1820
<artifactId>semver4k</artifactId>
19-
<version>3.1.0</version>
21+
<version>4.0.0</version>
2022
</dependency>
2123
```
2224

2325
#### Using gradle
2426

25-
```xml
26-
compile 'com.vdurmont:semver4j:3.1.0'
27+
```kotlin
28+
implementation("de.voize:semver4j:4.0.0")
2729
```
2830

2931
## Usage
@@ -42,9 +44,9 @@ In Semver4j, a version looks like: `1.2.3-beta.4+sha899d8g79f87`.
4244

4345
You can create a version by using one of the 2 constructors:
4446

45-
```java
46-
Semver sem1 = new Semver("1.2.3-beta.4+sha899d8g79f87"); // Defaults to STRICT mode
47-
Semver sem2 = new Semver("1.2.3-beta.4+sha899d8g79f87", SemverType.NPM); // Specify the mode
47+
```kotlin
48+
val sem1 = Semver("1.2.3-beta.4+sha899d8g79f87") // Defaults to STRICT mode
49+
val sem2 = Semver("1.2.3-beta.4+sha899d8g79f87", SemverType.NPM) // Specify the mode
4850
```
4951

5052
If the version is invalid, a `SemverException` will be thrown.
@@ -65,65 +67,65 @@ A version is stable if its major number is _strictly_ positive and it has no suf
6567

6668
Examples:
6769

68-
```java
70+
```kotlin
6971
// TRUE
70-
new Semver("1.2.3").isStable();
71-
new Semver("1.2.3+sHa.0nSFGKjkjsdf").isStable();
72+
Semver("1.2.3").isStable()
73+
Semver("1.2.3+sHa.0nSFGKjkjsdf").isStable()
7274

7375
// FALSE
74-
new Semver("0.1.2").isStable());
75-
new Semver("0.1.2+sHa.0nSFGKjkjsdf").isStable();
76-
new Semver("1.2.3-BETA.11+sHa.0nSFGKjkjsdf").isStable();
76+
Semver("0.1.2").isStable())
77+
Semver("0.1.2+sHa.0nSFGKjkjsdf").isStable()
78+
Semver("1.2.3-BETA.11+sHa.0nSFGKjkjsdf").isStable()
7779
```
7880

7981
### Comparing the versions
8082

8183
- `isGreaterThan` returns true if the version is strictly greater than the other one.
8284

83-
```java
84-
Semver sem = new Semver("1.2.3");
85-
sem.isGreaterThan("1.2.2"); // true
86-
sem.isGreaterThan("1.2.4"); // false
87-
sem.isGreaterThan("1.2.3"); // false
85+
```kotlin
86+
val sem = Semver("1.2.3")
87+
sem.isGreaterThan("1.2.2") // true
88+
sem.isGreaterThan("1.2.4") // false
89+
sem.isGreaterThan("1.2.3") // false
8890
```
8991

9092
- `isLowerThan` returns true if the version is strictly lower than the other one.
9193

92-
```java
93-
Semver sem = new Semver("1.2.3");
94-
sem.isLowerThan("1.2.2"); // false
95-
sem.isLowerThan("1.2.4"); // true
96-
sem.isLowerThan("1.2.3"); // false
94+
```kotlin
95+
val sem = Semver("1.2.3")
96+
sem.isLowerThan("1.2.2") // false
97+
sem.isLowerThan("1.2.4") // true
98+
sem.isLowerThan("1.2.3") // false
9799
```
98100

99101
- `isEqualTo` returns true if the versions are exactly the same.
100102

101-
```java
102-
Semver sem = new Semver("1.2.3+sha123456789");
103-
sem.isEqualTo("1.2.3+sha123456789"); // true
104-
sem.isEqualTo("1.2.3+shaABCDEFGHI"); // false
103+
```kotin
104+
val sem = Semver("1.2.3+sha123456789")
105+
sem.isEqualTo("1.2.3+sha123456789") // true
106+
sem.isEqualTo("1.2.3+shaABCDEFGHI") // false
105107
```
106108

107109
- `isEquivalentTo` returns true if the versions are the same (does not take the build information into account).
108110

109-
```java
110-
Semver sem = new Semver("1.2.3+sha123456789");
111-
sem.isEquivalentTo("1.2.3+sha123456789"); // true
112-
sem.isEquivalentTo("1.2.3+shaABCDEFGHI"); // true
111+
```kotlin
112+
val sem = Semver("1.2.3+sha123456789")
113+
sem.isEquivalentTo("1.2.3+sha123456789") // true
114+
sem.isEquivalentTo("1.2.3+shaABCDEFGHI") // true
113115
```
114116

115117
### Versions diffs
116118

117119
If you want to know what is the main difference between 2 versions, use the `diff` method. It will return a `VersionDiff` enum value among: `NONE`, `MAJOR`, `MINOR`, `PATCH`, `SUFFIX`, `BUILD`. It will always return the biggest difference.
118120

119-
```java
120-
Semver sem = new Semver("1.2.3-beta.4+sha899d8g79f87");
121-
sem.diff("1.2.3-beta.4+sha899d8g79f87"); // NONE
122-
sem.diff("2.3.4-alpha.5+sha32iddfu987"); // MAJOR
123-
sem.diff("1.3.4-alpha.5+sha32iddfu987"); // MINOR
124-
sem.diff("1.2.4-alpha.5+sha32iddfu987"); // PATCH
125-
sem.diff("1.2.3-alpha.5+sha32iddfu987"); // SUFFIX
126-
sem.diff("1.2.3-beta.4+sha32iddfu987"); // BUILD
121+
```kotlin
122+
val sem = Semver("1.2.3-beta.4+sha899d8g79f87")
123+
sem.diff("1.2.3-beta.4+sha899d8g79f87") // NONE
124+
sem.diff("2.3.4-alpha.5+sha32iddfu987") // MAJOR
125+
sem.diff("1.3.4-alpha.5+sha32iddfu987") // MINOR
126+
sem.diff("1.2.4-alpha.5+sha32iddfu987") // PATCH
127+
sem.diff("1.2.3-alpha.5+sha32iddfu987") // SUFFIX
128+
sem.diff("1.2.3-beta.4+sha32iddfu987") // BUILD
127129
```
128130

129131
### Requirements
@@ -133,33 +135,33 @@ If you want to check if a version satisfies a requirement, use the `satisfies` m
133135
- In `STRICT` and `LOOSE` modes, the requirement can only be another version.
134136
- In `NPM` mode, the requirement follows [NPM versioning rules](https://github.com/npm/node-semver).
135137

136-
```java
138+
```kotlin
137139
// STRICT mode
138-
Semver semStrict = new Semver("1.2.3", SemverType.STRICT);
139-
semStrict.satisfies("1.2.3"); // true
140-
semStrict.satisfies("1.2.2"); // false
141-
semStrict.satisfies("1.2.4"); // false
142-
semStrict.satisfies(">1.2.2"); // SemverException, incompatible requirement for a STRICT mode
140+
val semStrict = Semver("1.2.3", SemverType.STRICT)
141+
semStrict.satisfies("1.2.3") // true
142+
semStrict.satisfies("1.2.2") // false
143+
semStrict.satisfies("1.2.4") // false
144+
semStrict.satisfies(">1.2.2") // SemverException, incompatible requirement for a STRICT mode
143145

144146
// NPM mode (those are just examples, check NPM documentation to see all the cases)
145-
Semver semNPM = new Semver("1.2.3", SemverType.NPM);
146-
semNPM.satisfies(">1.2.2"); // true
147-
semNPM.satisfies("1.1.1 || 1.2.3 - 2.0.0"); // true
148-
semNPM.satisfies("1.1.*"); // false
149-
semNPM.satisfies("~1.2.1"); // true
150-
semNPM.satisfies("^1.1.1"); // true
147+
val semNPM = Semver("1.2.3", SemverType.NPM)
148+
semNPM.satisfies(">1.2.2") // true
149+
semNPM.satisfies("1.1.1 || 1.2.3 - 2.0.0") // true
150+
semNPM.satisfies("1.1.*") // false
151+
semNPM.satisfies("~1.2.1") // true
152+
semNPM.satisfies("^1.1.1") // true
151153

152154
// COCOAPODS mode (those are just examples, check CocoaPods documentation to see all the cases)
153-
Semver semPOD = new Semver("1.2.3", SemverType.COCOAPODS);
154-
semPOD.satisfies("> 1.2.2"); // true
155-
semPOD.satisfies("~> 1.2.1"); // true
156-
semPOD.satisfies("<= 1.1.1"); // false
155+
val semPOD = Semver("1.2.3", SemverType.COCOAPODS)
156+
semPOD.satisfies("> 1.2.2") // true
157+
semPOD.satisfies("~> 1.2.1") // true
158+
semPOD.satisfies("<= 1.1.1") // false
157159

158160
// IVY mode (those are just examples, check Ivy/gradle documentation to see all the cases)
159-
Semver semIVY = new Semver("1.2.3", SemverType.IVY);
160-
semIVY.satisfies("1.2.+"); // true
161-
semIVY.satisfies("(,1.8.9]"); // true
162-
semIVY.satisfies("[0.2,1.4]"); // true
161+
val semIVY = Semver("1.2.3", SemverType.IVY)
162+
semIVY.satisfies("1.2.+") // true
163+
semIVY.satisfies("(,1.8.9]") // true
164+
semIVY.satisfies("[0.2,1.4]") // true
163165
```
164166

165167
### Modifying the version

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id("convention.publication")
44
}
55

6-
group = "com.vdurmont"
6+
group = "de.voize"
77
version = "4.0.0"
88

99
repositories {

src/commonMain/kotlin/com/vdurmont/semver4k/Range.kt renamed to src/commonMain/kotlin/de/voize/semver4k/Range.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

33
// TODO doc
44
class Range(val version: Semver, val op: RangeOperator) {

src/commonMain/kotlin/com/vdurmont/semver4k/Requirement.kt renamed to src/commonMain/kotlin/de/voize/semver4k/Requirement.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

3-
import com.vdurmont.semver4k.Tokenizer.tokenize
4-
import com.vdurmont.semver4k.Semver.SemverType
5-
import com.vdurmont.semver4k.Range.RangeOperator
3+
import de.voize.semver4k.Tokenizer.tokenize
4+
import de.voize.semver4k.Semver.SemverType
5+
import de.voize.semver4k.Range.RangeOperator
66

77
/**
88
* A requirement will provide an easy way to check if a version is satisfying.

src/commonMain/kotlin/com/vdurmont/semver4k/Semver.kt renamed to src/commonMain/kotlin/de/voize/semver4k/Semver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

33
import kotlin.jvm.JvmOverloads
44

src/commonMain/kotlin/com/vdurmont/semver4k/SemverException.kt renamed to src/commonMain/kotlin/de/voize/semver4k/SemverException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

33
class SemverException : RuntimeException {
44
constructor(msg: String?) : super(msg) {}

src/commonMain/kotlin/com/vdurmont/semver4k/Tokenizer.kt renamed to src/commonMain/kotlin/de/voize/semver4k/Tokenizer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

3-
import com.vdurmont.semver4k.Semver.SemverType
3+
import de.voize.semver4k.Semver.SemverType
44

55
/**
66
* Utility class to convert a NPM requirement string into a list of tokens.

src/jvmTest/kotlin/com/vdurmont/semver4k/NpmSemverTest.kt renamed to src/jvmTest/kotlin/de/voize/semver4k/NpmSemverTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

3-
import com.vdurmont.semver4k.Semver.SemverType
3+
import de.voize.semver4k.Semver.SemverType
44
import org.junit.Assert
55
import org.junit.Test
66
import org.junit.runner.RunWith

src/jvmTest/kotlin/com/vdurmont/semver4k/RangeTest.kt renamed to src/jvmTest/kotlin/de/voize/semver4k/RangeTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.vdurmont.semver4k
1+
package de.voize.semver4k
22

3-
import com.vdurmont.semver4k.Range.RangeOperator
3+
import de.voize.semver4k.Range.RangeOperator
44
import org.junit.Assert
55
import org.junit.Test
66
import org.junit.runner.RunWith

0 commit comments

Comments
 (0)