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

Side by Side Diff: lib/src/source/hosted.dart

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 4 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
« no previous file with comments | « lib/src/source/git.dart ('k') | lib/src/system_cache.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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io' as io; 6 import 'dart:io' as io;
7 import "dart:convert"; 7 import "dart:convert";
8 8
9 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 var parsed = source._parseDescription(id.description); 205 var parsed = source._parseDescription(id.description);
206 var dir = _urlToDirectory(parsed.last); 206 var dir = _urlToDirectory(parsed.last);
207 return p.join(systemCacheRoot, dir, "${parsed.first}-${id.version}"); 207 return p.join(systemCacheRoot, dir, "${parsed.first}-${id.version}");
208 } 208 }
209 209
210 /// Re-downloads all packages that have been previously downloaded into the 210 /// Re-downloads all packages that have been previously downloaded into the
211 /// system cache from any server. 211 /// system cache from any server.
212 Future<Pair<List<PackageId>, List<PackageId>>> repairCachedPackages() async { 212 Future<Pair<List<PackageId>, List<PackageId>>> repairCachedPackages() async {
213 if (!dirExists(systemCacheRoot)) return new Pair([], []); 213 if (!dirExists(systemCacheRoot)) return new Pair([], []);
214 214
215 var successes = []; 215 var successes = <PackageId>[];
216 var failures = []; 216 var failures = <PackageId>[];
217 217
218 for (var serverDir in listDir(systemCacheRoot)) { 218 for (var serverDir in listDir(systemCacheRoot)) {
219 var url = _directoryToUrl(p.basename(serverDir)); 219 var url = _directoryToUrl(p.basename(serverDir));
220 var packages = _getCachedPackagesInDirectory(p.basename(serverDir)); 220 var packages = _getCachedPackagesInDirectory(p.basename(serverDir));
221 packages.sort(Package.orderByNameAndVersion); 221 packages.sort(Package.orderByNameAndVersion);
222 222
223 for (var package in packages) { 223 for (var package in packages) {
224 var id = source.idFor(package.name, package.version, url: url); 224 var id = source.idFor(package.name, package.version, url: url);
225 225
226 try { 226 try {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // Since HostedSource is cached, this will only be called for uncached 419 // Since HostedSource is cached, this will only be called for uncached
420 // packages. 420 // packages.
421 throw new UnsupportedError("Cannot download packages when offline."); 421 throw new UnsupportedError("Cannot download packages when offline.");
422 } 422 }
423 423
424 Future<Pubspec> describeUncached(PackageId id) { 424 Future<Pubspec> describeUncached(PackageId id) {
425 throw new PackageNotFoundException( 425 throw new PackageNotFoundException(
426 "${id.name} ${id.version} is not available in your system cache."); 426 "${id.name} ${id.version} is not available in your system cache.");
427 } 427 }
428 } 428 }
OLDNEW
« no previous file with comments | « lib/src/source/git.dart ('k') | lib/src/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698