-
Notifications
You must be signed in to change notification settings - Fork 832
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 command to install latest stable version of a tool #216
Comments
Once the referred issues are resolved, what would be nice is to have a package cleanup command, that retains only the latest minor versions by default, but still allowing the cleanup for major versions from an input flag, and also optionally a way to hold certain packages manually. While versioning semantics may differ, asdf could just follow semantic versioning, with optional plugin API that can be used to override this behaviour for custom semantics by the plugins. This should provide the full functionality needed to maintain a sort of rolling release model. Then this tool can fully replace nvm, gvm etc. |
Has any progress happened since 2017? |
I don't know if it's still under development, but this might help you @NightMachinary I have a small method I've been using in a ruby file that might be of help to you.
So far it's proven functional for Ruby, Rust, Node, Postgres, Elixir and Elm, but other languages may break it. (This is slightly modified from the original that I use which just returned the version number but should when run in a ruby file/executable install the latest version) |
@quintrino Thanks! I adapted that into a script: #!/usr/bin/env ruby
def latest(language)
`asdf plugin-add #{language} 2> /dev/null`
versions = `asdf list-all #{language} 2> /dev/null`.split("\n")
stock_versions = versions.select { |v| v.count('a-zA-Z').zero? }
latest_version = stock_versions.max_by { |v| Gem::Version.new(v) }
`asdf install #{language} #{latest_version}`
end
latest(ARGV[0]) |
Great! One thing to keep in mind is that this only works if the default version of the language doesn't include letters in it's name while the alternate versions do. So with Ruby, the line If the core or default version of a language included letters, this would filter it out. |
@NightMachinary @quintrino What do you think about integrating the logic from xxenv-latest into asdf? I currently use it with pyenv and have been pleased, but I am looking into switching to asdf to handle all the languages I use. It defaults to grabbing the latest numeric version like your Ruby script, but permits an additional parameter by which to filter versions. I have not tested it with rbenv, but I imagine it behaves like:
An asdf implementation could allow:
It could also look similar to the existing
I think this would just require updating the |
It seems an improvement to me👍🏼
…On Fri, Sep 6, 2019 at 9:34 PM Kevin Lane ***@***.***> wrote:
@NightMachinary <https://github.com/NightMachinary> @quintrino
<https://github.com/quintrino> What do you think about integrating the
logic from xxenv-latest
<https://github.com/momo-lab/xxenv-latest/blob/master/bin/xxenv-latest>
into asdf? I currently use it with pyenv and have been pleased, but I am
looking into switching to asdf to handle all the languages I use. It
defaults to grabbing the latest numeric version like your Ruby script, but
permits an additional parameter by which to filter versions. I have not
tested it with rbenv, but I imagine it behaves like:
- rbenv latest install installs 2.6.4
- rbenv latest install 2.5 installs 2.5.6
- rbenv latest install jruby installs jruby-9.2.8.0
An asdf implementation could allow:
- asdf install ruby latest
- asdf install ruby latest 2.5
- asdf install ruby latest jruby
It could also look similar to the existing ref support to avoid an
additional parameter:
- asdf install ruby latest
- asdf install ruby latest:2.5
- asdf install ruby latest:jruby
I think this would just require updating the install_tool_version
function in install.sh
<https://github.com/asdf-vm/asdf/blob/master/lib/commands/install.sh>.
There could also be a new latest or list-latest function to print the
version (similar to list and list-all), which install_tool_version would
then leverage to get the version.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#216?email_source=notifications&email_token=AIUL56S4GDXDM5PF2UJ26ADQIKERZA5CNFSM4DWDIAOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6DOKJI#issuecomment-528934181>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AIUL56S4PACD3BRZB332BMTQIKERZANCNFSM4DWDIAOA>
.
|
@NightMachinary @quintrino can't we add ruby as optional dependency to |
For those who end up here: here's my bash script for updating every asdf plugin dependency to latest: |
Right now it's up to plugins to decide how they list versions. Some list only stable releases, others may list all releases. Some may print out the versions sorted incorrectly. This prevents us from just doing
asdf list-all "$tool" | tail -1
to get the latest stable version of a tool.We need a command that allows us to install the latest stable version of a tool. In order to have such a command we will need to have a
latest-stable
callback script in each plugin that returns the latest stable version of a tool. Then we can add a--latest
flag to the install command so we can doasdf install ruby --latest
to install the version of Ruby returned from the Ruby plugin'slatest-stable
callback. The callback script would need to return the latest stable version of the tool for the given architecture. Some plugins have different versions available for different architectures, so if a plugin does include thelatest-stable
it must chose to the right version for the architecture.This
latest-stable
callback script would start out optional, but could eventually be made a requirement by adding an assertion to theplugin-test
command.Created when reviewing thoughtbot/laptop#502
The text was updated successfully, but these errors were encountered: