| Index: utils/pub/command_lish.dart
|
| diff --git a/utils/pub/command_lish.dart b/utils/pub/command_lish.dart
|
| index 1e5673da28f9b82319315a44d9776cff89cd891e..4a370d7d67a1815dce0c76525bb35b7b3c167b9e 100644
|
| --- a/utils/pub/command_lish.dart
|
| +++ b/utils/pub/command_lish.dart
|
| @@ -109,7 +109,7 @@ class LishCommand extends PubCommand {
|
|
|
| /// The basenames of directories that are automatically excluded from
|
| /// archives.
|
| - final _BLACKLISTED_DIRECTORIES = const ['packages'];
|
| + final _BLACKLISTED_DIRS = const ['packages'];
|
|
|
| /// Returns a list of files that should be included in the published package.
|
| /// If this is a Git repository, this will respect .gitignore; otherwise, it
|
| @@ -117,11 +117,8 @@ class LishCommand extends PubCommand {
|
| Future<List<String>> get _filesToPublish {
|
| var rootDir = entrypoint.root.dir;
|
|
|
| - return Future.wait([
|
| - dirExists(join(rootDir, '.git')),
|
| - git.isInstalled
|
| - ]).then((results) {
|
| - if (results[0] && results[1]) {
|
| + return git.isInstalled.then((gitInstalled) {
|
| + if (dirExists(join(rootDir, '.git')) && gitInstalled) {
|
| // List all files that aren't gitignored, including those not checked
|
| // in to Git.
|
| return git.run(["ls-files", "--cached", "--others",
|
| @@ -129,27 +126,17 @@ class LishCommand extends PubCommand {
|
| }
|
|
|
| return listDir(rootDir, recursive: true).then((entries) {
|
| - return Future.wait(entries.map((entry) {
|
| - return fileExists(entry).then((isFile) {
|
| - // Skip directories.
|
| - if (!isFile) return null;
|
| -
|
| - // TODO(rnystrom): Making these relative will break archive
|
| - // creation if the cwd is ever *not* the package root directory.
|
| - // Should instead only make these relative right before generating
|
| - // the tree display (which is what really needs them to be).
|
| - // Make it relative to the package root.
|
| - return relativeTo(entry, rootDir);
|
| - });
|
| - }));
|
| + return entries
|
| + .where(fileExists) // Skip directories.
|
| + .map((entry) => relativeTo(entry, rootDir));
|
| });
|
| - }).then((files) => files.where((file) {
|
| - if (file == null || _BLACKLISTED_FILES.contains(basename(file))) {
|
| - return false;
|
| - }
|
| + }).then((files) => files.where(_shouldPublish).toList());
|
| + }
|
|
|
| - return !splitPath(file).any(_BLACKLISTED_DIRECTORIES.contains);
|
| - }).toList());
|
| + /// Returns `true` if [file] should be published.
|
| + bool _shouldPublish(String file) {
|
| + if (_BLACKLISTED_FILES.contains(basename(file))) return false;
|
| + return !splitPath(file).any(_BLACKLISTED_DIRS.contains);
|
| }
|
|
|
| /// Returns the value associated with [key] in [map]. Throws a user-friendly
|
|
|