Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Unified Diff: utils/pub/git_source.dart

Issue 10421026: Make pub handle missing git more gracefully. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/pub/git_source.dart
diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart
index cc08e39113482b6a606d53ac5747e51fa1df1762..86acc736367c842192eeff33cb166ff621983cc6 100644
--- a/utils/pub/git_source.dart
+++ b/utils/pub/git_source.dart
@@ -22,9 +22,17 @@ class GitSource extends Source {
* Clones a Git repo to the local filesystem.
*/
Future<bool> install(PackageId id, String destPath) {
- return runProcess("git", ["clone", "--progress", id.description, destPath],
- pipeStdout: true, pipeStderr: true).
- transform((result) => result.success);
+ return isGitInstalled.chain((installed) {
+ if (installed) {
+ return runProcess("git", ["clone", "--progress", id.description, destPath],
nweiz 2012/05/23 00:46:26 Line length
Bob Nystrom 2012/05/23 16:32:33 Done.
+ pipeStdout: true, pipeStderr: true).
+ transform((result) => result.success);
+ } else {
+ throw new Exception(
+ "Cannot install '${id.name}' from Git (${id.description}).\n"
+ "Please ensure Git is correctly installed.");
+ }
+ });
}
/**
« no previous file with comments | « utils/pub/command_version.dart ('k') | utils/pub/io.dart » ('j') | utils/pub/pub.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698