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

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

Issue 13332009: Make listDir and createSymlink synchronous in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/command_lish.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library command_cache; 5 library command_cache;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 10
(...skipping 15 matching lines...) Expand all
26 exit(exit_codes.USAGE); 26 exit(exit_codes.USAGE);
27 } 27 }
28 28
29 if ((commandOptions.rest[0] != 'list')) { 29 if ((commandOptions.rest[0] != 'list')) {
30 log.error('Unknown cache command "${commandOptions.rest[0]}".'); 30 log.error('Unknown cache command "${commandOptions.rest[0]}".');
31 this.printUsage(); 31 this.printUsage();
32 exit(exit_codes.USAGE); 32 exit(exit_codes.USAGE);
33 } 33 }
34 34
35 // TODO(keertip): Add flag to list packages from non default sources 35 // TODO(keertip): Add flag to list packages from non default sources
36 return cache.sources.defaultSource.getCachedPackages().then((packages){ 36 var packagesObj = <String, Map>{};
37 var packagesObj = <String, Map>{}; 37 for (var package in cache.sources.defaultSource.getCachedPackages()) {
38 for (var package in packages){ 38 packagesObj[package.name] = {
39 packagesObj[package.name] = { 39 'version': package.version.toString(),
40 'version': package.version.toString(), 40 'location': package.dir
41 'location': package.dir 41 };
42 }; 42 }
43 } 43
44 // TODO(keertip): Add support for non-JSON format 44 // TODO(keertip): Add support for non-JSON format
45 // and check for --format flag 45 // and check for --format flag
46 log.message( json.stringify({'packages': packagesObj})); 46 log.message(json.stringify({'packages': packagesObj}));
47 });
48 } 47 }
49 } 48 }
50 49
OLDNEW
« no previous file with comments | « no previous file | utils/pub/command_lish.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698