Skip to content

Commit

Permalink
fix: compare versions as versions not as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaWertun committed May 8, 2020
1 parent a9f163c commit 9f51a21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bindgen/find_path/version_checker.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "semantic_version"

module Bindgen
class FindPath
# Checker for a `VersionCheck`. This is a special checker. It can't be
Expand Down Expand Up @@ -82,12 +84,13 @@ module Bindgen

# Does the version check
private def check_version_string(version_string) : Bool
version = SemanticVersion.parse(version_string)
if min = @config.min
return false if version_string < min
return false if version < SemanticVersion.parse(min)
end

if max = @config.max
return false if version_string > max
return false if version > SemanticVersion.parse(max)
end

true
Expand Down

0 comments on commit 9f51a21

Please sign in to comment.