aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/search.rb2
-rw-r--r--Library/Homebrew/cmd/search.rb2
-rw-r--r--Library/Homebrew/test/utils/github_spec.rb4
-rw-r--r--Library/Homebrew/utils/github.rb4
4 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb
index 0cc4cc56c..e89dced92 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/search.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb
@@ -17,7 +17,7 @@ module Hbc
def self.search_remote(query)
matches = GitHub.search_code(user: "caskroom", path: "Casks",
filename: query, extension: "rb")
- Array(matches).map do |match|
+ matches.map do |match|
tap = Tap.fetch(match["repository"]["full_name"])
next if tap.installed?
"#{tap.name}/#{File.basename(match["path"], ".rb")}"
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 4607f6d1a..a133d0499 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -104,7 +104,7 @@ module Homebrew
valid_dirnames = ["Formula", "HomebrewFormula", "Casks", "."].freeze
matches = GitHub.search_code(user: ["Homebrew", "caskroom"], filename: query, extension: "rb")
- Array(matches).map do |match|
+ matches.map do |match|
dirname, filename = File.split(match["path"])
next unless valid_dirnames.include?(dirname)
tap = Tap.fetch(match["repository"]["full_name"])
diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb
index 79a26083a..5c315aec4 100644
--- a/Library/Homebrew/test/utils/github_spec.rb
+++ b/Library/Homebrew/test/utils/github_spec.rb
@@ -14,8 +14,8 @@ describe GitHub do
describe "::query_string" do
it "builds a query with the given hash parameters formatted as key:value" do
- query = subject.query_string(user: "Homebrew", repo: "Brew")
- expect(query).to eq("q=user%3AHomebrew+repo%3ABrew&per_page=100")
+ query = subject.query_string(user: "Homebrew", repo: "brew")
+ expect(query).to eq("q=user%3AHomebrew+repo%3Abrew&per_page=100")
end
it "adds a variable number of top-level string parameters to the query when provided" do
diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb
index 05ef7e3c8..960b563d9 100644
--- a/Library/Homebrew/utils/github.rb
+++ b/Library/Homebrew/utils/github.rb
@@ -296,12 +296,12 @@ module GitHub
end
def url_to(*subroutes)
- URI.parse(File.join(API_URL, *subroutes))
+ URI.parse([API_URL, *subroutes].join("/"))
end
def search(entity, *queries, **qualifiers)
uri = url_to "search", entity
uri.query = query_string(*queries, **qualifiers)
- open(uri) { |json| json["items"] }
+ open(uri) { |json| Array(json["items"]) }
end
end