| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
| 6 library pub.io; | 6 library pub.io; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 /// | 481 /// |
| 482 /// This works because an actual pub executable that imports this will always | 482 /// This works because an actual pub executable that imports this will always |
| 483 /// start with "pub". | 483 /// start with "pub". |
| 484 final bool runningAsTest = | 484 final bool runningAsTest = |
| 485 !path.url.basename(Platform.script.path).startsWith('pub.'); | 485 !path.url.basename(Platform.script.path).startsWith('pub.'); |
| 486 | 486 |
| 487 // TODO(nweiz): Use the test API when test#48 is fixed. | 487 // TODO(nweiz): Use the test API when test#48 is fixed. |
| 488 /// Whether the current process is one of pub's test files being run through the | 488 /// Whether the current process is one of pub's test files being run through the |
| 489 /// test package's test runner. | 489 /// test package's test runner. |
| 490 /// | 490 /// |
| 491 /// The test runner starts all tests from an entrypoint called | 491 /// The test runner starts all tests from a `data:` URI. |
| 492 /// "runInIsolate.dart'> | 492 final bool runningAsTestRunner = Platform.script.scheme == 'data'; |
| 493 final bool runningAsTestRunner = | |
| 494 path.url.basename(Platform.script.path).startsWith('runInIsolate.dart'); | |
| 495 | 493 |
| 496 /// Whether the current process is a pub subprocess being run from a test. | 494 /// Whether the current process is a pub subprocess being run from a test. |
| 497 /// | 495 /// |
| 498 /// The "_PUB_TESTING" variable is automatically set for all the test code's | 496 /// The "_PUB_TESTING" variable is automatically set for all the test code's |
| 499 /// invocations of pub. | 497 /// invocations of pub. |
| 500 final bool runningFromTest = Platform.environment.containsKey('_PUB_TESTING'); | 498 final bool runningFromTest = Platform.environment.containsKey('_PUB_TESTING'); |
| 501 | 499 |
| 502 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart | 500 /// Whether pub is running from within the Dart SDK, as opposed to from the Dart |
| 503 /// source repository. | 501 /// source repository. |
| 504 final bool runningFromSdk = | 502 final bool runningFromSdk = |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1061 |
| 1064 // TODO(rnystrom): Remove this and change to returning one string. | 1062 // TODO(rnystrom): Remove this and change to returning one string. |
| 1065 static List<String> _toLines(String output) { | 1063 static List<String> _toLines(String output) { |
| 1066 var lines = splitLines(output); | 1064 var lines = splitLines(output); |
| 1067 if (!lines.isEmpty && lines.last == "") lines.removeLast(); | 1065 if (!lines.isEmpty && lines.last == "") lines.removeLast(); |
| 1068 return lines; | 1066 return lines; |
| 1069 } | 1067 } |
| 1070 | 1068 |
| 1071 bool get success => exitCode == exit_codes.SUCCESS; | 1069 bool get success => exitCode == exit_codes.SUCCESS; |
| 1072 } | 1070 } |
| OLD | NEW |