-
Notifications
You must be signed in to change notification settings - Fork 231
Add support for global activating package from a custom pub URL #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for global activating package from a custom pub URL #2041
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good if you ask me :)
I haven't tried to run the tests though.
lib/src/command/global_activate.dart
Outdated
@@ -38,6 +38,11 @@ class GlobalActivateCommand extends PubCommand { | |||
argParser.addFlag("overwrite", | |||
negatable: false, | |||
help: "Overwrite executables from other packages with the same name."); | |||
|
|||
argParser.addOption("source-url", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--server-url
or --hosted-url
might be better, the key for this in the pubspec is dependencies.<packageName>.hosted.url
Or maybe --hosted-source-url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on --hosted-url
lib/src/command/global_activate.dart
Outdated
@@ -38,6 +38,11 @@ class GlobalActivateCommand extends PubCommand { | |||
argParser.addFlag("overwrite", | |||
negatable: false, | |||
help: "Overwrite executables from other packages with the same name."); | |||
|
|||
argParser.addOption("source-url", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on --hosted-url
@natebosch @jonasfj Updated the command line option to |
Proposed solution for #2039, looking for feedback on whether or not this would be an acceptable addition.
The solution ended up being very straightforward since pub already knows how to handle dependencies from custom hosted pub servers and activating a package globally is essentially just performing a
pub get
in a dummy package with a single dependency. All that was needed was a command-line flag to specify the custom pub URL that is then passed through to the.refFor()
call used to build the dependency ref.I went with
--source-url
for the CLI option mainly in an attempt to note its relation to--source
while keeping it brief, but there may be a better name.Additionally, since this flag is only applicable when activating from a hosted source, it might be worth failing if it is used with a non-hosted source.