36371653f4
Review URL: https://chromiumcodereview.appspot.com//10214006 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6985 260f80e4-7a28-3924-810f-c04153c831b5
31 lines
993 B
Dart
31 lines
993 B
Dart
// 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.
|
|
|
|
/** Handles the `update` pub command. */
|
|
class UpdateCommand extends PubCommand {
|
|
String get description() =>
|
|
"update the current package's dependencies to the latest versions";
|
|
|
|
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));
|
|
}
|
|
});
|
|
}
|
|
}
|