Skip to content

Commit

Permalink
Fix documentation (#9)
Browse files Browse the repository at this point in the history
* Create pr-check.yml

* Update pr-check.yml

* Update README.md

* Create build_check.yml

* Update and rename build_check.yml to build-check.yml

* Update build-check.yml

* Update pr-check.yml

* Create main-release.yml

* chore: fix workflow

* Update main-release.yml

* Update and rename build-check.yml to build.yml

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Add Example (#5)

* feat: add example project

* feat: add basic example view

* Hashable Conformance (#6)

* feat: add hashable protocol conformance

* chore: update readme

* feat: add version from bundle with bundleversion and shortversion

* tests: add fix build number to bundles

* fix: readme

* Update pr-check.yml

* Update pr-check.yml

* Update build.yml

* Update build.yml

* Delete pr-check.yml

* Update build.yml

* fix: build yml

* Handle pre-release and build-meta-data for construction and comparison (#7)

* feat: add identifier enums

* feat: add equatable to prerelease identifier

* feat: add hashable to semanticversioncomparable

* feat: add buildidentifier

* feat: add prerelease identifier

* feat: add build as comparison result

* refactor: use new build and prerelease identifier

* feat: add regex matches for numeric and alphanumeric strings

* feat: add prerelease to equatable

* feat: update comparison result with build

* feat: update comparable protocol with new identifier

* feat: add prerelease and build to comparison result

* docs: update jazzy file

* refactor: documentation style and new accessor

* refactor: remove dead code

* docs: update docs and accesor level

* feat: cleanup

* refactor: rename after semver

* refactor: further renaming

* refactor: rename missing group

* refactor: add missing warning

* refactor: naming and docs

* docs: jazzy

* feat: update readme

* fix: equality comparison

* fix: compare result

* docs: update readme and jazzy

* fix: merge

* fix: missing parts in readme

* refactor: add on tag trigger for main release

* refactor: rm dead file

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update main-release.yml

* Update build.yml

* Update build.yml

* refactor: rm gen proj from ci

* feat: set test conf to release

* Update build.yml

* fix: tests

* Update example-project and tests (#8)

* feat: update example

* fix: correct comparison when checking version core

* feat: add string literal conformance to extensions

* feat: make init more safe

* test: add more test cases

* docs: update jazzy

* fix: readme

* test: add more valid test cases for literal construction

* refactor: update alphanumeric regex pattern

* fix: exlusion of multiple - symbols in prerelease identifiers

* fix: ignoring leading zeros in version identifiers

* docs: update

* refactor: cleanup docs

Co-authored-by: Marius <11645567+nihilias@users.noreply.github.com>
  • Loading branch information
mflknr and mflknr committed Mar 30, 2021
1 parent eeb99b5 commit a6ab532
Show file tree
Hide file tree
Showing 32 changed files with 75 additions and 195 deletions.
1 change: 0 additions & 1 deletion .jazzy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ xcodebuild_arguments:
- SwiftVersionCompare.xcodeproj
- -scheme
- SwiftVersionCompare-Package

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
//

public extension SemanticVersionComparable {
/// Compare versions using the `SemVer` ranking system.
///
/// - Note: Build-meta-data have no influence on a version's rank.
static func < (lhs: Self, rhs: Self) -> Bool {
// if versions are identical on major, minor and patch level, compare them lexicographiocally
guard lhs.hasEqualVersionCore(as: rhs) else {
Expand Down Expand Up @@ -61,12 +64,4 @@ public extension SemanticVersionComparable {
// lastly, if number of identifiers of lhs version is lower than rhs version, it ranks lower
return lhspr.count < rhspr.count
}

static func <= (lhs: Self, rhs: Self) -> Bool {
lhs == rhs || lhs < rhs
}

static func >= (lhs: Self, rhs: Self) -> Bool {
lhs == rhs || lhs > rhs
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
//

extension SemanticVersionComparable {
/// Conformance to `Hashable` protocol.
///
/// - Note: Since build-meta-data are not considered in ranking semantic version, it won't be considered
/// here either.
public func hash(into hasher: inout Hasher) {
hasher.combine(major)
hasher.combine(minor)
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/BuildMetaData.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/PrereleaseIdentifier.html
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Enums/VersionCompareResult.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions/Bundle.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Extensions/ProcessInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Protocols.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
97 changes: 19 additions & 78 deletions docs/Protocols/SemanticVersionComparable.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ <h4>Declaration</h4>
<a name="//apple_ref/swift/Property/prerelease" class="dashAnchor"></a>
<a class="token" href="#/s:19SwiftVersionCompare08SemanticB10ComparableP10prereleaseSayAA20PrereleaseIdentifierOGSgvp">prerelease</a>
</code>
<span class="declaration-note">
Default implementation
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
Expand All @@ -216,10 +213,6 @@ <h4>Declaration</h4>
<div class="abstract">
<p>Pre-release identifier of a version.</p>

</div>
<h4>Default Implementation</h4>
<div class="default_impl abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
Expand All @@ -239,9 +232,6 @@ <h4>Declaration</h4>
<a name="//apple_ref/swift/Property/build" class="dashAnchor"></a>
<a class="token" href="#/s:19SwiftVersionCompare08SemanticB10ComparableP5buildSayAA13BuildMetaDataOGSgvp">build</a>
</code>
<span class="declaration-note">
Default implementation
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
Expand All @@ -250,10 +240,6 @@ <h4>Declaration</h4>
<div class="abstract">
<p>Build-meta-data of a version.</p>

</div>
<h4>Default Implementation</h4>
<div class="default_impl abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
Expand All @@ -269,9 +255,9 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:SL1loiySbx_xtFZ"></a>
<a name="/s:19SwiftVersionCompare08SemanticB10ComparablePAAE1loiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/&lt;(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SL1loiySbx_xtFZ"><(_:<wbr>_:<wbr>)</a>
<a class="token" href="#/s:19SwiftVersionCompare08SemanticB10ComparablePAAE1loiySbx_xtFZ"><(_:<wbr>_:<wbr>)</a>
</code>
<span class="declaration-note">
Extension method
Expand All @@ -282,71 +268,19 @@ <h4>Declaration</h4>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">static</span> <span class="kd">func</span> <span class="o">&lt;</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
<p>Compare versions using the <code>SemVer</code> ranking system.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
Build-meta-data have no influence on a version&rsquo;s rank.

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SL2leoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/&lt;=(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SL2leoiySbx_xtFZ"><=(_:<wbr>_:<wbr>)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">static</span> <span class="kd">func</span> <span class="o">&lt;=</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SL2geoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/&gt;=(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SL2geoiySbx_xtFZ">>=(_:<wbr>_:<wbr>)</a>
</code>
<span class="declaration-note">
Extension method
</span>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">static</span> <span class="kd">func</span> <span class="o">&gt;=</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
<pre class="highlight swift"><code><span class="kd">static</span> <span class="kd">func</span> <span class="o">&lt;</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="k">Self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -424,9 +358,9 @@ <h4>Return Value</h4>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="/s:19SwiftVersionCompare08SemanticB10ComparablePAAE4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
<a class="token" href="#/s:19SwiftVersionCompare08SemanticB10ComparablePAAE4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
<span class="declaration-note">
Extension method
Expand All @@ -437,7 +371,14 @@ <h4>Return Value</h4>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

<p>Conformance to <code>Hashable</code> protocol.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
Since build-meta-data are not considered in ranking semantic version, it won&rsquo;t be considered
here either.

</div>

</div>
<div class="declaration">
<h4>Declaration</h4>
Expand Down Expand Up @@ -777,7 +718,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
2 changes: 1 addition & 1 deletion docs/Structs/Version.html
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h4>Declaration</h4>
</section>
</section>
<section id="footer">
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-29)</p>
<p>&copy; 2021 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2021-03-30)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
Expand Down

0 comments on commit a6ab532

Please sign in to comment.