| 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; | 5 library pub.command.cache_add; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:pub_semver/pub_semver.dart'; |
| 10 |
| 9 import '../command.dart'; | 11 import '../command.dart'; |
| 10 import '../log.dart' as log; | 12 import '../log.dart' as log; |
| 11 import '../package.dart'; | 13 import '../package.dart'; |
| 12 import '../utils.dart'; | 14 import '../utils.dart'; |
| 13 import '../version.dart'; | |
| 14 | 15 |
| 15 /// Handles the `cache add` pub command. | 16 /// Handles the `cache add` pub command. |
| 16 class CacheAddCommand extends PubCommand { | 17 class CacheAddCommand extends PubCommand { |
| 17 String get description => "Install a package."; | 18 String get description => "Install a package."; |
| 18 String get usage => | 19 String get usage => |
| 19 "pub cache add <package> [--version <constraint>] [--all]"; | 20 "pub cache add <package> [--version <constraint>] [--all]"; |
| 20 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html"; | 21 String get docUrl => "http://dartlang.org/tools/pub/cmd/pub-cache.html"; |
| 21 bool get takesArguments => true; | 22 bool get takesArguments => true; |
| 22 | 23 |
| 23 CacheAddCommand() { | 24 CacheAddCommand() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 versions.sort(); | 87 versions.sort(); |
| 87 return Future.forEach(versions, downloadVersion); | 88 return Future.forEach(versions, downloadVersion); |
| 88 } else { | 89 } else { |
| 89 // Pick the best matching version. | 90 // Pick the best matching version. |
| 90 versions.sort(Version.prioritize); | 91 versions.sort(Version.prioritize); |
| 91 return downloadVersion(versions.last); | 92 return downloadVersion(versions.last); |
| 92 } | 93 } |
| 93 }); | 94 }); |
| 94 } | 95 } |
| 95 } | 96 } |
| OLD | NEW |