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

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

Issue 10981031: Convert raw strings in pub (and apidoc) to new syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to review. Created 8 years, 2 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 | « utils/apidoc/mdn/extract.dart ('k') | utils/pub/version.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 #library('hosted_source'); 5 #library('hosted_source');
6 6
7 #import('dart:io', prefix: 'io'); 7 #import('dart:io', prefix: 'io');
8 #import('dart:json'); 8 #import('dart:json');
9 #import('dart:uri'); 9 #import('dart:uri');
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 /** 91 /**
92 * The system cache directory for the hosted source contains subdirectories 92 * The system cache directory for the hosted source contains subdirectories
93 * for each separate repository URL that's used on the system. Each of these 93 * for each separate repository URL that's used on the system. Each of these
94 * subdirectories then contains a subdirectory for each package installed 94 * subdirectories then contains a subdirectory for each package installed
95 * from that site. 95 * from that site.
96 */ 96 */
97 String systemCacheDirectory(PackageId id) { 97 String systemCacheDirectory(PackageId id) {
98 var parsed = _parseDescription(id.description); 98 var parsed = _parseDescription(id.description);
99 var url = parsed.last.replaceAll(new RegExp(@"^https?://"), ""); 99 var url = parsed.last.replaceAll(new RegExp(r"^https?://"), "");
100 var urlDir = replace(url, new RegExp(@'[<>:"\\/|?*%]'), (match) { 100 var urlDir = replace(url, new RegExp(r'[<>:"\\/|?*%]'), (match) {
101 return '%${match[0].charCodeAt(0)}'; 101 return '%${match[0].charCodeAt(0)}';
102 }); 102 });
103 return join(systemCacheRoot, urlDir, "${parsed.first}-${id.version}"); 103 return join(systemCacheRoot, urlDir, "${parsed.first}-${id.version}");
104 } 104 }
105 105
106 String packageName(description) => _parseDescription(description).first; 106 String packageName(description) => _parseDescription(description).first;
107 107
108 bool descriptionsEqual(description1, description2) => 108 bool descriptionsEqual(description1, description2) =>
109 _parseDescription(description1) == _parseDescription(description2); 109 _parseDescription(description1) == _parseDescription(description2);
110 110
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « utils/apidoc/mdn/extract.dart ('k') | utils/pub/version.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698