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 | |
82 /// `true` if the entrypoint package currently has a lock file. | 79 /// `true` if the entrypoint package currently has a lock file. |
83 bool get lockFileExists => _lockFile != null || entryExists(lockFilePath); | 80 bool get lockFileExists => _lockFile != null || entryExists(lockFilePath); |
84 | 81 |
85 LockFile get lockFile { | 82 LockFile get lockFile { |
86 if (_lockFile != null) return _lockFile; | 83 if (_lockFile != null) return _lockFile; |
87 | 84 |
88 if (!lockFileExists) { | 85 if (!lockFileExists) { |
89 _lockFile = new LockFile.empty(); | 86 _lockFile = new LockFile.empty(); |
90 } else { | 87 } else { |
91 _lockFile = new LockFile.load(lockFilePath, cache.sources); | 88 _lockFile = new LockFile.load(lockFilePath, cache.sources); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 /// If [packageSymlinks] is true, creates a symlink to the "packages" | 560 /// If [packageSymlinks] is true, creates a symlink to the "packages" |
564 /// directory in [dir]. | 561 /// directory in [dir]. |
565 /// | 562 /// |
566 /// Otherwise, deletes a "packages" directories in [dir] if one exists. | 563 /// Otherwise, deletes a "packages" directories in [dir] if one exists. |
567 void _linkOrDeleteSecondaryPackageDir(String dir) { | 564 void _linkOrDeleteSecondaryPackageDir(String dir) { |
568 var symlink = path.join(dir, 'packages'); | 565 var symlink = path.join(dir, 'packages'); |
569 if (entryExists(symlink)) deleteEntry(symlink); | 566 if (entryExists(symlink)) deleteEntry(symlink); |
570 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); | 567 if (_packageSymlinks) createSymlink(packagesDir, symlink, relative: true); |
571 } | 568 } |
572 } | 569 } |
OLD | NEW |