diff options
| author | Mike McQuaid | 2012-03-18 15:33:21 +1300 |
|---|---|---|
| committer | Mike McQuaid | 2012-03-18 15:34:41 +1300 |
| commit | e33937a1e35e75dffae043f22e975bfd51dea409 (patch) | |
| tree | 0c04edf7d597577808d5dc72a68718e047052168 /Library/Contributions/examples/brew-switch.rb | |
| parent | d47cf55f68fb1d381cfbdc9de905dc33c7ce5a83 (diff) | |
| download | brew-e33937a1e35e75dffae043f22e975bfd51dea409.tar.bz2 | |
Rename external commands directory from examples.
Fixes Homebrew/homebrew#10829.
Diffstat (limited to 'Library/Contributions/examples/brew-switch.rb')
| -rwxr-xr-x | Library/Contributions/examples/brew-switch.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/Library/Contributions/examples/brew-switch.rb b/Library/Contributions/examples/brew-switch.rb deleted file mode 100755 index 3b51f941c..000000000 --- a/Library/Contributions/examples/brew-switch.rb +++ /dev/null @@ -1,40 +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.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s } - puts "Versions available: #{versions.join(', ')}" - - exit 3 -end - -# Unlink all existing versions -cellar.children.select { |pn| pn.directory? }.each do |v| - keg = Keg.new(v) - puts "Cleaning #{keg}" - keg.unlink -end - -# Link new version - -keg = Keg.new(cellar+version) -puts "#{keg.link} links created for #{keg}"
\ No newline at end of file |
