|
1 | | -sh-semver |
2 | | -========= |
3 | | - |
| 1 | +# sh-semver |
4 | 2 | [](https://travis-ci.org/jsokolowski/sh-semver) |
5 | 3 |
|
6 | | -Pure sh implementation of semantic versioning |
7 | | - |
8 | | -Range matching |
9 | | --------------- |
10 | | - |
11 | | -Every range contains one or more sets of rules. To satisfy range version must satisfies all rules from at least one set. Sets are separated with two vertical bars (__||__). Rules in each set are separated with whitespaces. Empty set are treated as wildcard rule (__\*__); |
| 4 | +The semantic versioner for Bourne Shell. |
12 | 5 |
|
13 | | -### Basic rules |
| 6 | +## Ranges |
14 | 7 |
|
15 | | -There is four basic rules: __>__, __<=__, __<__, __>=__. All other rules are translated to groups of these ones. |
| 8 | +Every *version range* contains one or more *sets of comparators*. To satisfy *version range* version must satisfies all *comparators* from at least one set. Sets are separated with two vertical bars ``||``. Rules in each set are separated with whitespaces. Empty set are treated as wildcard comparator ``*``. |
16 | 9 |
|
17 | | -First two (__>__ and __<=__) are rather simple. For example _>1.2.3_ is satisfied by _1.2.4_ version but not by _1.2.3_ and _<=1.2.3_ is satisfied by _1.2.3-beta_ but not by _1.2.4_. Second two (__<__ and __>=__) are little bit trickier. Literally version _2.0.0-beta_ should match to rule _<2.0.0_ but it is something you probably don't want to, so rule _<2.0.0_ is converted to _<2.0.0-0_. In case of rule __>=__ the oposite is true, version _2.0.0-beta_ should satisfy rule _>=2.0.0_ so this rule is converted to _>=2.0.0-0_. This behavior can be changed by specifying a prerelase. For example rule _<2.0.0-beta_ will be not satisfied by _2.0.0-alpha_. |
| 10 | +### Basic comparators |
| 11 | +There are five basic comparators: |
18 | 12 |
|
19 | | -You doesn't have to specify full version number in rule, altough rules like _>1.2.0_ and _>1.2_ are not the same. For example the lowest version witch satisfies rule _>1.2_ is not a _1.2.1-0_ but _1.3.0-0_. So length of version number in rule affects precision of comparison. |
| 13 | +* Equal to ``=A.B.C`` (``=`` operator is optional, it may be provided but usually it isn't). |
| 14 | +* Less than ``<A.B.C`` |
| 15 | +* Greater than ``>A.B.C`` |
| 16 | +* Less than or equal to ``<=A.B.C`` |
| 17 | +* Greater than or equal to ``>=A.B.C`` |
20 | 18 |
|
| 19 | +### Advanced comparators |
| 20 | +##### Wildcard ``*`` ``*.*`` ``*.*.*`` |
| 21 | +##### Wildcard ranges ``A.*.*`` ``A.B.*`` |
| 22 | +##### Caret with ``^A.B.C`` ``^A.B`` ``^A`` |
| 23 | +##### Tilde ranges ``~A.B.C`` ``~A.B`` ``~A`` |
| 24 | +##### Hyphen ranges ``A.B.C - X.Y.Z`` |
21 | 25 |
|
| 26 | +### Prerelease versions |
| 27 | +Prerelease versions can satisfy comparators set only when have the same minor major and patch numbers as at least one of comparators. |
0 commit comments