Skip to content
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

Skip alias versions by default, add --aliases. #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ab
Copy link

@ab ab commented Nov 12, 2015

By default, skip ruby versions that are aliases. I'm having a hard time
thinking of any reason you would want to run the command on the same
ruby version multiple times by default.

Also tweak the option parsing and usage messages in support of this
change.

With versions 2.1 => 2.1.7, 2.1.6, and 2.1.7:

$ rbenv each ruby --version
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]

$ rbenv each --aliases ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]

Happy to revise / edit this PR as desired.

if [ -n "$aliases" ]; then
opts=
else
opts="--skip-aliases"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a feature only available in edge version of rbenv. We could only potentially ship this PR after rbenv 1.0 gets released. Also, we should ensure that rbenv each keeps working even with rbenv 0.4 for people who didn't upgrade.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that makes sense. Do you already have something in mind for how to do version detection?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, now that I look at rbenv versions argument handling in v0.4.0, it looks like it only recognizes --bare as 1st argument and ignores everything else. So I'm pretty sure that calling rbenv-versions --bare --skip-aliases will be safe for all rbenv versions, but of course only rbenv 1.0 will respect --skip-aliases.

@mislav
Copy link
Member

mislav commented Nov 13, 2015

Thanks for suggesting this change. I generally support the idea, but I'd like to first ship rbenv 1.0 and other PRs to this repo before this one.

@ab
Copy link
Author

ab commented Nov 13, 2015

Cool, thanks. Let me know if I can help.

-v|--verbose)
verbose=1
;;
-a|--aliases)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename the option to --with-aliases so its name more closely suggests what it does?

@mislav
Copy link
Member

mislav commented Mar 26, 2016

Rbenv 1.0 has shipped and we could use this feature. Could you rebase your PR so it's mergeable? Thanks!

By default, skip ruby versions that are aliases. I'm having a hard time
thinking of any reason you would want to run the command on the same
ruby version multiple times by default.

Also tweak the option parsing and usage messages in support of this
change.

With versions `2.1 => 2.1.7`, `2.1.6`, and `2.1.7`:

    $ rbenv each ruby --version
    ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
    ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]

    $ rbenv each --with-aliases ruby --version
    ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
    ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
    ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
@ab
Copy link
Author

ab commented Mar 29, 2016

Rebased & changed option name to --with-aliases. Thanks for re-raising this.

@@ -2,36 +2,60 @@
#
# Summary: Execute a command for each Ruby version
#
# Usage: rbenv each [-v] <command> [arg1 arg2...]
# Usage: rbenv each [options] <command> [arg1 arg2...]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted this to say [-va] instead of options but I realized that our option parsing doesn't support combining multiple shorthand flags together. So these docs will do for now.

@ab
Copy link
Author

ab commented Apr 27, 2016

Anything else needed here?

@ab
Copy link
Author

ab commented Oct 7, 2016

Ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants