diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index 0e573f3098..b984ed8b45 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -95,28 +95,7 @@ __brew_complete_tapped () __brew_complete_taps () { if [[ -z "$__brew_cached_taps" ]]; then - __brew_cached_taps="$(/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -e ' - require "open-uri" - require "yaml" - - begin - uri = URI.parse("http://github.com/api/v2/yaml/repos/search/homebrew") - - open uri do |f| - YAML::load(f.read)["repositories"].each do |repo| - if repo[:name] =~ /^homebrew-(\w+)$/ - puts tap = if repo[:username] == "Homebrew" - "homebrew/#{$1}" - else - repo[:username]+"/"+$1 - end - end - end - end - rescue - nil - end - ' 2>/dev/null)" + __brew_cached_taps="$(brew ls-taps)" fi __brewcomp "$__brew_cached_taps" diff --git a/Library/Contributions/cmds/brew-ls-taps.rb b/Library/Contributions/cmds/brew-ls-taps.rb new file mode 100755 index 0000000000..f6c92ebc0c --- /dev/null +++ b/Library/Contributions/cmds/brew-ls-taps.rb @@ -0,0 +1,18 @@ +require 'open-uri' +require 'vendor/multi_json' + +begin + open "https://api.github.com/legacy/repos/search/homebrew" do |f| + MultiJson.decode(f.read)["repositories"].each do |repo| + if repo['name'] =~ /^homebrew-(\S+)$/ + puts tap = if repo['username'] == "Homebrew" + "homebrew/#{$1}" + else + repo['username']+"/"+$1 + end + end + end + end +rescue + nil +end