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 entrypoint; | 5 library entrypoint; |
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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 log.fine("Deleting package directory for ${id.name} before install."); | 80 log.fine("Deleting package directory for ${id.name} before install."); |
81 deleteEntry(packageDir); | 81 deleteEntry(packageDir); |
82 } | 82 } |
83 | 83 |
84 if (id.source.shouldCache) { | 84 if (id.source.shouldCache) { |
85 return cache.install(id).then( | 85 return cache.install(id).then( |
86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir)); | 86 (pkg) => createPackageSymlink(id.name, pkg.dir, packageDir)); |
87 } else { | 87 } else { |
88 return id.source.install(id, packageDir).then((found) { | 88 return id.source.install(id, packageDir).then((found) { |
89 if (found) return null; | 89 if (found) return null; |
90 // TODO(nweiz): More robust error-handling. | 90 throw new UserFacingException('Package ${id.name} not found in ' |
Bob Nystrom
2013/04/18 18:18:31
That name is a bit strange. How about "PubFailure"
nweiz
2013/04/18 18:37:24
"PubFailure" sounds very generic to me. Is an unex
Bob Nystrom
2013/04/18 20:02:13
I guess so, but I'd consider that more of an under
nweiz
2013/04/18 20:12:01
Done.
| |
91 throw 'Package ${id.name} not found in source "${id.source.name}".'; | 91 'source "${id.source.name}".'); |
92 }); | 92 }); |
93 } | 93 } |
94 }).then((_) => id.resolved); | 94 }).then((_) => id.resolved); |
95 | 95 |
96 _installs[id] = future; | 96 _installs[id] = future; |
97 | 97 |
98 return future; | 98 return future; |
99 } | 99 } |
100 | 100 |
101 /// Installs all dependencies of the [root] package to its "packages" | 101 /// Installs all dependencies of the [root] package to its "packages" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 } | 276 } |
277 | 277 |
278 /// Creates a symlink to the `packages` directory in [dir]. Will replace one | 278 /// Creates a symlink to the `packages` directory in [dir]. Will replace one |
279 /// if already there. | 279 /// if already there. |
280 void _linkSecondaryPackageDir(String dir) { | 280 void _linkSecondaryPackageDir(String dir) { |
281 var symlink = path.join(dir, 'packages'); | 281 var symlink = path.join(dir, 'packages'); |
282 if (entryExists(symlink)) deleteEntry(symlink); | 282 if (entryExists(symlink)) deleteEntry(symlink); |
283 createSymlink(packagesDir, symlink, relative: true); | 283 createSymlink(packagesDir, symlink, relative: true); |
284 } | 284 } |
285 } | 285 } |
OLD | NEW |