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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 /// archives. | 129 /// archives. |
130 final _BLACKLISTED_DIRS = const ['packages']; | 130 final _BLACKLISTED_DIRS = const ['packages']; |
131 | 131 |
132 /// Returns a list of files that should be included in the published package. | 132 /// Returns a list of files that should be included in the published package. |
133 /// If this is a Git repository, this will respect .gitignore; otherwise, it | 133 /// If this is a Git repository, this will respect .gitignore; otherwise, it |
134 /// will return all non-hidden files. | 134 /// will return all non-hidden files. |
135 Future<List<String>> get _filesToPublish { | 135 Future<List<String>> get _filesToPublish { |
136 var rootDir = entrypoint.root.dir; | 136 var rootDir = entrypoint.root.dir; |
137 | 137 |
138 return git.isInstalled.then((gitInstalled) { | 138 return git.isInstalled.then((gitInstalled) { |
139 if (dirExists(join(rootDir, '.git')) && gitInstalled) { | 139 if (dirExists(path.join(rootDir, '.git')) && gitInstalled) { |
140 // List all files that aren't gitignored, including those not checked | 140 // List all files that aren't gitignored, including those not checked |
141 // in to Git. | 141 // in to Git. |
142 return git.run(["ls-files", "--cached", "--others", | 142 return git.run(["ls-files", "--cached", "--others", |
143 "--exclude-standard"]); | 143 "--exclude-standard"]); |
144 } | 144 } |
145 | 145 |
146 return listDir(rootDir, recursive: true).then((entries) { | 146 return listDir(rootDir, recursive: true).then((entries) { |
147 return entries | 147 return entries |
148 .where(fileExists) // Skip directories. | 148 .where(fileExists) // Skip directories. |
149 .map((entry) => path.relative(entry, from: rootDir)); | 149 .map((entry) => path.relative(entry, from: rootDir)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 return confirm(message).then((confirmed) { | 197 return confirm(message).then((confirmed) { |
198 if (!confirmed) { | 198 if (!confirmed) { |
199 log.error("Package upload canceled."); | 199 log.error("Package upload canceled."); |
200 return false; | 200 return false; |
201 } | 201 } |
202 return true; | 202 return true; |
203 }); | 203 }); |
204 }); | 204 }); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |