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

Unified Diff: utils/pub/command_update.dart

Issue 10214006: Refactor command code and add support for --help and --version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. 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
« no previous file with comments | « utils/pub/command_list.dart ('k') | utils/pub/command_version.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/command_update.dart
diff --git a/utils/pub/command_update.dart b/utils/pub/command_update.dart
index 27e04b5ea30ff5e0862d0cbab482924433bca842..a348f3f9a082dc69c2d0a2912e74b55275f3a6ba 100644
--- a/utils/pub/command_update.dart
+++ b/utils/pub/command_update.dart
@@ -3,25 +3,28 @@
// BSD-style license that can be found in the LICENSE file.
/** Handles the `update` pub command. */
-void commandUpdate(PubOptions options, List<String> args) {
- // TODO(rnystrom): Should validate args.
+class UpdateCommand extends PubCommand {
+ String get description() =>
+ "update the current package's dependencies to the latest versions";
- var entrypoint;
- var dependencies;
- var packagesDir;
+ void onRun() {
+ var entrypoint;
+ var packagesDir;
+ var dependencies;
- 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));
- }
- });
+ 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));
+ }
+ });
+ }
}
« no previous file with comments | « utils/pub/command_list.dart ('k') | utils/pub/command_version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698