Merge pull request #3926 from maxim-belkin/svn_remote_exists_bool

add ? to svn_remote_exists
This commit is contained in:
Mike McQuaid 2018-03-15 08:06:16 +00:00 committed by GitHub
commit cfe3e253f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -955,7 +955,7 @@ class ResourceAuditor
elsif strategy <= SubversionDownloadStrategy elsif strategy <= SubversionDownloadStrategy
next unless DevelopmentTools.subversion_handles_most_https_certificates? next unless DevelopmentTools.subversion_handles_most_https_certificates?
next unless Utils.svn_available? next unless Utils.svn_available?
unless Utils.svn_remote_exists url unless Utils.svn_remote_exists? url
problem "The URL #{url} is not a valid svn URL" problem "The URL #{url} is not a valid svn URL"
end end
end end

View File

@ -15,10 +15,10 @@ describe Utils do
end end
end end
describe "#self.svn_remote_exists" do describe "#self.svn_remote_exists?" do
it "returns true when svn is not available" do it "returns true when svn is not available" do
allow(Utils).to receive(:svn_available?).and_return(false) allow(Utils).to receive(:svn_available?).and_return(false)
expect(described_class.svn_remote_exists("blah")).to be_truthy expect(described_class.svn_remote_exists?("blah")).to be_truthy
end end
context "when svn is available" do context "when svn is available" do
@ -27,7 +27,7 @@ describe Utils do
end end
it "returns false when remote does not exist" do it "returns false when remote does not exist" do
expect(described_class.svn_remote_exists(HOMEBREW_CACHE/"install")).to be_falsey expect(described_class.svn_remote_exists?(HOMEBREW_CACHE/"install")).to be_falsey
end end
it "returns true when remote exists", :needs_network, :needs_svn do it "returns true when remote exists", :needs_network, :needs_svn do
@ -36,7 +36,7 @@ describe Utils do
HOMEBREW_CACHE.cd { system svn, "checkout", remote } HOMEBREW_CACHE.cd { system svn, "checkout", remote }
expect(described_class.svn_remote_exists(HOMEBREW_CACHE/"install")).to be_truthy expect(described_class.svn_remote_exists?(HOMEBREW_CACHE/"install")).to be_truthy
end end
end end
end end

View File

@ -8,7 +8,7 @@ module Utils
@svn = quiet_system HOMEBREW_SHIMS_PATH/"scm/svn", "--version" @svn = quiet_system HOMEBREW_SHIMS_PATH/"scm/svn", "--version"
end end
def self.svn_remote_exists(url) def self.svn_remote_exists?(url)
return true unless svn_available? return true unless svn_available?
quiet_system "svn", "ls", url, "--depth", "empty" quiet_system "svn", "ls", url, "--depth", "empty"
end end