Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Improve readability of outdated #4474

Merged
22 commits merged into from
Oct 14, 2019
Merged

Improve readability of outdated #4474

22 commits merged into from
Oct 14, 2019

Conversation

tlynam
Copy link
Contributor

@tlynam tlynam commented Apr 28, 2016

Haven't fixed tests since wanted buy-in.

Before:

Outdated gems included in the bundle:
  * active_model_serializers (newest 0.9.5, installed 0.8.3, requested ~> 0.8.0) in group "default"
  * activerecord-import (newest 0.13.0, installed 0.10.0) in group "default"
  * addressable (newest 2.4.0, installed 2.3.5, requested = 2.3.5) in group "default"
  * airbrake (newest 5.2.3, installed 5.1.0) in group "default"
  * bootstrap-sass (newest 3.3.6, installed 3.3.5.1) in group "default"
  * capistrano (newest 3.5.0, installed 3.4.0, requested ~> 3.4) in group "development"
  * capistrano-rails (newest 1.1.6, installed 1.1.3, requested ~> 1.1.1) in group "development"

After:

--pretty
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups
airbrake                5.3.0      5.0.3                 default
better_errors           2.1.1      1.0.1      ~> 1.0.1   development
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default
factory_girl_rails      4.7.0      4.4.1                 test, development

--pretty --verbose
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups            Load Path
airbrake                5.3.0      5.0.3                 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/airbrake-5.3.0.gemspec
better_errors           2.1.1      1.0.1      ~> 1.0.1   development       /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/better_errors-2.1.1.gemspec
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/bootstrap-sass-3.3.6.gemspec
factory_girl            4.7.0      4.4.0                                   /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl-4.7.0.gemspec
factory_girl_rails      4.7.0      4.4.1                 test, development /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl_rails-4.7.0.gemspec

@segiddins
Copy link
Member

I like this! Would it maybe make sense to justify all the different parts of the line as well?

@hmistry
Copy link
Contributor

hmistry commented May 10, 2016

I think so. Something like below is what I'd like to see if possible. Removing all the repetitive labeling, removes clutter and makes it easier to read.

Outdated gems included in the bundle:
  * Gem Name                   New      Installed   Requested    Group
  * active_model_serializers   0.9.5    0.8.3       ~> 0.8.0     "default"
  * activerecord-import        0.13.0   0.10.0                   "default"
  * addressable                2.4.0    2.3.5       = 2.3.5      "default"
  * airbrake                   5.2.3    5.1.0                    "default"
  * bootstrap-sass             3.3.6    3.3.5.1                  "default"
  * capistrano                 3.4.1    3.4.0       ~> 3.4       "development"
  * capistrano-rails           1.1.6    1.1.3       ~> 1.1.1     "development"

@segiddins
Copy link
Member

Only issue with that is that it will break any automated parsing of the --outdated output, right?

@RochesterinNYC
Copy link
Contributor

Well, maybe we should be encouraging people to use bundle outdated --parseable for automated parsing? Though, we'd have to decide whether that output would stay the same or get formatted the same as here.

@hmistry
Copy link
Contributor

hmistry commented May 10, 2016

@segiddins because it's not CSV formatted? It's possible. We can add the comma's in to help with that but it will require a little mod to their script. Alternatively, it could be a --outdated-prettyformat option.

@segiddins
Copy link
Member

No, not that its not CSV, but rather because that header line has the same format as an outdated gem line

@RochesterinNYC
Copy link
Contributor

If we make it an alternative option/something that needs to be specified via flags, I don't think it'll see much use.

Ideally, it'd be nice to shore up and focus bundle outdated on producing pleasing human-readable output while ensuring bundle outdated --parseable maintains an automatically parseable format might be a good resolution. However, after looking around Github at some repos, I think the original output (ex. * active_model_serializers (newest 0.9.5, installed 0.8.3, requested ~> 0.8.0) in group "default") might be as far as we might consider changing the output to. Even then, it seems that we might be breaking some people's usages/parsing of bundle outdated.

Alternatively, this could be a PR/change to Bundler 2.0? In which case, breaking the interface/format is acceptable?

@hmistry
Copy link
Contributor

hmistry commented May 10, 2016

@segiddins Ah! I see. It's an easy thing to fix either do all caps or wrap them in parentheses or ... depends if we decide to go this route.

