| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library pub_update_test; | 5 library pub_update_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import '../../pub/lock_file.dart'; | 10 import '../../pub/lock_file.dart'; |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 var dependencies = <PackageRef>[]; | 488 var dependencies = <PackageRef>[]; |
| 489 dependencyStrings.forEach((name, constraint) { | 489 dependencyStrings.forEach((name, constraint) { |
| 490 var parsed = parseSource(name); | 490 var parsed = parseSource(name); |
| 491 var description = parsed.first; | 491 var description = parsed.first; |
| 492 var packageName = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); | 492 var packageName = description.replaceFirst(new RegExp(r"-[^-]+$"), ""); |
| 493 dependencies.add(new PackageRef(packageName, parsed.last, | 493 dependencies.add(new PackageRef(packageName, parsed.last, |
| 494 new VersionConstraint.parse(constraint), description)); | 494 new VersionConstraint.parse(constraint), description)); |
| 495 }); | 495 }); |
| 496 | 496 |
| 497 var pubspec = new Pubspec( | 497 var pubspec = new Pubspec( |
| 498 description, new Version.parse(version), dependencies); | 498 description, new Version.parse(version), dependencies, |
| 499 new PubspecEnvironment()); |
| 499 return new Package.inMemory(pubspec); | 500 return new Package.inMemory(pubspec); |
| 500 } | 501 } |
| 501 | 502 |
| 502 void addPackage(Package package) { | 503 void addPackage(Package package) { |
| 503 _packages.putIfAbsent(package.name, () => new Map<Version, Package>()); | 504 _packages.putIfAbsent(package.name, () => new Map<Version, Package>()); |
| 504 _packages[package.name][package.version] = package; | 505 _packages[package.name][package.version] = package; |
| 505 } | 506 } |
| 506 } | 507 } |
| 507 | 508 |
| 508 /// A source used for testing that doesn't natively understand versioning, | 509 /// A source used for testing that doesn't natively understand versioning, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); | 543 var match = new RegExp(r"(.*) from (.*)").firstMatch(name); |
| 543 if (match == null) return new Pair<String, Source>(name, source1); | 544 if (match == null) return new Pair<String, Source>(name, source1); |
| 544 switch (match[2]) { | 545 switch (match[2]) { |
| 545 case 'mock1': return new Pair<String, Source>(match[1], source1); | 546 case 'mock1': return new Pair<String, Source>(match[1], source1); |
| 546 case 'mock2': return new Pair<String, Source>(match[1], source2); | 547 case 'mock2': return new Pair<String, Source>(match[1], source2); |
| 547 case 'root': return new Pair<String, Source>(match[1], rootSource); | 548 case 'root': return new Pair<String, Source>(match[1], rootSource); |
| 548 case 'versionless': | 549 case 'versionless': |
| 549 return new Pair<String, Source>(match[1], versionlessSource); | 550 return new Pair<String, Source>(match[1], versionlessSource); |
| 550 } | 551 } |
| 551 } | 552 } |
| OLD | NEW |