| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is | 76 // TODO(nweiz): Have a fallback for this this out automatically once 1145 is |
| 77 // fixed. | 77 // fixed. |
| 78 var sdkDir = Platform.environment['DART_SDK']; | 78 var sdkDir = Platform.environment['DART_SDK']; |
| 79 var cacheDir; | 79 var cacheDir; |
| 80 if (Platform.environment.containsKey('PUB_CACHE')) { | 80 if (Platform.environment.containsKey('PUB_CACHE')) { |
| 81 cacheDir = Platform.environment['PUB_CACHE']; | 81 cacheDir = Platform.environment['PUB_CACHE']; |
| 82 } else if (Platform.operatingSystem == 'windows') { | 82 } else if (Platform.operatingSystem == 'windows') { |
| 83 var appData = Platform.environment['APPDATA']; | 83 var appData = Platform.environment['APPDATA']; |
| 84 cacheDir = join(appData, 'Pub', 'Package Cache'); | 84 cacheDir = join(appData, 'Pub', 'Cache'); |
| 85 } else { | 85 } else { |
| 86 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; | 86 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; |
| 87 } | 87 } |
| 88 | 88 |
| 89 var cache = new SystemCache(cacheDir); | 89 var cache = new SystemCache(cacheDir); |
| 90 cache.register(new SdkSource(sdkDir)); | 90 cache.register(new SdkSource(sdkDir)); |
| 91 cache.register(new GitSource()); | 91 cache.register(new GitSource()); |
| 92 cache.register(new HostedSource()); | 92 cache.register(new HostedSource()); |
| 93 cache.sources.setDefault('hosted'); | 93 cache.sources.setDefault('hosted'); |
| 94 | 94 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (exception is HttpException || exception is HttpParserException || | 264 if (exception is HttpException || exception is HttpParserException || |
| 265 exception is SocketIOException || exception is PubHttpException) { | 265 exception is SocketIOException || exception is PubHttpException) { |
| 266 return exit_codes.UNAVAILABLE; | 266 return exit_codes.UNAVAILABLE; |
| 267 } else if (exception is FormatException) { | 267 } else if (exception is FormatException) { |
| 268 return exit_codes.DATA; | 268 return exit_codes.DATA; |
| 269 } else { | 269 } else { |
| 270 return 1; | 270 return 1; |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 } | 273 } |
| OLD | NEW |