| 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('hosted_source'); | 5 library hosted_source; |
| 6 | 6 |
| 7 #import('dart:io', prefix: 'io'); | 7 import 'dart:io' as io; |
| 8 #import('dart:json'); | 8 import 'dart:json'; |
| 9 #import('dart:uri'); | 9 import 'dart:uri'; |
| 10 | 10 |
| 11 #import('io.dart'); | 11 import 'io.dart'; |
| 12 #import('package.dart'); | 12 import 'package.dart'; |
| 13 #import('pubspec.dart'); | 13 import 'pubspec.dart'; |
| 14 #import('source.dart'); | 14 import 'source.dart'; |
| 15 #import('source_registry.dart'); | 15 import 'source_registry.dart'; |
| 16 #import('utils.dart'); | 16 import 'utils.dart'; |
| 17 #import('version.dart'); | 17 import 'version.dart'; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * A package source that installs packages from a package hosting site that | 20 * A package source that installs packages from a package hosting site that |
| 21 * uses the same API as pub.dartlang.org. | 21 * uses the same API as pub.dartlang.org. |
| 22 */ | 22 */ |
| 23 class HostedSource extends Source { | 23 class HostedSource extends Source { |
| 24 final name = "hosted"; | 24 final name = "hosted"; |
| 25 final shouldCache = true; | 25 final shouldCache = true; |
| 26 | 26 |
| 27 /** | 27 /** |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 var name = description["name"]; | 143 var name = description["name"]; |
| 144 if (name is! String) { | 144 if (name is! String) { |
| 145 throw new FormatException("The 'name' key must have a string value."); | 145 throw new FormatException("The 'name' key must have a string value."); |
| 146 } | 146 } |
| 147 | 147 |
| 148 var url = description.containsKey("url") ? description["url"] : defaultUrl; | 148 var url = description.containsKey("url") ? description["url"] : defaultUrl; |
| 149 return new Pair<String, String>(name, url); | 149 return new Pair<String, String>(name, url); |
| 150 } | 150 } |
| 151 } | 151 } |
| OLD | NEW |