brew/Library/Homebrew/cmd/versions.rb

25 lines
762 B
Ruby
Raw Normal View History

require "formula"
require "formula_versions"
2010-10-27 10:03:30 +02:00
module Homebrew
def versions
raise "Please `brew install git` first" unless which "git"
raise "Please `brew update` first" unless (HOMEBREW_REPOSITORY/".git").directory?
raise FormulaUnspecifiedError if ARGV.named.empty?
opoo <<-EOS.undent
brew-versions is unsupported and may be removed soon.
Please use the homebrew-versions tap instead:
https://github.com/Homebrew/homebrew-versions
EOS
ARGV.formulae.all? do |f|
versions = FormulaVersions.new(f)
path = versions.repository_path
versions.each do |version, rev|
print "#{Tty.white}#{version.to_s.ljust(8)}#{Tty.reset} "
puts "git checkout #{rev} #{path}"
2010-10-27 10:03:30 +02:00
end
end
end
end