| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return result; | 402 return result; |
| 403 }); | 403 }); |
| 404 } | 404 } |
| 405 | 405 |
| 406 /// Return the name for the package described by [description] and from | 406 /// Return the name for the package described by [description] and from |
| 407 /// [sourceName]. | 407 /// [sourceName]. |
| 408 String _packageName(String sourceName, description) { | 408 String _packageName(String sourceName, description) { |
| 409 switch (sourceName) { | 409 switch (sourceName) { |
| 410 case "git": | 410 case "git": |
| 411 var url = description is String ? description : description['url']; | 411 var url = description is String ? description : description['url']; |
| 412 return basename(url.replaceFirst(const RegExp(r"(\.git)?/?$"), "")); | 412 return basename(url.replaceFirst(new RegExp(r"(\.git)?/?$"), "")); |
| 413 case "hosted": | 413 case "hosted": |
| 414 if (description is String) return description; | 414 if (description is String) return description; |
| 415 return description['name']; | 415 return description['name']; |
| 416 case "sdk": | 416 case "sdk": |
| 417 return description; | 417 return description; |
| 418 default: | 418 default: |
| 419 return description; | 419 return description; |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 /** | 1226 /** |
| 1227 * Schedules a callback to be called after Pub is run with [runPub], even if it | 1227 * Schedules a callback to be called after Pub is run with [runPub], even if it |
| 1228 * fails. | 1228 * fails. |
| 1229 */ | 1229 */ |
| 1230 void _scheduleCleanup(_ScheduledEvent event) { | 1230 void _scheduleCleanup(_ScheduledEvent event) { |
| 1231 if (_scheduledCleanup == null) _scheduledCleanup = []; | 1231 if (_scheduledCleanup == null) _scheduledCleanup = []; |
| 1232 _scheduledCleanup.add(event); | 1232 _scheduledCleanup.add(event); |
| 1233 } | 1233 } |
| OLD | NEW |