Chromium Code Reviews| Index: utils/pub/git_source.dart |
| diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1a720f95a8dc710fa81e116d449fc15ec2a0e55d |
| --- /dev/null |
| +++ b/utils/pub/git_source.dart |
| @@ -0,0 +1,33 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +/** |
| + * A package source that installs packages from Git repos. |
| + */ |
| +class GitSource extends Source { |
|
Bob Nystrom
2012/05/08 17:01:49
Where are the tests for this?
nweiz
2012/05/09 00:21:04
Just confirmed with Emily that we can run Git on t
|
| + final String name = "git"; |
| + |
| + // TODO(nweiz): this should be cached since it uses the network, but until we |
| + // support versions there's no good way to distinguish between different |
| + // checkouts of the same repository. |
| + final bool shouldCache = false; |
| + |
| + GitSource(); |
| + |
| + /** |
| + * Clones a Git repo to the local filesystem. |
| + */ |
| + Future<bool> install(PackageId id, String destPath) { |
| + return runProcess("git", ["clone", "--progress", id.fullName, destPath], |
| + pipeStdout: true, pipeStderr: true). |
| + transform((result) => result.success); |
| + } |
| + |
| + /** |
| + * The package name of a Git repo is the name of the directory into which |
| + * it'll be cloned. |
| + */ |
| + String packageName(PackageId id) => |
| + basename(id.fullName).replaceFirst(const RegExp("\.git\$"), ""); |
|
Bob Nystrom
2012/05/08 17:01:49
Either make this a {} body (which I would prefer,
nweiz
2012/05/09 00:21:04
Done.
|
| +} |