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

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

Issue 16034002: Use helper methods for running pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Get rid of unnecessary RegExps in tests. Created 7 years, 7 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) 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 package; 5 library package;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:pathos/path.dart' as path; 9 import 'package:pathos/path.dart' as path;
10 10
11 import 'io.dart'; 11 import 'io.dart';
12 import 'pubspec.dart'; 12 import 'pubspec.dart';
13 import 'source_registry.dart'; 13 import 'source_registry.dart';
14 import 'utils.dart';
14 import 'version.dart'; 15 import 'version.dart';
15 16
16 final _README_REGEXP = new RegExp(r"^README($|\.)", caseSensitive: false); 17 final _README_REGEXP = new RegExp(r"^README($|\.)", caseSensitive: false);
17 18
18 /// A named, versioned, unit of code and resource reuse. 19 /// A named, versioned, unit of code and resource reuse.
19 class Package { 20 class Package {
20 /// The path to the directory containing the package. 21 /// The path to the directory containing the package.
21 final String dir; 22 final String dir;
22 23
23 /// The name of the package. 24 /// The name of the package.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool operator ==(other) { 184 bool operator ==(other) {
184 // TODO(rnystrom): We're assuming here that we don't need to delve into the 185 // TODO(rnystrom): We're assuming here that we don't need to delve into the
185 // description. 186 // description.
186 return other is PackageDep && 187 return other is PackageDep &&
187 other.name == name && 188 other.name == name &&
188 other.source == source && 189 other.source == source &&
189 other.constraint == constraint; 190 other.constraint == constraint;
190 } 191 }
191 } 192 }
192 193
193 class PubspecNotFoundException implements Exception { 194 class PubspecNotFoundException extends ApplicationException {
194 final String name; 195 final String name;
195 196
196 PubspecNotFoundException(this.name); 197 PubspecNotFoundException(String name)
197 198 : name = name,
198 String toString() => 'Package "$name" doesn\'t have a pubspec.yaml file.'; 199 super('Package "$name" doesn\'t have a pubspec.yaml file.');
199 } 200 }
200 201
201 class PubspecHasNoNameException implements Exception { 202 class PubspecHasNoNameException extends ApplicationException {
202 final String name; 203 final String name;
203 204
204 PubspecHasNoNameException(this.name); 205 PubspecHasNoNameException(String name)
205 206 : name = name,
206 String toString() => 'Package "$name"\'s pubspec.yaml file is missing the ' 207 super('Package "$name"\'s pubspec.yaml file is missing the '
207 'required "name" field (e.g. "name: $name").'; 208 'required "name" field (e.g. "name: $name").');
208 } 209 }
209 210
210 class PubspecNameMismatchException implements Exception { 211 class PubspecNameMismatchException extends ApplicationException {
211 final String expectedName; 212 final String expectedName;
212 final String actualName; 213 final String actualName;
213 214
214 PubspecNameMismatchException(this.expectedName, this.actualName); 215 PubspecNameMismatchException(String expectedName, String actualName)
215 216 : expectedName = expectedName,
216 String toString() => 'The name you specified for your dependency, ' 217 actualName = actualName,
217 '"$expectedName", doesn\'t match the name "$actualName" in its pubspec.'; 218 super('The name you specified for your dependency, "$expectedName", '
219 'doesn\'t match the name "$actualName" in its pubspec.');
218 } 220 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command.dart ('k') | sdk/lib/_internal/pub/lib/src/solver/version_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698