Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: utils/pub/command_lish.dart

Issue 12255016: Get rid of old redundant methods in io.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise and update to latest. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/pub/entrypoint.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
139 if (dirExists(join(rootDir, '.git')) && gitInstalled) { 139 if (dirExists(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) => relativeTo(entry, rootDir)); 149 .map((entry) => path.relative(entry, from: rootDir));
150 }); 150 });
151 }).then((files) => files.where(_shouldPublish).toList()); 151 }).then((files) => files.where(_shouldPublish).toList());
152 } 152 }
153 153
154 /// Returns `true` if [file] should be published. 154 /// Returns `true` if [file] should be published.
155 bool _shouldPublish(String file) { 155 bool _shouldPublish(String file) {
156 if (_BLACKLISTED_FILES.contains(basename(file))) return false; 156 if (_BLACKLISTED_FILES.contains(path.basename(file))) return false;
157 return !splitPath(file).any(_BLACKLISTED_DIRS.contains); 157 return !path.split(file).any(_BLACKLISTED_DIRS.contains);
158 } 158 }
159 159
160 /// Returns the value associated with [key] in [map]. Throws a user-friendly 160 /// Returns the value associated with [key] in [map]. Throws a user-friendly
161 /// error if [map] doens't contain [key]. 161 /// error if [map] doens't contain [key].
162 _expectField(Map map, String key, http.Response response) { 162 _expectField(Map map, String key, http.Response response) {
163 if (map.containsKey(key)) return map[key]; 163 if (map.containsKey(key)) return map[key];
164 invalidServerResponse(response); 164 invalidServerResponse(response);
165 } 165 }
166 166
167 /// Validates the package. Completes to false if the upload should not 167 /// Validates the package. Completes to false if the upload should not
(...skipping 29 matching lines...) Expand all
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 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/entrypoint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698