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

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

Issue 11276042: Explicitly configure git committer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | « utils/pub/io.dart ('k') | no next file » | 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 /** 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 var workingDir; 1043 var workingDir;
1044 1044
1045 Future runGitStep(_) { 1045 Future runGitStep(_) {
1046 if (commands.isEmpty) return new Future.immediate(workingDir); 1046 if (commands.isEmpty) return new Future.immediate(workingDir);
1047 var command = commands.removeAt(0); 1047 var command = commands.removeAt(0);
1048 return _runGit(command, workingDir).chain(runGitStep); 1048 return _runGit(command, workingDir).chain(runGitStep);
1049 } 1049 }
1050 1050
1051 return super.create(parentDir).chain((rootDir) { 1051 return super.create(parentDir).chain((rootDir) {
1052 workingDir = rootDir; 1052 workingDir = rootDir;
1053 return writeTextFile(join(parentDir, '.gitconfig'), ''' 1053 return runGitStep(null);
1054 [user] 1054 });
1055 name = Test Pub
1056 email = pub@dartlang.org
1057 ''');
1058 }).chain(runGitStep);
1059 } 1055 }
1060 1056
1061 Future<String> _runGit(List<String> args, Directory workingDir) { 1057 Future<String> _runGit(List<String> args, Directory workingDir) {
1062 return runGit(args, workingDir: workingDir.path).transform((result) { 1058 // Explicitly specify the committer information. Git needs this to commit
1059 // and we don't want to rely on the buildbots having this already set up.
1060 var environment = new Map.from(Platform.environment);
nweiz 2012/10/26 18:34:06 Should the environment argument be automatically m
Bob Nystrom 2012/10/30 22:09:26 Done.
1061 environment['GIT_COMMITTER_NAME'] = 'Pub Test';
1062 environment['GIT_COMMITTER_EMAIL'] = 'pub@dartlang.org';
1063
1064 return runGit(args, workingDir: workingDir.path,
1065 environment: environment).transform((result) {
1063 if (!result.success) { 1066 if (!result.success) {
1064 throw "Error running: git ${Strings.join(args, ' ')}\n" 1067 throw "Error running: git ${Strings.join(args, ' ')}\n"
1065 "${Strings.join(result.stderr, '\n')}"; 1068 "${Strings.join(result.stderr, '\n')}";
1066 } 1069 }
1067 1070
1068 return result.stdout; 1071 return result.stdout;
1069 }); 1072 });
1070 } 1073 }
1071 } 1074 }
1072 1075
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 } 1218 }
1216 1219
1217 /** 1220 /**
1218 * Schedules a callback to be called after Pub is run with [runPub], even if it 1221 * Schedules a callback to be called after Pub is run with [runPub], even if it
1219 * fails. 1222 * fails.
1220 */ 1223 */
1221 void _scheduleCleanup(_ScheduledEvent event) { 1224 void _scheduleCleanup(_ScheduledEvent event) {
1222 if (_scheduledCleanup == null) _scheduledCleanup = []; 1225 if (_scheduledCleanup == null) _scheduledCleanup = [];
1223 _scheduledCleanup.add(event); 1226 _scheduledCleanup.add(event);
1224 } 1227 }
OLDNEW
« no previous file with comments | « utils/pub/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698