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

Unified Diff: utils/pub/pub.dart

Issue 10689169: Use environment variables to find the Dart SDK and the Pub cache directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/sdk_source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/pub.dart
diff --git a/utils/pub/pub.dart b/utils/pub/pub.dart
index 4b9c74cfe2b5325c89897cd84c4c2f1e043c6d45..5477957a274ae32171a0d4d40a2412c3aeb2f2d2 100644
--- a/utils/pub/pub.dart
+++ b/utils/pub/pub.dart
@@ -8,6 +8,7 @@
#library('pub');
#import('../../lib/args/args.dart');
+#import('dart:io');
#import('io.dart');
#import('command_install.dart');
#import('command_list.dart');
@@ -43,11 +44,6 @@ main() {
help: 'Prints this usage information');
parser.addFlag('version', negatable: false,
help: 'Prints the version of Pub');
- // TODO(rnystrom): Hack. These are temporary options to allow the pub tests to
- // pass in relevant paths. Eventually these should be environment variables.
- parser.addOption('cachedir', help: 'The directory containing the system-wide '
- 'Pub cache');
- parser.addOption('sdkdir', help: 'The directory containing the Dart SDK');
parser.addFlag('trace', help: 'Prints a stack trace when an error occurs');
var globalOptions;
@@ -68,8 +64,19 @@ main() {
return;
}
- var cache = new SystemCache(globalOptions['cachedir']);
- cache.register(new SdkSource(globalOptions['sdkdir']));
+ // TODO(nweiz): Have a fallback for this this out automatically once 1145 is
+ // fixed.
+ var sdkDir = Platform.environment['DART_SDK'];
+ var cacheDir;
+ if (Platform.environment.containsKey('PUB_CACHE')) {
+ cacheDir = Platform.environment['PUB_CACHE'];
+ } else {
+ // TODO(nweiz): Choose a better default for Windows.
+ cacheDir = '${Platform.environment['HOME']}/.pub-cache';
+ }
+
+ var cache = new SystemCache(cacheDir);
+ cache.register(new SdkSource(sdkDir));
cache.register(new GitSource());
cache.register(new RepoSource());
// TODO(nweiz): Make 'repo' the default once pub.dartlang.org exists
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/sdk_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698