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

Side by Side Diff: lib/src/pubspec.dart

Issue 1228683003: Fix various pub issues. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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
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 pub.pubspec; 5 library pub.pubspec;
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 import 'package:pub_semver/pub_semver.dart'; 8 import 'package:pub_semver/pub_semver.dart';
9 import 'package:source_span/source_span.dart'; 9 import 'package:source_span/source_span.dart';
10 import 'package:yaml/yaml.dart'; 10 import 'package:yaml/yaml.dart';
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 /// Loads the pubspec for a package located in [packageDir]. 305 /// Loads the pubspec for a package located in [packageDir].
306 /// 306 ///
307 /// If [expectedName] is passed and the pubspec doesn't have a matching name 307 /// If [expectedName] is passed and the pubspec doesn't have a matching name
308 /// field, this will throw a [PubspecError]. 308 /// field, this will throw a [PubspecError].
309 factory Pubspec.load(String packageDir, SourceRegistry sources, 309 factory Pubspec.load(String packageDir, SourceRegistry sources,
310 {String expectedName}) { 310 {String expectedName}) {
311 var pubspecPath = path.join(packageDir, 'pubspec.yaml'); 311 var pubspecPath = path.join(packageDir, 'pubspec.yaml');
312 var pubspecUri = path.toUri(pubspecPath); 312 var pubspecUri = path.toUri(pubspecPath);
313 if (!fileExists(pubspecPath)) { 313 if (!fileExists(pubspecPath)) {
314 throw new FileException( 314 throw new FileException(
315 'Could not find a file named "pubspec.yaml" in "$packageDir".', 315 // Make the package dir absolute because for the entrypoint it'll just
316 // be ".", which may be confusing.
317 'Could not find a file named "pubspec.yaml" in '
318 '"${path.normalize(path.absolute(packageDir))}".',
316 pubspecPath); 319 pubspecPath);
317 } 320 }
318 321
319 return new Pubspec.parse(readTextFile(pubspecPath), sources, 322 return new Pubspec.parse(readTextFile(pubspecPath), sources,
320 expectedName: expectedName, location: pubspecUri); 323 expectedName: expectedName, location: pubspecUri);
321 } 324 }
322 325
323 Pubspec(this._name, {Version version, Iterable<PackageDep> dependencies, 326 Pubspec(this._name, {Version version, Iterable<PackageDep> dependencies,
324 Iterable<PackageDep> devDependencies, 327 Iterable<PackageDep> devDependencies,
325 Iterable<PackageDep> dependencyOverrides, 328 Iterable<PackageDep> dependencyOverrides,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 implements ApplicationException { 577 implements ApplicationException {
575 PubspecException(String message, SourceSpan span) 578 PubspecException(String message, SourceSpan span)
576 : super(message, span); 579 : super(message, span);
577 } 580 }
578 581
579 /// Returns whether [uri] is a file URI. 582 /// Returns whether [uri] is a file URI.
580 /// 583 ///
581 /// This is slightly more complicated than just checking if the scheme is 584 /// This is slightly more complicated than just checking if the scheme is
582 /// 'file', since relative URIs also refer to the filesystem on the VM. 585 /// 'file', since relative URIs also refer to the filesystem on the VM.
583 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == ''; 586 bool _isFileUri(Uri uri) => uri.scheme == 'file' || uri.scheme == '';
OLDNEW
« lib/src/dart.dart ('K') | « lib/src/package.dart ('k') | test/packages_file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698