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

Unified Diff: utils/pub/command_lish.dart

Issue 11308298: Restrict the set of files that will be pub lished. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/command_lish.dart
diff --git a/utils/pub/command_lish.dart b/utils/pub/command_lish.dart
index 7563bb1111e08aafae61e017b5620d57b26e1af3..e585ce562a64eefe6f52781323494b1292cc52b0 100644
--- a/utils/pub/command_lish.dart
+++ b/utils/pub/command_lish.dart
@@ -113,6 +113,13 @@ class LishCommand extends PubCommand {
});
}
+ /// The basenames of files that are automatically excluded from archives.
+ final _BLACKLISTED_FILES = const ['pubspec.lock'];
+
+ /// The basenames of directories that are automatically excluded from
+ /// archives.
+ final _BLACKLISTED_DIRECTORIES = 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
/// will return all non-hidden files.
@@ -134,7 +141,10 @@ class LishCommand extends PubCommand {
}));
});
}).transform((files) => files.filter((file) {
- return file != null && basename(file) != 'packages';
+ if (file == null || _BLACKLISTED_FILES.contains(basename(file))) {
+ return false;
+ }
+ return !splitPath(file).some(_BLACKLISTED_DIRECTORIES.contains);
}));
}
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698