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 /** | 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 /// Schedule a Git command to run in this repository. | 977 /// Schedule a Git command to run in this repository. |
978 void scheduleGit(List<String> args) { | 978 void scheduleGit(List<String> args) { |
979 _schedule((parentDir) { | 979 _schedule((parentDir) { |
980 var gitDir = new Directory(join(parentDir, name)); | 980 var gitDir = new Directory(join(parentDir, name)); |
981 return _runGit(args, gitDir); | 981 return _runGit(args, gitDir); |
982 }); | 982 }); |
983 } | 983 } |
984 | 984 |
985 Future<String> _runGit(List<String> args, Directory workingDir) { | 985 Future<String> _runGit(List<String> args, Directory workingDir) { |
986 return runProcess('git', args, workingDir: workingDir.path). | 986 return runGit(args, workingDir: workingDir.path).transform((result) { |
987 transform((result) { | 987 if (!result.success) throw "Error running git: ${result.stderr}"; |
988 if (!result.success) throw "Error running git: ${result.stderr}"; | 988 return result.stdout; |
989 return result.stdout; | 989 }); |
990 }); | |
991 } | 990 } |
992 } | 991 } |
993 | 992 |
994 /** | 993 /** |
995 * Describes a gzipped tar file and its contents. | 994 * Describes a gzipped tar file and its contents. |
996 */ | 995 */ |
997 class TarFileDescriptor extends Descriptor { | 996 class TarFileDescriptor extends Descriptor { |
998 final List<Descriptor> contents; | 997 final List<Descriptor> contents; |
999 | 998 |
1000 TarFileDescriptor(Pattern name, this.contents) | 999 TarFileDescriptor(Pattern name, this.contents) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 } | 1114 } |
1116 | 1115 |
1117 /** | 1116 /** |
1118 * Schedules a callback to be called after Pub is run with [runPub], even if it | 1117 * Schedules a callback to be called after Pub is run with [runPub], even if it |
1119 * fails. | 1118 * fails. |
1120 */ | 1119 */ |
1121 void _scheduleCleanup(_ScheduledEvent event) { | 1120 void _scheduleCleanup(_ScheduledEvent event) { |
1122 if (_scheduledCleanup == null) _scheduledCleanup = []; | 1121 if (_scheduledCleanup == null) _scheduledCleanup = []; |
1123 _scheduledCleanup.add(event); | 1122 _scheduledCleanup.add(event); |
1124 } | 1123 } |
OLD | NEW |