Chromium Code Reviews| 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 command_lish; | 5 library command_lish; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:json'; | 8 import 'dart:json'; |
| 9 import 'dart:uri'; | 9 import 'dart:uri'; |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 return Futures.wait(entries.map((entry) { | 157 return Futures.wait(entries.map((entry) { |
| 158 return fileExists(entry).transform((isFile) { | 158 return fileExists(entry).transform((isFile) { |
| 159 // Skip directories. | 159 // Skip directories. |
| 160 if (!isFile) return null; | 160 if (!isFile) return null; |
| 161 | 161 |
| 162 // TODO(rnystrom): Making these relative will break archive | 162 // TODO(rnystrom): Making these relative will break archive |
| 163 // creation if the cwd is ever *not* the package root directory. | 163 // creation if the cwd is ever *not* the package root directory. |
| 164 // Should instead only make these relative right before generating | 164 // Should instead only make these relative right before generating |
| 165 // the tree display (which is what really needs them to be). | 165 // the tree display (which is what really needs them to be). |
| 166 // Make it relative to the package root. | 166 // Make it relative to the package root. |
| 167 return relativeTo(entry, rootDir); | 167 entry = relativeTo(entry, rootDir); |
| 168 | |
| 169 // TODO(rnystrom): dir.list() will paths with resolved symlinks. | |
|
Jennifer Messerly
2012/12/12 23:49:25
"will include paths" ?
Siggi Cherem (dart-lang)
2012/12/12 23:53:56
woah - I wrote something about this and when I hit
| |
| 170 // In particular, we'll get paths to symlinked files from "packages" | |
| 171 // that reach outside of this package. Since the path has already | |
| 172 // been resolved, we don't even see "packages" in that path anymore. | |
| 173 // These should not be included in the archive. As a hack, ignore | |
| 174 // any file whose relative path is backing out of the root | |
| 175 // directory. Should do something cleaner. | |
| 176 if (entry.length > 1 && entry.startsWith('..')) return null; | |
|
Jennifer Messerly
2012/12/12 23:49:25
entry.startsWith('..') implies entry.length > 1 ri
| |
| 177 | |
| 178 return entry; | |
| 168 }); | 179 }); |
| 169 })); | 180 })); |
| 170 }); | 181 }); |
| 171 }).transform((files) => files.filter((file) { | 182 }).transform((files) => files.filter((file) { |
| 172 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) { | 183 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) { |
| 173 return false; | 184 return false; |
| 174 } | 185 } |
| 175 | 186 |
| 176 return !splitPath(file).some(_BLACKLISTED_DIRECTORIES.contains); | 187 return !splitPath(file).some(_BLACKLISTED_DIRECTORIES.contains); |
| 177 })); | 188 })); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 var s = warnings.length == 1 ? '' : 's'; | 234 var s = warnings.length == 1 ? '' : 's'; |
| 224 message = "Package has ${warnings.length} warning$s. Upload anyway"; | 235 message = "Package has ${warnings.length} warning$s. Upload anyway"; |
| 225 } | 236 } |
| 226 | 237 |
| 227 return confirm(message).transform((confirmed) { | 238 return confirm(message).transform((confirmed) { |
| 228 if (!confirmed) throw "Package upload canceled."; | 239 if (!confirmed) throw "Package upload canceled."; |
| 229 }); | 240 }); |
| 230 }); | 241 }); |
| 231 } | 242 } |
| 232 } | 243 } |
| OLD | NEW |