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