| 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 * The main entrypoint for the pub command line application. | 6 * The main entrypoint for the pub command line application. |
| 7 */ | 7 */ |
| 8 #library('pub'); | 8 #library('pub'); |
| 9 | 9 |
| 10 #import('../../pkg/args/lib/args.dart'); | 10 #import('../../pkg/args/lib/args.dart'); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 printUsage(); | 73 printUsage(); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is | 77 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is |
| 78 // fixed. | 78 // fixed. |
| 79 var sdkDir = Platform.environment['DART_SDK']; | 79 var sdkDir = Platform.environment['DART_SDK']; |
| 80 var cacheDir; | 80 var cacheDir; |
| 81 if (Platform.environment.containsKey('PUB_CACHE')) { | 81 if (Platform.environment.containsKey('PUB_CACHE')) { |
| 82 cacheDir = Platform.environment['PUB_CACHE']; | 82 cacheDir = Platform.environment['PUB_CACHE']; |
| 83 } else if (Platform.operatingSystem == 'windows') { |
| 84 var appData = Platform.environment['APPDATA']; |
| 85 cacheDir = join(appData, 'Pub', 'Package Cache'); |
| 83 } else { | 86 } else { |
| 84 // TODO(nweiz): Choose a better default for Windows. | |
| 85 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; | 87 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; |
| 86 } | 88 } |
| 87 | 89 |
| 88 var cache = new SystemCache(cacheDir); | 90 var cache = new SystemCache(cacheDir); |
| 89 cache.register(new SdkSource(sdkDir)); | 91 cache.register(new SdkSource(sdkDir)); |
| 90 cache.register(new GitSource()); | 92 cache.register(new GitSource()); |
| 91 cache.register(new HostedSource()); | 93 cache.register(new HostedSource()); |
| 92 cache.sources.setDefault('hosted'); | 94 cache.sources.setDefault('hosted'); |
| 93 | 95 |
| 94 // Select the command. | 96 // Select the command. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 print(''); | 254 print(''); |
| 253 print('Usage: $usage'); | 255 print('Usage: $usage'); |
| 254 | 256 |
| 255 var commandUsage = commandParser.getUsage(); | 257 var commandUsage = commandParser.getUsage(); |
| 256 if (!commandUsage.isEmpty()) { | 258 if (!commandUsage.isEmpty()) { |
| 257 print(''); | 259 print(''); |
| 258 print(commandUsage); | 260 print(commandUsage); |
| 259 } | 261 } |
| 260 } | 262 } |
| 261 } | 263 } |
| OLD | NEW |