-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zeroing out the subsequent parts of the build (#21)
- Loading branch information
Showing
5 changed files
with
19 additions
and
13 deletions.
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
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import 'package:pub_semver/pub_semver.dart'; | ||
|
||
Version nextBuild(Version v) { | ||
final build = List.from(v.build); | ||
final firstIntegerIndex = build.indexWhere((_) => _ is int); | ||
if (firstIntegerIndex == -1) return _withBuild(v, (build + [1]).join('.')); | ||
build[firstIntegerIndex] += 1; | ||
return _withBuild(v, (build).join('.')); | ||
var incremented = false; | ||
final build = v.build.map((part) { | ||
if (part is! int) return part; | ||
if (incremented) return 0; | ||
incremented = true; | ||
return part + 1; | ||
}).toList(); | ||
if (!incremented) build.add(1); | ||
return Version(v.major, v.minor, v.patch, build: build.join('.')); | ||
} | ||
|
||
Version _withBuild(Version v, String build) => | ||
Version(v.major, v.minor, v.patch, build: build); |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ author: "Alexey Karapetov <[email protected]>" | |
description: "A CLI tool to set/bump the package version in pubspec.yaml. The \"npm version\" for Dart." | ||
homepage: "https://github.com/f3ath/pubspec-version" | ||
name: "pubspec_version" | ||
version: "0.4.0" | ||
version: "0.5.0" | ||
dependencies: | ||
args: "^1.5.0" | ||
pub_semver: "^1.4.2" | ||
|
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