Remove trailing whitespace
diff --git a/pkgs/pub_semver/README.md b/pkgs/pub_semver/README.md index 475c1a3..3bc37c5 100644 --- a/pkgs/pub_semver/README.md +++ b/pkgs/pub_semver/README.md
@@ -73,23 +73,23 @@ specifically selects that unstable version -- they've deliberately opted into it. - * **There is a notion of compatibility between pre-1.0.0 versions.** Semver - deems all pre-1.0.0 versions to be incompatible. This means that the only - way to ensure compatibility when depending on a pre-1.0.0 package is to - pin the dependency to an exact version. Pinned version constraints prevent - automatic patch and pre-release updates. To avoid this situation, pub - defines the "next breaking" version to be the version with the left-most - non-zero digit in [major, minor, patch] incremented, and the subsequent - digits reset to zero. For example, here are some versions along with their + * **There is a notion of compatibility between pre-1.0.0 versions.** Semver + deems all pre-1.0.0 versions to be incompatible. This means that the only + way to ensure compatibility when depending on a pre-1.0.0 package is to + pin the dependency to an exact version. Pinned version constraints prevent + automatic patch and pre-release updates. To avoid this situation, pub + defines the "next breaking" version to be the version with the left-most + non-zero digit in [major, minor, patch] incremented, and the subsequent + digits reset to zero. For example, here are some versions along with their next breaking ones: - + `0.0.3` -> `0.0.4` - `0.7.2-alpha` -> `0.8.0` - `1.2.3` -> `2.0.0` - - To make use of this, pub defines a "^" operator which yields a version - constraint greater than or equal to a given version, but less than its next + `0.7.2-alpha` -> `0.8.0` + `1.2.3` -> `2.0.0` + + To make use of this, pub defines a "^" operator which yields a version + constraint greater than or equal to a given version, but less than its next breaking one. - + [pub]: http://pub.dartlang.org/ [semver]: http://semver.org/
diff --git a/pkgs/pub_semver/lib/src/version.dart b/pkgs/pub_semver/lib/src/version.dart index 496178f..d980514 100644 --- a/pkgs/pub_semver/lib/src/version.dart +++ b/pkgs/pub_semver/lib/src/version.dart
@@ -220,21 +220,21 @@ /// Gets the next breaking version number that follows this one. /// /// Increments the left-most non-zero digit in ([major], [minor], [patch]). - /// In other words, if [major] and [minor] are zero (e.g. 0.0.3), then it - /// increments [patch]. If [major] is zero and [minor] is not (e.g. 0.7.2), + /// In other words, if [major] and [minor] are zero (e.g. 0.0.3), then it + /// increments [patch]. If [major] is zero and [minor] is not (e.g. 0.7.2), /// then it increments [minor]. Otherwise, it increments [major]. Version get nextBreaking { if (major == 0) { if (minor == 0) { return _incrementPatch(); } - + return _incrementMinor(); } return _incrementMajor(); } - + Version _incrementMajor() => new Version(major + 1, 0, 0); Version _incrementMinor() => new Version(major, minor + 1, 0); Version _incrementPatch() => new Version(major, minor, patch + 1);
diff --git a/pkgs/pub_semver/lib/src/version_constraint.dart b/pkgs/pub_semver/lib/src/version_constraint.dart index 1b86602..0cd45b6 100644 --- a/pkgs/pub_semver/lib/src/version_constraint.dart +++ b/pkgs/pub_semver/lib/src/version_constraint.dart
@@ -24,14 +24,14 @@ /// Parses a version constraint. /// /// This string is one of: - /// + /// /// * "any". [any] version. - /// * "^" followed by a version string. Versions compatible with + /// * "^" followed by a version string. Versions compatible with /// ([VersionConstraint.compatibleWith]) the version. /// * a series of version parts. Each part can be one of: /// * A version string like `1.2.3`. In other words, anything that can be /// parsed by [Version.parse()]. - /// * A comparison operator (`<`, `>`, `<=`, or `>=`) followed by a + /// * A comparison operator (`<`, `>`, `<=`, or `>=`) followed by a /// version string. /// /// Whitespace is ignored. @@ -87,7 +87,7 @@ } throw "Unreachable."; } - + // Try to parse the "^" operator followed by a version. matchCompatibleWith() { var compatibleWith = START_COMPATIBLE_WITH.firstMatch(text); @@ -96,26 +96,26 @@ var op = compatibleWith[0]; text = text.substring(compatibleWith.end); skipWhitespace(); - + var version = matchVersion(); if (version == null) { throw new FormatException('Expected version number after "$op" in ' '"$originalText", got "$text".'); } - + getCurrentTextIndex() => originalText.length - text.length; var startTextIndex = getCurrentTextIndex(); if (constraints.isNotEmpty || text.isNotEmpty) { - var constraint = op + originalText.substring(startTextIndex, + var constraint = op + originalText.substring(startTextIndex, getCurrentTextIndex()); throw new FormatException('Cannot include other constraints with ' '"^" constraint "$constraint" in "$originalText".'); } - - return new VersionRange(min: version, includeMin: true, + + return new VersionRange(min: version, includeMin: true, max: version.nextBreaking); } - + while (true) { skipWhitespace(); @@ -132,7 +132,7 @@ constraints.add(comparison); continue; } - + var compatibleWith = matchCompatibleWith(); if (compatibleWith != null) { return compatibleWith; @@ -150,14 +150,14 @@ return new VersionConstraint.intersection(constraints); } - /// Creates a version constraint which allows all versions that are + /// Creates a version constraint which allows all versions that are /// backward compatible with [version]. /// /// Versions are considered backward compatible with [version] if they /// are greater than or equal to [version], but less than the next breaking /// version ([Version.nextBreaking]) of [version]. factory VersionConstraint.compatibleWith(Version version) { - return new VersionRange(min: version, includeMin: true, + return new VersionRange(min: version, includeMin: true, max: version.nextBreaking); }
diff --git a/pkgs/pub_semver/test/version_constraint_test.dart b/pkgs/pub_semver/test/version_constraint_test.dart index b58eab7..316d57d 100644 --- a/pkgs/pub_semver/test/version_constraint_test.dart +++ b/pkgs/pub_semver/test/version_constraint_test.dart
@@ -173,11 +173,11 @@ } }); }); - + test('compatibleWith', () { var constraint = new VersionConstraint.compatibleWith(v072); - expect(constraint, equals(new VersionRange(min: v072, includeMin: true, + expect(constraint, equals(new VersionRange(min: v072, includeMin: true, max: v072.nextBreaking))); }); }