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

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: Respond to review. 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
« no previous file with comments | « utils/pub/command_version.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/git_source.dart
diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart
index cc08e39113482b6a606d53ac5747e51fa1df1762..f2cfa025ed3022f5df89b9a3a84bb335a344baf5 100644
--- a/utils/pub/git_source.dart
+++ b/utils/pub/git_source.dart
@@ -22,9 +22,18 @@ 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],
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698