| OLD | NEW |
| 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 library pub.source.hosted; | 5 library pub.source.hosted; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 import "dart:convert"; | 9 import "dart:convert"; |
| 10 | 10 |
| 11 import 'package:http/http.dart' as http; | 11 import 'package:http/http.dart' as http; |
| 12 import 'package:path/path.dart' as path; | 12 import 'package:path/path.dart' as path; |
| 13 import 'package:pub_semver/pub_semver.dart'; |
| 13 | 14 |
| 14 import '../exceptions.dart'; | 15 import '../exceptions.dart'; |
| 15 import '../http.dart'; | 16 import '../http.dart'; |
| 16 import '../io.dart'; | 17 import '../io.dart'; |
| 17 import '../log.dart' as log; | 18 import '../log.dart' as log; |
| 18 import '../package.dart'; | 19 import '../package.dart'; |
| 19 import '../pubspec.dart'; | 20 import '../pubspec.dart'; |
| 20 import '../utils.dart'; | 21 import '../utils.dart'; |
| 21 import '../version.dart'; | |
| 22 import 'cached.dart'; | 22 import 'cached.dart'; |
| 23 | 23 |
| 24 /// A package source that gets packages from a package hosting site that uses | 24 /// A package source that gets packages from a package hosting site that uses |
| 25 /// the same API as pub.dartlang.org. | 25 /// the same API as pub.dartlang.org. |
| 26 class HostedSource extends CachedSource { | 26 class HostedSource extends CachedSource { |
| 27 final name = "hosted"; | 27 final name = "hosted"; |
| 28 final hasMultipleVersions = true; | 28 final hasMultipleVersions = true; |
| 29 | 29 |
| 30 /// Gets the default URL for the package server for hosted dependencies. | 30 /// Gets the default URL for the package server for hosted dependencies. |
| 31 static String get defaultUrl { | 31 static String get defaultUrl { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 var name = description["name"]; | 355 var name = description["name"]; |
| 356 if (name is! String) { | 356 if (name is! String) { |
| 357 throw new FormatException("The 'name' key must have a string value."); | 357 throw new FormatException("The 'name' key must have a string value."); |
| 358 } | 358 } |
| 359 | 359 |
| 360 var url = description["url"]; | 360 var url = description["url"]; |
| 361 if (url == null) url = HostedSource.defaultUrl; | 361 if (url == null) url = HostedSource.defaultUrl; |
| 362 | 362 |
| 363 return new Pair<String, String>(name, url); | 363 return new Pair<String, String>(name, url); |
| 364 } | 364 } |
| OLD | NEW |