Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Issue 331593012: Add a "global activate" command to pub. (Closed)

Created:
6 years, 6 months ago by Bob Nystrom
Modified:
6 years, 5 months ago
Reviewers:
nweiz
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add a "global activate" command to pub. BUG=https://code.google.com/p/dart/issues/detail?id=18538 R=nweiz@google.com Committed: https://code.google.com/p/dart/source/detail?r=37832

Patch Set 1 #

Total comments: 34

Patch Set 2 : Revise. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+437 lines, -105 lines) Patch
M sdk/lib/_internal/pub/lib/src/command.dart View 6 chunks +11 lines, -11 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/command/global.dart View 1 chunk +18 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/command/global_activate.dart View 1 1 chunk +47 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart View 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/entrypoint.dart View 4 chunks +6 lines, -26 lines 0 comments Download
A sdk/lib/_internal/pub/lib/src/global_packages.dart View 1 1 chunk +135 lines, -0 lines 1 comment Download
M sdk/lib/_internal/pub/lib/src/lock_file.dart View 1 chunk +10 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source.dart View 1 chunk +0 lines, -8 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/cached.dart View 1 chunk +0 lines, -4 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/path.dart View 1 chunk +0 lines, -3 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/source/unknown.dart View 1 chunk +0 lines, -3 lines 0 comments Download
M sdk/lib/_internal/pub/lib/src/utils.dart View 1 chunk +8 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/bad_version_test.dart View 1 chunk +4 lines, -8 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/cached_package_test.dart View 1 1 chunk +30 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/constraint_test.dart View 1 1 chunk +28 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/different_version_test.dart View 1 1 chunk +29 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/empty_constraint_test.dart View 2 chunks +8 lines, -14 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/installs_dependencies_test.dart View 1 chunk +24 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/missing_package_arg_test.dart View 1 chunk +5 lines, -9 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/same_version_test.dart View 1 chunk +28 lines, -0 lines 0 comments Download
A sdk/lib/_internal/pub/test/global/activate/uncached_package_test.dart View 1 1 chunk +32 lines, -0 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/unexpected_arguments_test.dart View 1 chunk +4 lines, -8 lines 0 comments Download
A + sdk/lib/_internal/pub/test/global/activate/unknown_package_test.dart View 1 chunk +5 lines, -4 lines 0 comments Download
M sdk/lib/_internal/pub/test/lock_file_test.dart View 1 chunk +1 line, -4 lines 0 comments Download
M sdk/lib/_internal/pub/test/pub_test.dart View 3 chunks +3 lines, -0 lines 0 comments Download
M sdk/lib/_internal/pub/test/pubspec_test.dart View 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Bob Nystrom
6 years, 6 months ago (2014-06-26 21:34:23 UTC) #1
nweiz
https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart File sdk/lib/_internal/pub/lib/src/command/global_activate.dart (right): https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart#newcode15 sdk/lib/_internal/pub/lib/src/command/global_activate.dart:15: String get description => "Make a package globally available."; ...
6 years, 6 months ago (2014-06-26 22:43:26 UTC) #2
Bob Nystrom
Thanks! https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart File sdk/lib/_internal/pub/lib/src/command/global_activate.dart (right): https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/command/global_activate.dart#newcode15 sdk/lib/_internal/pub/lib/src/command/global_activate.dart:15: String get description => "Make a package globally ...
6 years, 5 months ago (2014-06-27 00:30:23 UTC) #3
Sean Eagan
On 2014/06/26 21:34:23, Bob Nystrom wrote: It looks like the requested version constraint is not ...
6 years, 5 months ago (2014-06-30 15:28:51 UTC) #4
nweiz
lgtm https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/global_packages.dart File sdk/lib/_internal/pub/lib/src/global_packages.dart (right): https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/src/global_packages.dart#newcode99 sdk/lib/_internal/pub/lib/src/global_packages.dart:99: log.message("Activated ${log.bold(package.name)} ${package.version}."); On 2014/06/27 00:30:23, Bob Nystrom ...
6 years, 5 months ago (2014-06-30 19:42:28 UTC) #5
Bob Nystrom
Committed patchset #2 manually as r37832 (presubmit successful).
6 years, 5 months ago (2014-06-30 20:00:53 UTC) #6
Bob Nystrom
6 years, 5 months ago (2014-06-30 20:36:01 UTC) #7
Message was sent while issue was closed.
On 2014/06/26 21:34:23, Bob Nystrom wrote:

> It looks like the requested version constraint is not stored anywhere.  This
means when I later want to upgrade to a new version of a package's executables,
I need to re-specify the version constraint.  Maybe the requested constraints
could be stored in some sort of global pubspec.yaml.

I think in practice this won't matter. It supports an arbitrary constraint, but
most users will probably just use nothing ("any") or an explicit version. If you
want to upgrade, that implies the constraint probably is changing anyway.

> In general, a lot of the actions you might want to do globally seem to map to
package-local actions.  If that's true then it would be nice to not have to
memorize two sets of command names:

Yeah, they do parallel somewhat. I split it out deliberately, though, because we
want to make sure people understand the distinction. Global packages are very
disjoint from dependencies. It's important to keep them clear because the
version of a global package may be entirely different than the same version of a
package that you depend on.

Cheers!

- bob

https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/sr...
File sdk/lib/_internal/pub/lib/src/global_packages.dart (right):

https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/sr...
sdk/lib/_internal/pub/lib/src/global_packages.dart:99: log.message("Activated
${log.bold(package.name)} ${package.version}.");
On 2014/06/30 19:42:28, nweiz wrote:
> On 2014/06/27 00:30:23, Bob Nystrom wrote:
> > On 2014/06/26 22:43:25, nweiz wrote:
> > > For consistency with the message above, maybe word this "$name activated
at
> > > $version" (or change the previous message to make it consistent with
this).
> > 
> > I don't like to start a message with a package name because it looks weird
to
> > start lowercase. I could do "Package foo is now activated at version 1.2.3"
> here
> > but I prefer active voice.
> > 
> > > Also, package.version should be bolded.
> > 
> > In other places we only bold the name.
> 
> In that case the "already active" message shouldn't have a bold version
number.

I made it bold there to stress that the version is the relevant bit of data.

https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/sr...
File sdk/lib/_internal/pub/lib/src/utils.dart (right):

https://codereview.chromium.org/331593012/diff/1/sdk/lib/_internal/pub/lib/sr...
sdk/lib/_internal/pub/lib/src/utils.dart:828: throw new DataException(message);
On 2014/06/30 19:42:28, nweiz wrote:
> On 2014/06/27 00:30:23, Bob Nystrom wrote:
> > On 2014/06/26 22:43:26, nweiz wrote:
> > > Is this really worth having a custom function for? It's not used very
often
> > and
> > > it doesn't do any extra processing.
> > 
> > I like having it mainly because it mirrors usageError(), which is used
pretty
> > frequently. However, usageError() has to be on Command (since it accesses
the
> > help stuff from there) and this doesn't. They're conceptually siblings even
> > though they're defined in different places.
> 
> I don't think this parallel will be clear to people reading the code, but keep
> it if you want.

In a later patch, usageError() ends up getting moved too, so I think it will
make a bit more sense.

Powered by Google App Engine
This is Rietveld 408576698