aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-08-12 12:46:28 +0100
committerGitHub2017-08-12 12:46:28 +0100
commit7ecc7758484d3d8e7b3becc3735affe50f4b3898 (patch)
tree702e932fa60b4af6c174e4f061e77184dfeead6d /Library
parenta757f438957f6e9b7f6c7f9c46753a6580a9f2b7 (diff)
parentcb1650075c9f6c74a637f108e3f43deb4250b837 (diff)
downloadbrew-7ecc7758484d3d8e7b3becc3735affe50f4b3898.tar.bz2
Merge pull request #3044 from BenMusch/search-tap-fix
Replace search_tap with search_taps
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/search.rb6
-rw-r--r--Library/Homebrew/test/cmd/search_spec.rb8
2 files changed, 11 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 5b83d80e2..0d47f8ab1 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -43,15 +43,15 @@ module Homebrew
Descriptions.search(regex, :desc).print
elsif ARGV.first =~ HOMEBREW_TAP_FORMULA_REGEX
query = ARGV.first
- user, repo, name = query.split("/", 3)
begin
result = Formulary.factory(query).name
+ results = Array(result)
rescue FormulaUnavailableError
- result = search_tap(user, repo, name)
+ _, _, name = query.split("/", 3)
+ results = search_taps(name)
end
- results = Array(result)
puts Formatter.columns(results) unless results.empty?
else
query = ARGV.first
diff --git a/Library/Homebrew/test/cmd/search_spec.rb b/Library/Homebrew/test/cmd/search_spec.rb
index bd2056a48..7c97e6e35 100644
--- a/Library/Homebrew/test/cmd/search_spec.rb
+++ b/Library/Homebrew/test/cmd/search_spec.rb
@@ -1,6 +1,7 @@
describe "brew search", :integration_test do
before(:each) do
setup_test_formula "testball"
+ setup_remote_tap "caskroom/cask"
end
it "lists all available Formulae when no argument is given" do
@@ -24,6 +25,13 @@ describe "brew search", :integration_test do
.and be_a_success
end
+ it "falls back to a tap search when no formula is found" do
+ expect { brew "search", "caskroom/cask/firefox" }
+ .to output(/firefox/).to_stdout
+ .and not_to_output.to_stderr
+ .and be_a_success
+ end
+
describe "--desc" do
let(:desc_cache) { HOMEBREW_CACHE/"desc_cache.json" }