Chromium Code Reviews| Index: utils/pub/command_update.dart |
| diff --git a/utils/pub/command_update.dart b/utils/pub/command_update.dart |
| index c1fe4f4816b65723c926c8684b30c3770c32da77..c932ebe149a7784316d0d04fc0ee6e5f2c1d4b3e 100644 |
| --- a/utils/pub/command_update.dart |
| +++ b/utils/pub/command_update.dart |
| @@ -3,6 +3,27 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| /** Handles the `update` pub command. */ |
| -void commandUpdate(PubOptions options, List<String> args) { |
| - throw 'not implemented yet'; |
| +class UpdateCommand extends PubCommand { |
| + String get description() => "update a package's dependencies"; |
|
nweiz
2012/04/25 20:49:41
"update the current package's dependencies to the
Bob Nystrom
2012/04/25 22:56:40
Done.
|
| + |
| + void onRun() { |
| + var entrypoint; |
| + var packagesDir; |
| + var dependencies; |
| + |
| + getWorkingPackage().chain((package) { |
| + entrypoint = package; |
| + return package.traverseDependencies(cache); |
| + }).chain((packages) { |
| + dependencies = packages; |
| + // TODO(rnystrom): Make this path configurable. |
| + packagesDir = join(entrypoint.dir, 'packages'); |
| + return cleanDir(packagesDir); |
| + }).then((dir) { |
| + // Symlink each dependency. |
| + for (final package in dependencies) { |
| + createSymlink(package.dir, join(packagesDir, package.name)); |
| + } |
| + }); |
| + } |
| } |