diff options
| author | Mike McQuaid | 2014-09-20 14:31:44 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-09-24 15:22:51 -0700 |
| commit | 3fc691d4e5fa6ea568643b89b28346ef9303346b (patch) | |
| tree | 95a5668cc2bbe2f600233865d19dde5ccd9a44d5 /Library/Contributions | |
| parent | 9b82398f26ebbbfce9f8b31a9a190b9414c2c1cb (diff) | |
| download | homebrew-3fc691d4e5fa6ea568643b89b28346ef9303346b.tar.bz2 | |
brew-switch: make an internal command.
Diffstat (limited to 'Library/Contributions')
| -rwxr-xr-x | Library/Contributions/cmd/brew-switch.rb | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/Library/Contributions/cmd/brew-switch.rb b/Library/Contributions/cmd/brew-switch.rb deleted file mode 100755 index 5cfe86d63..000000000 --- a/Library/Contributions/cmd/brew-switch.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'formula' -require 'keg' - -if ARGV.named.length != 2 - onoe "Usage: brew switch <formula> <version>" - exit 1 -end - -name = ARGV.shift -version = ARGV.shift - -# Does this formula have any versions? -f = Formula.factory(name.downcase) -cellar = f.prefix.parent -unless cellar.directory? - onoe "#{name} not found in the Cellar." - exit 2 -end - -# Does the target version exist? -unless (cellar+version).directory? - onoe "#{name} does not have a version \"#{version}\" in the Cellar." - - versions = cellar.subdirs.map { |d| Keg.new(d).version } - puts "Versions available: #{versions.join(', ')}" - - exit 3 -end - -# Unlink all existing versions -cellar.subdirs.each do |v| - keg = Keg.new(v) - puts "Cleaning #{keg}" - keg.unlink -end - -# Link new version, if not keg-only -if f.keg_only? - keg = Keg.new(cellar+version) - keg.optlink - puts "Opt link created for #{keg}" -else - keg = Keg.new(cellar+version) - puts "#{keg.link} links created for #{keg}" -end |
