-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Seperate man up validate function. * Add man up validator file as part of ManUp * Update readme and bump the version. Co-authored-by: sparmar <sparmar@nextfaze.com>
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# manUp | ||
|
||
## [2.0.2] | ||
|
||
Separate manUp validator function to use it alone. | ||
|
||
## [2.0.1] | ||
|
||
Minor code changes. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
part of manup; | ||
|
||
/// | ||
Future<ManUpStatus> validatePlatformData( | ||
{required String version, required PlatformData platformData}) async { | ||
// | ||
if (!platformData.enabled) { | ||
return ManUpStatus.disabled; | ||
} | ||
|
||
try { | ||
Version currentVersion = Version.parse(version); | ||
VersionConstraint latestVersion = | ||
VersionConstraint.parse('>=${platformData.latestVersion}'); | ||
VersionConstraint minVersion = | ||
VersionConstraint.parse('>=${platformData.minVersion}'); | ||
if (latestVersion.allows(currentVersion)) { | ||
return ManUpStatus.latest; | ||
} else if (minVersion.allows(currentVersion)) { | ||
return ManUpStatus.supported; | ||
} | ||
return ManUpStatus.unsupported; | ||
} catch (exception) { | ||
throw ManUpException(exception.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters