| 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 to make working with IO easier. | 6 * Helper functionality to make working with IO easier. |
| 7 */ | 7 */ |
| 8 #library('io'); | 8 #library('io'); |
| 9 | 9 |
| 10 #import('dart:io'); | 10 #import('dart:io'); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 }); | 536 }); |
| 537 return completer.future; | 537 return completer.future; |
| 538 } | 538 } |
| 539 | 539 |
| 540 /// Tests whether or not the git command-line app is available for use. | 540 /// Tests whether or not the git command-line app is available for use. |
| 541 Future<bool> get isGitInstalled { | 541 Future<bool> get isGitInstalled { |
| 542 if (_isGitInstalledCache != null) { | 542 if (_isGitInstalledCache != null) { |
| 543 // TODO(rnystrom): The sleep is to pump the message queue. Can use | 543 // TODO(rnystrom): The sleep is to pump the message queue. Can use |
| 544 // Future.immediate() when #3356 is fixed. | 544 // Future.immediate() when #3356 is fixed. |
| 545 return sleep(0).transform((_) => _isGitInstalledCache); | 545 return sleep(0).transform((_) => _isGitInstalledCache); |
| 546 } |
| 546 | 547 |
| 547 return _gitCommand.transform((git) => git != null); | 548 return _gitCommand.transform((git) => git != null); |
| 548 } | |
| 549 } | 549 } |
| 550 | 550 |
| 551 /// Run a git process with [args] from [workingDir]. | 551 /// Run a git process with [args] from [workingDir]. |
| 552 Future<PubProcessResult> runGit(List<String> args, [String workingDir]) => | 552 Future<PubProcessResult> runGit(List<String> args, [String workingDir]) => |
| 553 _gitCommand.chain((git) => runProcess(git, args, workingDir)); | 553 _gitCommand.chain((git) => runProcess(git, args, workingDir)); |
| 554 | 554 |
| 555 /// Returns the name of the git command-line app, or null if Git could not be | 555 /// Returns the name of the git command-line app, or null if Git could not be |
| 556 /// found on the user's PATH. | 556 /// found on the user's PATH. |
| 557 Future<String> get _gitCommand { | 557 Future<String> get _gitCommand { |
| 558 // TODO(nweiz): Just use Future.immediate once issue 3356 is fixed. | 558 // TODO(nweiz): Just use Future.immediate once issue 3356 is fixed. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 return new Directory(entry); | 705 return new Directory(entry); |
| 706 } | 706 } |
| 707 | 707 |
| 708 /** | 708 /** |
| 709 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 709 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 710 */ | 710 */ |
| 711 Uri _getUri(uri) { | 711 Uri _getUri(uri) { |
| 712 if (uri is Uri) return uri; | 712 if (uri is Uri) return uri; |
| 713 return new Uri.fromString(uri); | 713 return new Uri.fromString(uri); |
| 714 } | 714 } |
| OLD | NEW |