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:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
8 | 8 |
9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 PubCommand.commands.forEach((name, command) { | 114 PubCommand.commands.forEach((name, command) { |
115 argParser.addCommand(name, command.commandParser); | 115 argParser.addCommand(name, command.commandParser); |
116 }); | 116 }); |
117 | 117 |
118 return argParser; | 118 return argParser; |
119 } | 119 } |
120 | 120 |
121 /// Checks that pub is running on a supported platform. If it isn't, it prints | 121 /// Checks that pub is running on a supported platform. If it isn't, it prints |
122 /// an error message and exits. Completes when the validation is done. | 122 /// an error message and exits. Completes when the validation is done. |
123 Future validatePlatform() { | 123 Future validatePlatform() { |
124 return new Future.sync(() { | 124 return syncFuture(() { |
125 if (Platform.operatingSystem != 'windows') return null; | 125 if (Platform.operatingSystem != 'windows') return null; |
126 | 126 |
127 return runProcess('ver', []).then((result) { | 127 return runProcess('ver', []).then((result) { |
128 if (result.stdout.join('\n').contains('XP')) { | 128 if (result.stdout.join('\n').contains('XP')) { |
129 log.error('Sorry, but pub is not supported on Windows XP.'); | 129 log.error('Sorry, but pub is not supported on Windows XP.'); |
130 return flushThenExit(exit_codes.USAGE); | 130 return flushThenExit(exit_codes.USAGE); |
131 } | 131 } |
132 }); | 132 }); |
133 }); | 133 }); |
134 } | 134 } |
(...skipping 30 matching lines...) Expand all Loading... |
165 for (var name in names) { | 165 for (var name in names) { |
166 buffer.write(' ${padRight(name, length)} ' | 166 buffer.write(' ${padRight(name, length)} ' |
167 '${PubCommand.commands[name].description}\n'); | 167 '${PubCommand.commands[name].description}\n'); |
168 } | 168 } |
169 | 169 |
170 buffer.write('\n'); | 170 buffer.write('\n'); |
171 buffer.write( | 171 buffer.write( |
172 'Use "pub help [command]" for more information about a command.'); | 172 'Use "pub help [command]" for more information about a command.'); |
173 log.message(buffer.toString()); | 173 log.message(buffer.toString()); |
174 } | 174 } |
OLD | NEW |