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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/command/cache.dart

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 3 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
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 pub.command.cache; 5 library pub.command.cache;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert';
8 import 'dart:io'; 9 import 'dart:io';
9 import 'dart:json' as json;
10 10
11 import '../command.dart'; 11 import '../command.dart';
12 import '../exit_codes.dart' as exit_codes; 12 import '../exit_codes.dart' as exit_codes;
13 import '../log.dart' as log; 13 import '../log.dart' as log;
14 14
15 /// Handles the `cache` pub command. 15 /// Handles the `cache` pub command.
16 class CacheCommand extends PubCommand { 16 class CacheCommand extends PubCommand {
17 String get description => "Inspect the system cache."; 17 String get description => "Inspect the system cache.";
18 String get usage => 'pub cache list'; 18 String get usage => 'pub cache list';
19 bool get hidden => true; 19 bool get hidden => true;
(...skipping 16 matching lines...) Expand all
36 var packagesObj = <String, Map>{}; 36 var packagesObj = <String, Map>{};
37 37
38 for (var package in cache.sources.defaultSource.getCachedPackages()) { 38 for (var package in cache.sources.defaultSource.getCachedPackages()) {
39 39
40 var packageInfo = packagesObj.putIfAbsent(package.name, () => {}); 40 var packageInfo = packagesObj.putIfAbsent(package.name, () => {});
41 packageInfo[package.version.toString()] = {'location': package.dir}; 41 packageInfo[package.version.toString()] = {'location': package.dir};
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.encode({'packages': packagesObj}));
47 } 47 }
48 } 48 }
49 49
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698