| 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 /** | 5 /** |
| 6 * Helper functionality for invoking Git. | 6 * Helper functionality for invoking Git. |
| 7 */ | 7 */ |
| 8 #library('git'); | 8 library git; |
| 9 | 9 |
| 10 #import('io.dart'); | 10 import 'io.dart'; |
| 11 #import('utils.dart'); | 11 import 'utils.dart'; |
| 12 | 12 |
| 13 /// Tests whether or not the git command-line app is available for use. | 13 /// Tests whether or not the git command-line app is available for use. |
| 14 Future<bool> get isInstalled { | 14 Future<bool> get isInstalled { |
| 15 if (_isGitInstalledCache != null) { | 15 if (_isGitInstalledCache != null) { |
| 16 // TODO(rnystrom): The sleep is to pump the message queue. Can use | 16 // TODO(rnystrom): The sleep is to pump the message queue. Can use |
| 17 // Future.immediate() when #3356 is fixed. | 17 // Future.immediate() when #3356 is fixed. |
| 18 return sleep(0).transform((_) => _isGitInstalledCache); | 18 return sleep(0).transform((_) => _isGitInstalledCache); |
| 19 } | 19 } |
| 20 | 20 |
| 21 return _gitCommand.transform((git) => git != null); | 21 return _gitCommand.transform((git) => git != null); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 }); | 75 }); |
| 76 | 76 |
| 77 future.handleException((err) { | 77 future.handleException((err) { |
| 78 // If the process failed, they probably don't have it. | 78 // If the process failed, they probably don't have it. |
| 79 completer.complete(false); | 79 completer.complete(false); |
| 80 return true; | 80 return true; |
| 81 }); | 81 }); |
| 82 | 82 |
| 83 return completer.future; | 83 return completer.future; |
| 84 } | 84 } |
| OLD | NEW |