| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.command.cache_add; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 | 6 |
| 9 import 'package:pub_semver/pub_semver.dart'; | 7 import 'package:pub_semver/pub_semver.dart'; |
| 10 | 8 |
| 11 import '../command.dart'; | 9 import '../command.dart'; |
| 12 import '../log.dart' as log; | 10 import '../log.dart' as log; |
| 13 import '../source/hosted.dart'; | 11 import '../source/hosted.dart'; |
| 14 import '../utils.dart'; | 12 import '../utils.dart'; |
| 15 | 13 |
| 16 /// Handles the `cache add` pub command. | 14 /// Handles the `cache add` pub command. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Install them in ascending order. | 82 // Install them in ascending order. |
| 85 ids.sort((id1, id2) => id1.version.compareTo(id2.version)); | 83 ids.sort((id1, id2) => id1.version.compareTo(id2.version)); |
| 86 await Future.forEach(ids, downloadVersion); | 84 await Future.forEach(ids, downloadVersion); |
| 87 } else { | 85 } else { |
| 88 // Pick the best matching version. | 86 // Pick the best matching version. |
| 89 ids.sort((id1, id2) => Version.prioritize(id1.version, id2.version)); | 87 ids.sort((id1, id2) => Version.prioritize(id1.version, id2.version)); |
| 90 await downloadVersion(ids.last); | 88 await downloadVersion(ids.last); |
| 91 } | 89 } |
| 92 } | 90 } |
| 93 } | 91 } |
| OLD | NEW |