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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 11557008: Make pub publish more user friendly: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Blacklist '.DS_Store' files from publish. Created 8 years 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
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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return server.url.chain((url) { 622 return server.url.chain((url) {
623 var tokenEndpoint = url.resolve('/token'); 623 var tokenEndpoint = url.resolve('/token');
624 if (args == null) args = []; 624 if (args == null) args = [];
625 args = flatten(['lish', '--server', url.toString(), args]); 625 args = flatten(['lish', '--server', url.toString(), args]);
626 return _doPub(startProcess, sandboxDir, args, tokenEndpoint); 626 return _doPub(startProcess, sandboxDir, args, tokenEndpoint);
627 }); 627 });
628 }); 628 });
629 return new ScheduledProcess("pub lish", process); 629 return new ScheduledProcess("pub lish", process);
630 } 630 }
631 631
632 /// Handles the beginning confirmation process for uploading a packages.
633 /// Ensures that the right output is shown and then enters "y" to confirm the
634 /// upload.
635 void confirmPublish(ScheduledProcess pub) {
nweiz 2012/12/12 21:21:21 I don't like that this only works with a specific
Bob Nystrom 2012/12/12 21:45:36 Agreed completely. Added a TODO.
636 expectLater(pub.nextLine(), equals('Publishing "test_pkg" 1.0.0:'));
637 expectLater(pub.nextLine(), equals("|-- LICENSE"));
638 expectLater(pub.nextLine(), equals("|-- lib"));
639 expectLater(pub.nextLine(), equals("| '-- test_pkg.dart"));
640 expectLater(pub.nextLine(), equals("'-- pubspec.yaml"));
641 expectLater(pub.nextLine(), equals(""));
642
643 pub.writeLine("y");
644 }
645
646
632 /// Calls [fn] with appropriately modified arguments to run a pub process. [fn] 647 /// Calls [fn] with appropriately modified arguments to run a pub process. [fn]
633 /// should have the same signature as [startProcess], except that the returned 648 /// should have the same signature as [startProcess], except that the returned
634 /// [Future] may have a type other than [Process]. 649 /// [Future] may have a type other than [Process].
635 Future _doPub(Function fn, sandboxDir, List<String> args, Uri tokenEndpoint) { 650 Future _doPub(Function fn, sandboxDir, List<String> args, Uri tokenEndpoint) {
636 String pathInSandbox(path) => join(getFullPath(sandboxDir), path); 651 String pathInSandbox(path) => join(getFullPath(sandboxDir), path);
637 652
638 return ensureDir(pathInSandbox(appPath)).chain((_) { 653 return ensureDir(pathInSandbox(appPath)).chain((_) {
639 // Find a Dart executable we can use to spawn. Use the same one that was 654 // Find a Dart executable we can use to spawn. Use the same one that was
640 // used to run this script itself. 655 // used to run this script itself.
641 var dartBin = new Options().executable; 656 var dartBin = new Options().executable;
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 /// calling [completion] is unnecessary. 1656 /// calling [completion] is unnecessary.
1642 void expectLater(Future actual, matcher, {String reason, 1657 void expectLater(Future actual, matcher, {String reason,
1643 FailureHandler failureHandler, bool verbose: false}) { 1658 FailureHandler failureHandler, bool verbose: false}) {
1644 _schedule((_) { 1659 _schedule((_) {
1645 return actual.transform((value) { 1660 return actual.transform((value) {
1646 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1661 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1647 verbose: false); 1662 verbose: false);
1648 }); 1663 });
1649 }); 1664 });
1650 } 1665 }
OLDNEW
« utils/pub/validator/license.dart ('K') | « utils/tests/pub/pub_lish_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698