@RochesterinNYC Agree, breaking changes like this is better done in major version upgrades. My thoughts on the flag option is it's ok to have low usage in the beginning as it will take time for awareness and adoption/user change. What's more important is to hear their feedback and see rate of adoption, though for a command utility it's harder than it is for a website.

@phiggins
Copy link

Is there any reason to keep the sorting based on the group, rather than the gem name?

When I use bundle outdated, I typically scan the output to see if a gem or set of gems is listed, and the list being sorted by group is not the most helpful way it could be. I'd suggest sorting the list based on the name of the gem.

@RochesterinNYC
Copy link
Contributor

Grouping by Gemfile groups, then by sub-dependencies (dependencies of the explicitly named dependencies in the Gemfile), is more logical than having an alphabetical list of gems as it can get confusing which type of gem dependency you're looking at. Additionally, from what I've seen in terms of bundle outdated usage, many users choose to be more stringent about updates for certain groups (ex. production rather than testing).

@phiggins
Copy link

I can only speak for myself, but I find the current output very confusing. The only times I've ever used bundle outdated was to find out if a gem or set of gems had newer versions available, and the current output is not useful for that.

I felt obligated to add my two cents because I put @tlynam up to this in the first place. I'll respect whatever decisions are made by the project maintainers and I promise I won't belabor the point.

@tlynam
Copy link
Contributor Author

tlynam commented May 15, 2016

Could we support both use cases? What do you think if there were a --grouped option as a type of sorting? Do you think it could be confusing to read a list if there were several group combinations? Looking through our gemfile we have
test, development, staging
test, development
test
development
If it were pre-grouped, I think there could be a high chance someone would still need to play with the output if they were trying to isolate certain environments.

@indirect
Copy link
Member

To be honest, I'm also confused by the way outdated prints an undifferentiated list that isn't in alphabetical order. I think might make sense if it did it in a hierarchical way, maybe like this:

Outdated gems in the default group:
  rack-obama (newest 0.1.1, installed 0.1.0, requested 0.1.0)
    rack (newest 1.6.3, installed 1.2.1, requested ~> 1.2.0)

But given the way that it prints now, I think alphabetizing the list would actually make a lot of sense. I also like the tabular output, and I think adding a --parseable output to outdated that prints in some easily computer-parsable format like TSV or CSV make a lot of sense.

To be fully backwards-compatible, we could alphabetize the current output, add --parseable with TSV output, and plan to change the regular output to something tabular in 2.0. How does everyone feel about that?

@phiggins
Copy link

To be fully backwards-compatible, we could alphabetize the current output, add --parseable with TSV output, and plan to change the regular output to something tabular in 2.0. How does everyone feel about that?

Sounds good to me. 👍

@hmistry
Copy link
Contributor

hmistry commented May 15, 2016

I agree with that.

@booch
Copy link

booch commented May 23, 2016

We could keep the current output format if STDOUT is a pipe, and print the pretty output if we're running it interactively, or if --pretty is specified.

@tlynam
Copy link
Contributor Author

tlynam commented Jun 5, 2016

What do you think of this? This alphabetizes the current default. We already have a parseable option so I added pretty. It uses offsets and works with verbose.

--pretty
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups
airbrake                5.3.0      5.0.3                 default
better_errors           2.1.1      1.0.1      ~> 1.0.1   development
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default
factory_girl_rails      4.7.0      4.4.1                 test, development

--pretty --verbose
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups            Load Path
airbrake                5.3.0      5.0.3                 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/airbrake-5.3.0.gemspec
better_errors           2.1.1      1.0.1      ~> 1.0.1   development       /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/better_errors-2.1.1.gemspec
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/bootstrap-sass-3.3.6.gemspec
factory_girl            4.7.0      4.4.0                                   /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl-4.7.0.gemspec
factory_girl_rails      4.7.0      4.4.1                 test, development /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl_rails-4.7.0.gemspec

@hmistry
Copy link
Contributor

hmistry commented Jun 5, 2016

Nice! I really like that. 👍

Check with @segiddins if he wishes to differentiate the title row for easy parsing as he raised a concern earlier about the title row being similar to a table row.

@phiggins
Copy link

phiggins commented Jun 7, 2016

This looks awesome @tlynam!

@homu
Copy link
Contributor

homu commented Oct 6, 2016

