Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions lib/pub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'src/entrypoint.dart';
import 'src/exceptions.dart';
import 'src/http.dart';
import 'src/pub_embeddable_command.dart';
import 'src/source/git.dart';
import 'src/system_cache.dart';

export 'src/executable.dart'
Expand Down Expand Up @@ -68,39 +67,3 @@ class ResolutionFailedException implements Exception {
String message;
ResolutionFailedException._(this.message);
}

/// Given a Git repo that contains a pub package, gets the name of the pub
/// package.
///
/// Will download the repo to the system cache under the assumption that the
/// package will be downloaded afterwards.
///
/// [url] points to the git repository. If it is a relative url, it is resolved
/// as a file url relative to the path [relativeTo].
///
/// [ref] is the commit, tag, or branch name where the package should be looked
/// up when fetching the name. If omitted, 'HEAD' is used.
///
/// [tagPattern] is a string containing `'{{version}}'` as a substring, the
/// latest tag matching the pattern will be used for fetching the name.
///
/// Only one of [ref] and [tagPattern] can be used.
///
/// If [isOffline], only the already cached versions of the repo is used.
Future<String> getPackageNameFromGitRepo(
String url, {
String? ref,
String? path,
String? tagPattern,
String? relativeTo,
bool isOffline = false,
}) async {
return await GitSource.instance.getPackageNameFromRepo(
url,
ref,
path,
SystemCache(isOffline: isOffline),
relativeTo: relativeTo,
tagPattern: tagPattern,
);
}
1 change: 1 addition & 0 deletions lib/src/command/add.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ For example (follow the same format including spaces):
defaultsTo: true,
help:
'Also update dependencies in `example/` after modifying pubspec.yaml in the root package (if it exists).',
hide: true,
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/command/downgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class DowngradeCommand extends PubCommand {
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);

argParser.addOption(
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/get.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class GetCommand extends PubCommand {
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);

argParser.addOption(
Expand Down
6 changes: 2 additions & 4 deletions lib/src/command/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class LoginCommand extends PubCommand {
try {
switch (json.decode(userInfoRequest.body)) {
case {'name': final String? name, 'email': final String email}:
return _UserInfo(name: name, email: email);
case {'email': final String email}:
return _UserInfo(name: null, email: email);
return _UserInfo(name, email);
default:
log.fine(
'Bad response from $userInfoEndpoint: ${userInfoRequest.body}',
Expand All @@ -86,7 +84,7 @@ class LoginCommand extends PubCommand {
class _UserInfo {
final String? name;
final String email;
_UserInfo({required this.name, required this.email});
_UserInfo(this.name, this.email);
@override
String toString() => ['<$email>', name ?? ''].join(' ');
}
1 change: 1 addition & 0 deletions lib/src/command/remove.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ To remove a dependency override of a package prefix the package name with
'example',
defaultsTo: true,
help: 'Also update dependencies in `example/` (if it exists).',
hide: true,
);

argParser.addOption(
Expand Down
1 change: 1 addition & 0 deletions lib/src/command/upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class UpgradeCommand extends PubCommand {
'example',
defaultsTo: true,
help: 'Also run in `example/` (if it exists).',
hide: true,
);

argParser.addOption(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/source/git.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class GitSource extends CachedSource {
String? ref,
String? path,
SystemCache cache, {
required String? relativeTo,
required String relativeTo,
required String? tagPattern,
}) async {
assert(
Expand Down
2 changes: 0 additions & 2 deletions test/testdata/goldens/help_test/pub add --help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Usage: pub add [options] [<section>:]<package>[:descriptor] [<section>:]<package
-n, --dry-run Report what dependencies would change but don't change any.
--[no-]precompile Build executables in immediate dependencies.
-C, --directory=<dir> Run this in the directory <dir>.
--[no-]example Also update dependencies in `example/` after modifying pubspec.yaml in the root package (if it exists).
(defaults to on)

Run "pub help" to see global options.
See https://dart.dev/tools/pub/cmd/pub-add for detailed documentation.
Expand Down
2 changes: 0 additions & 2 deletions test/testdata/goldens/help_test/pub downgrade --help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Usage: pub downgrade [dependencies...]
-h, --help Print this usage information.
--[no-]offline Use cached packages instead of accessing the network.
-n, --dry-run Report what dependencies would change but don't change any.
--[no-]example Also run in `example/` (if it exists).
(defaults to on)
-C, --directory=<dir> Run this in the directory <dir>.
--tighten Updates lower bounds in pubspec.yaml to match the resolved version.

Expand Down
2 changes: 0 additions & 2 deletions test/testdata/goldens/help_test/pub get --help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Usage: pub get
has changed.
Useful for CI or deploying to production.
--[no-]precompile Build executables in immediate dependencies.
--[no-]example Also run in `example/` (if it exists).
(defaults to on)
-C, --directory=<dir> Run this in the directory <dir>.

Run "pub help" to see global options.
Expand Down
2 changes: 0 additions & 2 deletions test/testdata/goldens/help_test/pub remove --help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Usage: pub remove <package1> [<package2>...]
--[no-]offline Use cached packages instead of accessing the network.
-n, --dry-run Report what dependencies would change but don't change any.
--[no-]precompile Precompile executables in immediate dependencies.
--[no-]example Also update dependencies in `example/` (if it exists).
(defaults to on)
-C, --directory=<dir> Run this in the directory <dir>.

Run "pub help" to see global options.
Expand Down
2 changes: 0 additions & 2 deletions test/testdata/goldens/help_test/pub upgrade --help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Usage: pub upgrade [dependencies...]
--tighten Updates lower bounds in pubspec.yaml to match the resolved version.
--unlock-transitive Also upgrades the transitive dependencies of the listed [dependencies]
--major-versions Upgrades packages to their latest resolvable versions, and updates pubspec.yaml.
--[no-]example Also run in `example/` (if it exists).
(defaults to on)
-C, --directory=<dir> Run this in the directory <dir>.

Run "pub help" to see global options.
Expand Down
Loading