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

Unified Diff: utils/pub/command_update.dart

Issue 10207018: First pass at "pub update" implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor cleanup. Created 8 years, 8 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/command_update.dart
diff --git a/utils/pub/command_update.dart b/utils/pub/command_update.dart
index c1fe4f4816b65723c926c8684b30c3770c32da77..2bc03f76ec313fdab3fdb846b852b2490ae56d8e 100644
--- a/utils/pub/command_update.dart
+++ b/utils/pub/command_update.dart
@@ -4,5 +4,24 @@
/** Handles the `update` pub command. */
void commandUpdate(PubOptions options, List<String> args) {
- throw 'not implemented yet';
+ // TODO(rnystrom): Should validate args.
+
+ var entrypoint;
+ var packagesDir;
+ var dependencies;
nweiz 2012/04/25 17:50:47 These should be listed in the same order they're a
Bob Nystrom 2012/04/25 22:20:29 Done.
+
+ getWorkingPackage().chain((package) {
+ entrypoint = package;
+ return package.traverseDependencies();
+ }).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));
+ }
+ });
}
« no previous file with comments | « utils/pub/command_list.dart ('k') | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698