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.entrypoint; | 5 library pub.entrypoint; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 cache = cache, | 69 cache = cache, |
70 _packageSymlinks = packageSymlinks; | 70 _packageSymlinks = packageSymlinks; |
71 | 71 |
72 /// Creates an entrypoint given package and lockfile objects. | 72 /// Creates an entrypoint given package and lockfile objects. |
73 Entrypoint.inMemory(this.root, this._lockFile, this.cache) | 73 Entrypoint.inMemory(this.root, this._lockFile, this.cache) |
74 : _packageSymlinks = false; | 74 : _packageSymlinks = false; |
75 | 75 |
76 /// The path to the entrypoint's "packages" directory. | 76 /// The path to the entrypoint's "packages" directory. |
77 String get packagesDir => root.path('packages'); | 77 String get packagesDir => root.path('packages'); |
78 | 78 |
| 79 /// The path to the entrypoint's ".packages" file. |
| 80 String get packagesFile => root.path('.packages'); |
| 81 |
79 /// `true` if the entrypoint package currently has a lock file. | 82 /// `true` if the entrypoint package currently has a lock file. |
80 bool get lockFileExists => _lockFile != null || entryExists(lockFilePath); | 83 bool get lockFileExists => _lockFile != null || entryExists(lockFilePath); |
81 | 84 |
82 LockFile get lockFile { | 85 LockFile get lockFile { |
83 if (_lockFile != null) return _lockFile; | 86 if (_lockFile != null) return _lockFile; |
84 | 87 |
85 if (!lockFileExists) { | 88 if (!lockFileExists) { |
86 _lockFile = new LockFile.empty(); | 89 _lockFile = new LockFile.empty(); |
87 } else { | 90 } else { |
88 _lockFile = new LockFile.load(lockFilePath, cache.sources); | 91 _lockFile = new LockFile.load(lockFilePath, cache.sources); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 /// If [packageSymlinks] is true, creates a symlink to the "packages" | 552 /// If [packageSymlinks] is true, creates a symlink to the "packages" |
550 /// directory in [dir]. | 553 /// directory in [dir]. |
551 /// | 554 /// |
552 /// Otherwise, deletes a "packages" directories in [dir] if one exists. | 555 /// Otherwise, deletes a "packages" directories in [dir] if one exists. |
553 void _linkOrDeleteSecondaryPackageDir(String dir) { | 556 void _linkOrDeleteSecondaryPackageDir(String dir) { |
554 var symlink = path.join(dir, 'packages'); | 557 var symlink = path.join(dir, 'packages'); |
555 if (entryExists(symlink)) deleteEntry(symlink); | 558 if (entryExists(symlink)) deleteEntry(symlink); |
556 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); | 559 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); |
557 } | 560 } |
558 } | 561 } |
OLD | NEW |