diff options
| author | Mike McQuaid | 2014-09-20 14:31:44 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-09-24 15:22:51 -0700 |
| commit | ce6d76ed1c02d06f1eec41e21289b79b94bbdcc0 (patch) | |
| tree | 08d8293d22f6c53ff0be561796a00ede7e50050d /Library/Contributions | |
| parent | 3a432bcc2a20ff2c61ae074ff70ca9faaee4b19b (diff) | |
| download | brew-ce6d76ed1c02d06f1eec41e21289b79b94bbdcc0.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 |
