aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDaniel Lee Harple2013-05-18 08:34:28 -0400
committerJack Nagel2013-05-22 19:53:05 -0500
commit88d5a5a6328bb9da1f5266863d3a93a2baa010a2 (patch)
tree6b9f3c1fe6416724075bd823af4ab0018ebb2c28 /Library
parentc2f9c5dff75c6568089f6610d40a67cc568a86af (diff)
downloadhomebrew-88d5a5a6328bb9da1f5266863d3a93a2baa010a2.tar.bz2
Remove unnecessary rescue-all exception handling
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmd/brew-ls-taps.rb15
-rw-r--r--Library/Homebrew/cmd/search.rb15
-rw-r--r--Library/Homebrew/utils.rb18
3 files changed, 18 insertions, 30 deletions
diff --git a/Library/Contributions/cmd/brew-ls-taps.rb b/Library/Contributions/cmd/brew-ls-taps.rb
index 600e0ad58..98c14dccf 100755
--- a/Library/Contributions/cmd/brew-ls-taps.rb
+++ b/Library/Contributions/cmd/brew-ls-taps.rb
@@ -1,16 +1,13 @@
require 'vendor/multi_json'
GitHub.open "https://api.github.com/legacy/repos/search/homebrew" do |f|
- begin
- 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
+ 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
- rescue
end
end
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 2ceefd2ce..e86594253 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -64,16 +64,13 @@ module Homebrew extend self
results = []
GitHub.open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |f|
- begin
- user.downcase! if user == "Homebrew" # special handling for the Homebrew organization
- MultiJson.decode(f.read)["tree"].map{ |hash| hash['path'] }.compact.each do |file|
- name = File.basename(file, '.rb')
- if file =~ /\.rb$/ and name =~ rx
- results << "#{user}/#{repo}/#{name}"
- $found += 1
- end
+ user.downcase! if user == "Homebrew" # special handling for the Homebrew organization
+ MultiJson.decode(f.read)["tree"].map{ |hash| hash['path'] }.compact.each do |file|
+ name = File.basename(file, '.rb')
+ if file =~ /\.rb$/ and name =~ rx
+ results << "#{user}/#{repo}/#{name}"
+ $found += 1
end
- rescue
end
end
results
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index ad86946aa..768ea2a4c 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -286,13 +286,10 @@ module GitHub extend self
uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{name}")
- open uri do |f|
- begin
- MultiJson.decode(f.read)['issues'].each do |issue|
- # don't include issues that just refer to the tool in their body
- issues << issue['html_url'] if issue['title'].include? name
- end
- rescue
+ GitHub.open uri do |f|
+ MultiJson.decode(f.read)['issues'].each do |issue|
+ # don't include issues that just refer to the tool in their body
+ issues << issue['html_url'] if issue['title'].include? name
end
end
@@ -306,11 +303,8 @@ module GitHub extend self
uri = URI.parse("https://api.github.com/legacy/issues/search/mxcl/homebrew/open/#{query}")
GitHub.open uri do |f|
- begin
- MultiJson.decode(f.read)['issues'].each do |pull|
- yield pull['pull_request_url'] if rx.match pull['title'] and pull['pull_request_url']
- end
- rescue
+ MultiJson.decode(f.read)['issues'].each do |pull|
+ yield pull['pull_request_url'] if rx.match pull['title'] and pull['pull_request_url']
end
end
end