| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:json'; | 9 import 'dart:json'; |
| 10 import 'dart:uri'; | 10 import 'dart:uri'; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 var rootDir = entrypoint.root.dir; | 139 var rootDir = entrypoint.root.dir; |
| 140 | 140 |
| 141 return git.isInstalled.then((gitInstalled) { | 141 return git.isInstalled.then((gitInstalled) { |
| 142 if (dirExists(path.join(rootDir, '.git')) && gitInstalled) { | 142 if (dirExists(path.join(rootDir, '.git')) && gitInstalled) { |
| 143 // List all files that aren't gitignored, including those not checked | 143 // List all files that aren't gitignored, including those not checked |
| 144 // in to Git. | 144 // in to Git. |
| 145 return git.run(["ls-files", "--cached", "--others", | 145 return git.run(["ls-files", "--cached", "--others", |
| 146 "--exclude-standard"]); | 146 "--exclude-standard"]); |
| 147 } | 147 } |
| 148 | 148 |
| 149 return listDir(rootDir, recursive: true).then((entries) { | 149 return listDir(rootDir, recursive: true) |
| 150 return entries | 150 .where(fileExists) // Skip directories and broken symlinks. |
| 151 .where(fileExists) // Skip directories and broken symlinks. | 151 .map((entry) => path.relative(entry, from: rootDir)); |
| 152 .map((entry) => path.relative(entry, from: rootDir)); | |
| 153 }); | |
| 154 }).then((files) => files.where(_shouldPublish).toList()); | 152 }).then((files) => files.where(_shouldPublish).toList()); |
| 155 } | 153 } |
| 156 | 154 |
| 157 /// Returns `true` if [file] should be published. | 155 /// Returns `true` if [file] should be published. |
| 158 bool _shouldPublish(String file) { | 156 bool _shouldPublish(String file) { |
| 159 if (_BLACKLISTED_FILES.contains(path.basename(file))) return false; | 157 if (_BLACKLISTED_FILES.contains(path.basename(file))) return false; |
| 160 return !path.split(file).any(_BLACKLISTED_DIRS.contains); | 158 return !path.split(file).any(_BLACKLISTED_DIRS.contains); |
| 161 } | 159 } |
| 162 | 160 |
| 163 /// Returns the value associated with [key] in [map]. Throws a user-friendly | 161 /// Returns the value associated with [key] in [map]. Throws a user-friendly |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 return confirm(message).then((confirmed) { | 198 return confirm(message).then((confirmed) { |
| 201 if (!confirmed) { | 199 if (!confirmed) { |
| 202 log.error("Package upload canceled."); | 200 log.error("Package upload canceled."); |
| 203 return false; | 201 return false; |
| 204 } | 202 } |
| 205 return true; | 203 return true; |
| 206 }); | 204 }); |
| 207 }); | 205 }); |
| 208 } | 206 } |
| 209 } | 207 } |
| OLD | NEW |