☔ The latest upstream changes (presumably #4841) made this pull request unmergeable. Please resolve the merge conflicts.

@chrismo
Copy link
Contributor

chrismo commented Oct 6, 2016

Welp. @tlynam - we just approved a PR to add grouping to this command (#4841) and left this one behind. :| I'm sure it was unintentional, lots of PRs and Issues and only so much time.

That said, your proposed changes still seem relevant if you'd like to rebase this.

FYI, I'm working on #5061 which is making some additional changes to it.

(Big picture, I'd love to see this code cleaned up to better separate out the data gathering and presentation - it's all intertwined right now and makes it more difficult to extend for different views - though I won't be focusing on that).

@tlynam
Copy link
Contributor Author

tlynam commented Oct 6, 2016

Thanks @chrismo, I'll work on improving this :)

@tlynam tlynam force-pushed the outdated-format branch 2 times, most recently from 20fe0be to 73fe587 Compare October 28, 2016 04:16
@tlynam
Copy link
Contributor Author

tlynam commented Oct 28, 2016

I rewrote this, please let me know how it can be improved, thanks! :)

@chrismo
Copy link
Contributor

chrismo commented Oct 28, 2016

thx @tlynam. if someone else can get to it before me, cool - imma having a very busy week that doesn't include any time for bundler :/

feel free to ping me or us on this PR if we neglect you too long, I don't mind the reminders :)

@tlynam
Copy link
Contributor Author

tlynam commented Oct 28, 2016

Thanks @chrismo, I completely understand :)

@bundlerbot
Copy link
Collaborator

☔ The latest upstream changes (presumably #5114) made this pull request unmergeable. Please resolve the merge conflicts.

@chrismo chrismo self-assigned this Nov 19, 2016
With this, if we rename the hash, we don't have to change the
indentation of every entry to keep it consistent.
The list part doesn't add much and it's very implementation dependent.
The output feels a bit cleaner because there's more space, and the term
is more clear in my opinion.
I don't think it adds much to the output?
If bundler crashes, specs should fail anyways.
The "Latest" version may also be installed, so I think it's more
accurate to use "Locked" here.
All the other screen output and checks for `--parseable` are doing
inline, so let's do it here too.
`--parseable` checks `Bundler.ui.debug?` instead of look at the option
directly.
@deivid-rodriguez
Copy link
Member

I'll merge this in tomorrow if there's no further feedback.

@deivid-rodriguez
Copy link
Member

@bundlerbot r+

ghost pushed a commit that referenced this pull request Oct 14, 2019
4474: Improve readability of outdated r=deivid-rodriguez a=tlynam

Haven't fixed tests since wanted buy-in.

Before:

```
Outdated gems included in the bundle:
  * active_model_serializers (newest 0.9.5, installed 0.8.3, requested ~> 0.8.0) in group "default"
  * activerecord-import (newest 0.13.0, installed 0.10.0) in group "default"
  * addressable (newest 2.4.0, installed 2.3.5, requested = 2.3.5) in group "default"
  * airbrake (newest 5.2.3, installed 5.1.0) in group "default"
  * bootstrap-sass (newest 3.3.6, installed 3.3.5.1) in group "default"
  * capistrano (newest 3.5.0, installed 3.4.0, requested ~> 3.4) in group "development"
  * capistrano-rails (newest 1.1.6, installed 1.1.3, requested ~> 1.1.1) in group "development"
```

After:

```
--pretty
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups
airbrake                5.3.0      5.0.3                 default
better_errors           2.1.1      1.0.1      ~> 1.0.1   development
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default
factory_girl_rails      4.7.0      4.4.1                 test, development

--pretty --verbose
Outdated gems included in the bundle:
Gem Name                New        Installed  Requested  Groups            Load Path
airbrake                5.3.0      5.0.3                 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/airbrake-5.3.0.gemspec
better_errors           2.1.1      1.0.1      ~> 1.0.1   development       /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/better_errors-2.1.1.gemspec
bootstrap-sass          3.3.6      3.3.0.1    ~> 3.3.0.1 default           /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/bootstrap-sass-3.3.6.gemspec
factory_girl            4.7.0      4.4.0                                   /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl-4.7.0.gemspec
factory_girl_rails      4.7.0      4.4.1                 test, development /Users/todd/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/specifications/factory_girl_rails-4.7.0.gemspec
```


Co-authored-by: Todd Lynam <tlynam@gmail.com>
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
@ghost
Copy link

ghost commented Oct 14, 2019

Build succeeded

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet