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

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

Issue 12079112: Make a bunch of stuff in pub synchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/command_uploader.dart » ('j') | utils/pub/entrypoint.dart » ('J')
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /// The basenames of directories that are automatically excluded from 109 /// The basenames of directories that are automatically excluded from
110 /// archives. 110 /// archives.
111 final _BLACKLISTED_DIRECTORIES = const ['packages']; 111 final _BLACKLISTED_DIRECTORIES = const ['packages'];
112 112
113 /// Returns a list of files that should be included in the published package. 113 /// Returns a list of files that should be included in the published package.
114 /// If this is a Git repository, this will respect .gitignore; otherwise, it 114 /// If this is a Git repository, this will respect .gitignore; otherwise, it
115 /// will return all non-hidden files. 115 /// will return all non-hidden files.
116 Future<List<String>> get _filesToPublish { 116 Future<List<String>> get _filesToPublish {
117 var rootDir = entrypoint.root.dir; 117 var rootDir = entrypoint.root.dir;
118 118
119 return Future.wait([ 119 return git.isInstalled.then((results) {
nweiz 2013/02/01 02:05:55 "results" -> "gitInstalled" It's worrisome that t
Bob Nystrom 2013/02/01 23:17:21 It did. :( pub_lish_test is flaky so you don't see
120 dirExists(join(rootDir, '.git')), 120 if (dirExists(join(rootDir, '.git')) && gitInstalled) {
121 git.isInstalled
122 ]).then((results) {
123 if (results[0] && results[1]) {
124 // List all files that aren't gitignored, including those not checked 121 // List all files that aren't gitignored, including those not checked
125 // in to Git. 122 // in to Git.
126 return git.run(["ls-files", "--cached", "--others", 123 return git.run(["ls-files", "--cached", "--others",
127 "--exclude-standard"]); 124 "--exclude-standard"]);
128 } 125 }
129 126
130 return listDir(rootDir, recursive: true).then((entries) { 127 return listDir(rootDir, recursive: true).then((entries) {
131 return Future.wait(entries.map((entry) { 128 return Future.wait(entries.map((entry) {
132 return fileExists(entry).then((isFile) {
133 // Skip directories. 129 // Skip directories.
134 if (!isFile) return null; 130 if (!fileExists(entry)) return null;
135 131
136 // TODO(rnystrom): Making these relative will break archive 132 // TODO(rnystrom): Making these relative will break archive
137 // creation if the cwd is ever *not* the package root directory. 133 // creation if the cwd is ever *not* the package root directory.
138 // Should instead only make these relative right before generating 134 // Should instead only make these relative right before generating
139 // the tree display (which is what really needs them to be). 135 // the tree display (which is what really needs them to be).
140 // Make it relative to the package root. 136 // Make it relative to the package root.
141 return relativeTo(entry, rootDir); 137 return relativeTo(entry, rootDir);
142 });
143 })); 138 }));
144 }); 139 });
145 }).then((files) => files.where((file) { 140 }).then((files) => files.where((file) {
146 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) { 141 if (file == null || _BLACKLISTED_FILES.contains(basename(file))) {
147 return false; 142 return false;
148 } 143 }
149 144
150 return !splitPath(file).any(_BLACKLISTED_DIRECTORIES.contains); 145 return !splitPath(file).any(_BLACKLISTED_DIRECTORIES.contains);
151 }).toList()); 146 }).toList());
152 } 147 }
(...skipping 24 matching lines...) Expand all
177 var s = warnings.length == 1 ? '' : 's'; 172 var s = warnings.length == 1 ? '' : 's';
178 message = "Package has ${warnings.length} warning$s. Upload anyway"; 173 message = "Package has ${warnings.length} warning$s. Upload anyway";
179 } 174 }
180 175
181 return confirm(message).then((confirmed) { 176 return confirm(message).then((confirmed) {
182 if (!confirmed) throw "Package upload canceled."; 177 if (!confirmed) throw "Package upload canceled.";
183 }); 178 });
184 }); 179 });
185 } 180 }
186 } 181 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/command_uploader.dart » ('j') | utils/pub/entrypoint.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698