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

Upgrade function for casks #21205

Closed
chuchana opened this issue May 14, 2016 · 5 comments
Closed

Upgrade function for casks #21205

chuchana opened this issue May 14, 2016 · 5 comments

Comments

@chuchana
Copy link

Inspired by this answer on Ask Different, I hacked together some functionality to check for updated casks and upgrade them selectively in fish. I started to translate it to Ruby, but I have no idea how this should be integrated into homebrew:

casks = `brew cask list`.split
outdated_casks = []

casks.each do |cask|
  current_version = `#{"brew cask info #{cask} | sed -n '1p' | sed -n 's/^.*: \\(.*\\)$/\\1/p'"}`
  installed_version = `#{"ls /opt/homebrew-cask/Caskroom/#{cask}"}`
  unless installed_version == current_version
    puts "#{cask} #{installed_version} --> #{current_version}\n"
    outdated_casks.push("#{cask}")
  end
end

puts outdated_casks



casks.each do |cask|
  `#{"brew cask uninstall --force #{cask}"}`
  `#{"brew cask   install --force #{cask}"}`
end
@vitorgalvao
Copy link
Member

Thank you, but as has been explained multiple times in multiple places, relying on brew cask list won’t work.

@chuchana
Copy link
Author

I did not now about that. But isn't it better to have it work for most casks than not for any? Or is another implementation planned?

@vitorgalvao
Copy link
Member

vitorgalvao commented May 14, 2016

But isn't it better to have it work for most casks than not for any?

No, not at all. An inconsistent implementation does no one any good. Especially us maintainers, that would spend all day answering those bug reports.

Or is another implementation planned?

Yes, a proper implementation is planned, naturally, but not in the works.

@chuchana
Copy link
Author

That makes sense.

Any objection to using ls /opt/homebrew-cask/Caskroom/instead of brew cask list?

@vitorgalvao
Copy link
Member

Yes. That will break with #13201.

@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants