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

Side by Side Diff: utils/pub/pub.dart

Issue 10356133: Reverting 7566, which is causing build breakage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/unittest/unittest.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * The main entrypoint for the pub command line application. 6 * The main entrypoint for the pub command line application.
7 */ 7 */
8 #library('pub'); 8 #library('pub');
9 9
10 #import('yaml/yaml.dart'); 10 #import('yaml/yaml.dart');
(...skipping 17 matching lines...) Expand all
28 // TODO(rnystrom): In addition to explicit "help" and "version" commands, 28 // TODO(rnystrom): In addition to explicit "help" and "version" commands,
29 // should also add special-case support for --help and --version arguments to 29 // should also add special-case support for --help and --version arguments to
30 // be consistent with other Unix apps. 30 // be consistent with other Unix apps.
31 final commands = { 31 final commands = {
32 'list': new ListCommand(), 32 'list': new ListCommand(),
33 'install': new InstallCommand(), 33 'install': new InstallCommand(),
34 'update': new UpdateCommand(), 34 'update': new UpdateCommand(),
35 'version': new VersionCommand() 35 'version': new VersionCommand()
36 }; 36 };
37 37
38 // TODO(rnystrom): Hack. This is temporary code to allow the pub tests to
39 // pass in relevant paths. Eventually these should be either environment
40 // variables or at least a cleaner arg parser.
41 var cacheDir, sdkDir;
42 for (var i = 0; i < args.length; i++) {
43 if (args[i].startsWith('--cachedir=')) {
44 cacheDir = args[i].substring('--cachedir='.length);
45 args.removeRange(i, 1);
46 i--;
47 } else if (args[i].startsWith('--sdkdir=')) {
48 sdkDir = args[i].substring('--sdkdir='.length);
49 args.removeRange(i, 1);
50 i--;
51 }
52 }
53
54 if (args.length == 0) { 38 if (args.length == 0) {
55 printUsage(commands); 39 printUsage(commands);
56 return; 40 return;
57 } 41 }
58 42
59 // For consistency with expected unix idioms, support --help, -h, and 43 // For consistency with expected unix idioms, support --help, -h, and
60 // --version in addition to the regular commands. 44 // --version in addition to the regular commands.
61 if (args.length == 1) { 45 if (args.length == 1) {
62 if (args[0] == '--help' || args[0] == '-h') { 46 if (args[0] == '--help' || args[0] == '-h') {
63 printUsage(commands); 47 printUsage(commands);
64 return; 48 return;
65 } 49 }
66 50
67 if (args[0] == '--version') { 51 if (args[0] == '--version') {
68 printVersion(); 52 printVersion();
69 return; 53 return;
70 } 54 }
71 } 55 }
72 56
57 // TODO(rnystrom): Hack. This is temporary code to allow the pub tests to
58 // pass in relevant paths. Eventually these should be either environment
59 // variables or at least a cleaner arg parser.
60 var cacheDir, sdkDir;
61 for (var i = 0; i < args.length; i++) {
62 if (args[i].startsWith('--cachedir=')) {
63 cacheDir = args[i].substring('--cachedir='.length);
64 args.removeRange(i, 1);
65 i--;
66 } else if (args[i].startsWith('--sdkdir=')) {
67 sdkDir = args[i].substring('--sdkdir='.length);
68 args.removeRange(i, 1);
69 i--;
70 }
71 }
72
73 // TODO(rnystrom): Do we want this to be global? 73 // TODO(rnystrom): Do we want this to be global?
74 final cache = new SystemCache(cacheDir); 74 final cache = new SystemCache(cacheDir);
75 75
76 Source.defaultSource = new SdkSource(sdkDir); 76 Source.defaultSource = new SdkSource(sdkDir);
77 77
78 // Select the command. 78 // Select the command.
79 final command = commands[args[0]]; 79 final command = commands[args[0]];
80 if (command == null) { 80 if (command == null) {
81 print('Unknown command "${args[0]}".'); 81 print('Unknown command "${args[0]}".');
82 print('Run "pub help" to see available commands.'); 82 print('Run "pub help" to see available commands.');
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // subdirectories until we hit one that looks package-like. For now, just 138 // subdirectories until we hit one that looks package-like. For now, just
139 // assume the cwd is it. 139 // assume the cwd is it.
140 Package.load(workingDir).then((pkg) { 140 Package.load(workingDir).then((pkg) {
141 packagesDir = new PackagesDir(pkg, cache); 141 packagesDir = new PackagesDir(pkg, cache);
142 onRun(); 142 onRun();
143 }); 143 });
144 } 144 }
145 145
146 abstract void onRun(); 146 abstract void onRun();
147 } 147 }
OLDNEW
« no previous file with comments | « lib/unittest/unittest.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698