brew 'info' will show info for cask if formula with same name does not exist
This commit is contained in:
parent
44f4f36c0d
commit
468496b5ff
@ -42,6 +42,10 @@ require "formula"
|
|||||||
require "keg"
|
require "keg"
|
||||||
require "tab"
|
require "tab"
|
||||||
require "json"
|
require "json"
|
||||||
|
require_relative "../cask/cmd/abstract_command"
|
||||||
|
require_relative "../cask/cmd/info"
|
||||||
|
require_relative "../cask/cask_loader"
|
||||||
|
require_relative "../cask/installer"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
@ -126,6 +130,11 @@ module Homebrew
|
|||||||
if (reason = MissingFormula.reason(f))
|
if (reason = MissingFormula.reason(f))
|
||||||
$stderr.puts reason
|
$stderr.puts reason
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
|
ohai "Searching for a cask with the name \"#{f}\""
|
||||||
|
cask = Cask::CaskLoader.load(f)
|
||||||
|
Cask::Cmd::Info.info(cask)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,6 +18,24 @@ describe "brew info", :integration_test do
|
|||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "looks for a Cask with the same name if a given Formula does not exist" do
|
||||||
|
expect { brew "info", "basic-cask" }
|
||||||
|
.to output(/Searching for a cask with the name "basic-cask"/).to_stdout
|
||||||
|
.and output(/No available formula with the name "basic-cask"/).to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not look for a Cask if a given Formula exists" do
|
||||||
|
RSpec::Matchers.define_negated_matcher :not_output, :output
|
||||||
|
expect { brew "info", "testball" }
|
||||||
|
.to not_output(/Searching for a cask with the name "testball"/).to_stdout
|
||||||
|
.and not_to_output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
it "prints an error message if a given Cask does not exist" do
|
||||||
|
expect { brew "info", "non_existant_cask" }
|
||||||
|
.to output(/No Cask with this name exists./).to_stderr
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Homebrew do
|
describe Homebrew do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user