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/args.dart'); | 10 #import('../../pkg/args/args.dart'); |
11 #import('dart:io'); | 11 #import('dart:io'); |
12 #import('dart:math'); | 12 #import('dart:math'); |
13 #import('io.dart'); | 13 #import('io.dart'); |
14 #import('command_help.dart'); | 14 #import('command_help.dart'); |
15 #import('command_install.dart'); | 15 #import('command_install.dart'); |
16 #import('command_list.dart'); | 16 #import('command_list.dart'); |
17 #import('command_update.dart'); | 17 #import('command_update.dart'); |
18 #import('command_version.dart'); | 18 #import('command_version.dart'); |
19 #import('entrypoint.dart'); | 19 #import('entrypoint.dart'); |
20 #import('git_source.dart'); | 20 #import('git_source.dart'); |
| 21 #import('hosted_source.dart'); |
21 #import('package.dart'); | 22 #import('package.dart'); |
22 #import('pubspec.dart'); | 23 #import('pubspec.dart'); |
23 #import('repo_source.dart'); | |
24 #import('sdk_source.dart'); | 24 #import('sdk_source.dart'); |
25 #import('source.dart'); | 25 #import('source.dart'); |
26 #import('source_registry.dart'); | 26 #import('source_registry.dart'); |
27 #import('system_cache.dart'); | 27 #import('system_cache.dart'); |
28 #import('utils.dart'); | 28 #import('utils.dart'); |
29 #import('version.dart'); | 29 #import('version.dart'); |
30 | 30 |
31 Version get pubVersion => new Version(0, 0, 0); | 31 Version get pubVersion => new Version(0, 0, 0); |
32 | 32 |
33 /** | 33 /** |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 { | 83 } else { |
84 // TODO(nweiz): Choose a better default for Windows. | 84 // TODO(nweiz): Choose a better default for Windows. |
85 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; | 85 cacheDir = '${Platform.environment['HOME']}/.pub-cache'; |
86 } | 86 } |
87 | 87 |
88 var cache = new SystemCache(cacheDir); | 88 var cache = new SystemCache(cacheDir); |
89 cache.register(new SdkSource(sdkDir)); | 89 cache.register(new SdkSource(sdkDir)); |
90 cache.register(new GitSource()); | 90 cache.register(new GitSource()); |
91 cache.register(new RepoSource()); | 91 cache.register(new HostedSource()); |
92 // TODO(nweiz): Make 'repo' the default once pub.dartlang.org exists | 92 cache.sources.setDefault('hosted'); |
93 cache.sources.setDefault('sdk'); | |
94 | 93 |
95 // Select the command. | 94 // Select the command. |
96 var command = pubCommands[globalOptions.rest[0]]; | 95 var command = pubCommands[globalOptions.rest[0]]; |
97 if (command == null) { | 96 if (command == null) { |
98 printError('Unknown command "${globalOptions.rest[0]}".'); | 97 printError('Unknown command "${globalOptions.rest[0]}".'); |
99 printError('Run "pub help" to see available commands.'); | 98 printError('Run "pub help" to see available commands.'); |
100 exit(64); // See http://www.freebsd.org/cgi/man.cgi?query=sysexits. | 99 exit(64); // See http://www.freebsd.org/cgi/man.cgi?query=sysexits. |
101 return; | 100 return; |
102 } | 101 } |
103 | 102 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 print(''); | 227 print(''); |
229 print('Usage: $usage'); | 228 print('Usage: $usage'); |
230 | 229 |
231 var commandUsage = commandParser.getUsage(); | 230 var commandUsage = commandParser.getUsage(); |
232 if (!commandUsage.isEmpty()) { | 231 if (!commandUsage.isEmpty()) { |
233 print(''); | 232 print(''); |
234 print(commandUsage); | 233 print(commandUsage); |
235 } | 234 } |
236 } | 235 } |
237 } | 236 } |
OLD | NEW |