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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 | 135 |
136 return listDir(rootDir, recursive: true).chain((entries) { | 136 return listDir(rootDir, recursive: true).chain((entries) { |
137 return Futures.wait(entries.map((entry) { | 137 return Futures.wait(entries.map((entry) { |
138 return fileExists(entry).transform((isFile) => isFile ? entry : null); | 138 return fileExists(entry).transform((isFile) => isFile ? entry : null); |
139 })); | 139 })); |
140 }); | 140 }); |
141 }).transform((files) => files.filter((file) { | 141 }).transform((files) => files.filter((file) { |
142 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) { | 142 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) { |
143 return false; | 143 return false; |
144 } | 144 } |
145 // TODO(nweiz): Since `file` is absolute, this will break if the package | |
146 // itself is in a directory named "packages". | |
Bob Nystrom
2012/12/07 21:28:39
File a bug for this?
nweiz
2012/12/07 21:33:31
Done.
| |
145 return !splitPath(file).some(_BLACKLISTED_DIRECTORIES.contains); | 147 return !splitPath(file).some(_BLACKLISTED_DIRECTORIES.contains); |
146 })); | 148 })); |
147 } | 149 } |
148 | 150 |
149 /// Parses a response body, assuming it's JSON-formatted. Throws a | 151 /// Parses a response body, assuming it's JSON-formatted. Throws a |
150 /// user-friendly error if the response body is invalid JSON, or if it's not a | 152 /// user-friendly error if the response body is invalid JSON, or if it's not a |
151 /// map. | 153 /// map. |
152 Map _parseJson(http.Response response) { | 154 Map _parseJson(http.Response response) { |
153 var value; | 155 var value; |
154 try { | 156 try { |
(...skipping 30 matching lines...) Expand all Loading... | |
185 var s = warnings.length == 1 ? '' : 's'; | 187 var s = warnings.length == 1 ? '' : 's'; |
186 stdout.writeString("Package has ${warnings.length} warning$s. Upload " | 188 stdout.writeString("Package has ${warnings.length} warning$s. Upload " |
187 "anyway (y/n)? "); | 189 "anyway (y/n)? "); |
188 return readLine().transform((line) { | 190 return readLine().transform((line) { |
189 if (new RegExp(r"^[yY]").hasMatch(line)) return; | 191 if (new RegExp(r"^[yY]").hasMatch(line)) return; |
190 throw "Package upload canceled."; | 192 throw "Package upload canceled."; |
191 }); | 193 }); |
192 }); | 194 }); |
193 } | 195 } |
194 } | 196 } |
OLD | NEW |