| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 import 'package:args/args.dart'; | 8 import 'package:args/args.dart'; |
| 9 import 'package:pathos/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
| 10 | 10 |
| 11 import 'command_cache.dart'; | 11 import 'command_cache.dart'; |
| 12 import 'command_deploy.dart'; |
| 12 import 'command_help.dart'; | 13 import 'command_help.dart'; |
| 13 import 'command_install.dart'; | 14 import 'command_install.dart'; |
| 14 import 'command_lish.dart'; | 15 import 'command_lish.dart'; |
| 15 import 'command_update.dart'; | 16 import 'command_update.dart'; |
| 16 import 'command_uploader.dart'; | 17 import 'command_uploader.dart'; |
| 17 import 'command_version.dart'; | 18 import 'command_version.dart'; |
| 18 import 'entrypoint.dart'; | 19 import 'entrypoint.dart'; |
| 19 import 'exit_codes.dart' as exit_codes; | 20 import 'exit_codes.dart' as exit_codes; |
| 20 import 'http.dart'; | 21 import 'http.dart'; |
| 21 import 'log.dart' as log; | 22 import 'log.dart' as log; |
| 22 import 'package.dart'; | 23 import 'package.dart'; |
| 23 import 'system_cache.dart'; | 24 import 'system_cache.dart'; |
| 24 import 'utils.dart'; | 25 import 'utils.dart'; |
| 25 | 26 |
| 26 /// The base class for commands for the pub executable. | 27 /// The base class for commands for the pub executable. |
| 27 abstract class PubCommand { | 28 abstract class PubCommand { |
| 28 /// The commands that Pub understands. | 29 /// The commands that Pub understands. |
| 29 static Map<String, PubCommand> get commands { | 30 static Map<String, PubCommand> get commands { |
| 30 var commands = { | 31 var commands = { |
| 31 'cache': new CacheCommand(), | 32 'cache': new CacheCommand(), |
| 33 'deploy': new DeployCommand(), |
| 32 'help': new HelpCommand(), | 34 'help': new HelpCommand(), |
| 33 'install': new InstallCommand(), | 35 'install': new InstallCommand(), |
| 34 'publish': new LishCommand(), | 36 'publish': new LishCommand(), |
| 35 'update': new UpdateCommand(), | 37 'update': new UpdateCommand(), |
| 36 'uploader': new UploaderCommand(), | 38 'uploader': new UploaderCommand(), |
| 37 'version': new VersionCommand() | 39 'version': new VersionCommand() |
| 38 }; | 40 }; |
| 39 for (var command in commands.values.toList()) { | 41 for (var command in commands.values.toList()) { |
| 40 for (var alias in command.aliases) { | 42 for (var alias in command.aliases) { |
| 41 commands[alias] = command; | 43 commands[alias] = command; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (exception is HttpException || exception is HttpParserException || | 191 if (exception is HttpException || exception is HttpParserException || |
| 190 exception is SocketIOException || exception is PubHttpException) { | 192 exception is SocketIOException || exception is PubHttpException) { |
| 191 return exit_codes.UNAVAILABLE; | 193 return exit_codes.UNAVAILABLE; |
| 192 } else if (exception is FormatException) { | 194 } else if (exception is FormatException) { |
| 193 return exit_codes.DATA; | 195 return exit_codes.DATA; |
| 194 } else { | 196 } else { |
| 195 return 1; | 197 return 1; |
| 196 } | 198 } |
| 197 } | 199 } |
| 198 } | 200 } |
| OLD | NEW |