Unify heredoc style.

This commit is contained in:
Markus Reiter 2016-08-24 13:23:27 +02:00
parent fa19447a2d
commit 50fee14358
13 changed files with 40 additions and 40 deletions

View File

@ -187,10 +187,10 @@ class Hbc::CLI
end end
opts.on("--binarydir=PATH") do opts.on("--binarydir=PATH") do
opoo <<-EOF.undent opoo <<-EOS.undent
Option --binarydir is obsolete! Option --binarydir is obsolete!
Homebrew-Cask now uses the same location as your Homebrew installation for executable links. Homebrew-Cask now uses the same location as your Homebrew installation for executable links.
EOF EOS
end end
FLAGS.each do |flag, method| FLAGS.each do |flag, method|
@ -246,11 +246,11 @@ class Hbc::CLI
end end
def purpose def purpose
puts <<-PURPOSE.undent puts <<-EOS.undent
brew-cask provides a friendly homebrew-style CLI workflow for the brew-cask provides a friendly homebrew-style CLI workflow for the
administration of macOS applications distributed as binaries. administration of macOS applications distributed as binaries.
PURPOSE EOS
end end
def usage def usage

View File

@ -27,10 +27,10 @@ class Hbc::CLI::Uninstall < Hbc::CLI::Base
single = versions.count == 1 single = versions.count == 1
puts <<-EOF.undent puts <<-EOS.undent
#{cask_token} #{versions.join(', ')} #{single ? 'is' : 'are'} still installed. #{cask_token} #{versions.join(', ')} #{single ? 'is' : 'are'} still installed.
Remove #{single ? 'it' : 'them all'} with `brew cask uninstall --force #{cask_token}`. Remove #{single ? 'it' : 'them all'} with `brew cask uninstall --force #{cask_token}`.
EOF EOS
end end
end end

View File

@ -11,12 +11,12 @@ class Hbc::Container::Air < Hbc::Container::Base
def self.installer_cmd def self.installer_cmd
return @installer_cmd ||= INSTALLER_PATHNAME if installer_exist? return @installer_cmd ||= INSTALLER_PATHNAME if installer_exist?
raise Hbc::CaskError, <<-ERRMSG.undent raise Hbc::CaskError, <<-EOS.undent
Adobe AIR runtime not present, try installing it via Adobe AIR runtime not present, try installing it via
brew cask install adobe-air brew cask install adobe-air
ERRMSG EOS
end end
def self.installer_exist? def self.installer_exist?

View File

@ -150,17 +150,17 @@ class Hbc::SystemCommand::Result
_warn_plist_garbage(command, Regexp.last_match[2]) _warn_plist_garbage(command, Regexp.last_match[2])
xml = Plist.parse_xml(output) xml = Plist.parse_xml(output)
unless xml.respond_to?(:keys) && !xml.keys.empty? unless xml.respond_to?(:keys) && !xml.keys.empty?
raise Hbc::CaskError, <<-ERRMSG raise Hbc::CaskError, <<-EOS
Empty result parsing plist output from command. Empty result parsing plist output from command.
command was: command was:
#{command.utf8_inspect} #{command.utf8_inspect}
output we attempted to parse: output we attempted to parse:
#{output} #{output}
ERRMSG EOS
end end
xml xml
rescue Plist::ParseError => e rescue Plist::ParseError => e
raise Hbc::CaskError, <<-ERRMSG raise Hbc::CaskError, <<-EOS
Error parsing plist output from command. Error parsing plist output from command.
command was: command was:
#{command.utf8_inspect} #{command.utf8_inspect}
@ -168,6 +168,6 @@ Error parsing plist output from command.
#{e} #{e}
output we attempted to parse: output we attempted to parse:
#{output} #{output}
ERRMSG EOS
end end
end end

View File

@ -18,11 +18,11 @@ describe Hbc::CLI::Cleanup do
expect { expect {
subject.cleanup! subject.cleanup!
}.to output(<<-OUTPUT.undent).to_stdout }.to output(<<-EOS.undent).to_stdout
==> Removing cached downloads ==> Removing cached downloads
#{cached_download} #{cached_download}
==> This operation has freed approximately #{disk_usage_readable(cleanup_size)} of disk space. ==> This operation has freed approximately #{disk_usage_readable(cleanup_size)} of disk space.
OUTPUT EOS
expect(cached_download.exist?).to eq(false) expect(cached_download.exist?).to eq(false)
end end
@ -38,11 +38,11 @@ describe Hbc::CLI::Cleanup do
expect { expect {
subject.cleanup! subject.cleanup!
}.to output(<<-OUTPUT.undent).to_stdout }.to output(<<-EOS.undent).to_stdout
==> Removing cached downloads ==> Removing cached downloads
skipping: #{cached_download} is locked skipping: #{cached_download} is locked
==> This operation has freed approximately #{disk_usage_readable(cleanup_size)} of disk space. ==> This operation has freed approximately #{disk_usage_readable(cleanup_size)} of disk space.
OUTPUT EOS
expect(cached_download.exist?).to eq(true) expect(cached_download.exist?).to eq(true)
end end
@ -56,10 +56,10 @@ describe Hbc::CLI::Cleanup do
expect { expect {
subject.cleanup! subject.cleanup!
}.to output(<<-OUTPUT.undent).to_stdout }.to output(<<-EOS.undent).to_stdout
==> Removing cached downloads older than 10 days old ==> Removing cached downloads older than 10 days old
Nothing to do Nothing to do
OUTPUT EOS
expect(cached_download.exist?).to eq(true) expect(cached_download.exist?).to eq(true)
end end

View File

@ -42,7 +42,7 @@ describe Hbc::Artifact::Uninstall do
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] } let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
let(:unknown_response) { "launchctl list returned unknown response\n" } let(:unknown_response) { "launchctl list returned unknown response\n" }
let(:service_info) { let(:service_info) {
<<-PLIST.undent <<-EOS.undent
{ {
"LimitLoadToSessionType" = "Aqua"; "LimitLoadToSessionType" = "Aqua";
"Label" = "my.fancy.package.service"; "Label" = "my.fancy.package.service";
@ -53,7 +53,7 @@ describe Hbc::Artifact::Uninstall do
"argument"; "argument";
); );
}; };
PLIST EOS
} }
describe "when launchctl job is owned by user" do describe "when launchctl job is owned by user" do
@ -124,7 +124,7 @@ describe Hbc::Artifact::Uninstall do
] ]
} }
let(:pkg_info_plist) { let(:pkg_info_plist) {
<<-PLIST.undent <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
@ -135,7 +135,7 @@ describe Hbc::Artifact::Uninstall do
<string>/</string> <string>/</string>
</dict> </dict>
</plist> </plist>
PLIST EOS
} }
it "can uninstall" do it "can uninstall" do

View File

@ -43,7 +43,7 @@ describe Hbc::Artifact::Zap do
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] } let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
let(:unknown_response) { "launchctl list returned unknown response\n" } let(:unknown_response) { "launchctl list returned unknown response\n" }
let(:service_info) { let(:service_info) {
<<-PLIST.undent <<-EOS.undent
{ {
"LimitLoadToSessionType" = "Aqua"; "LimitLoadToSessionType" = "Aqua";
"Label" = "my.fancy.package.service"; "Label" = "my.fancy.package.service";
@ -54,7 +54,7 @@ describe Hbc::Artifact::Zap do
"argument"; "argument";
); );
}; };
PLIST EOS
} }
describe "when launchctl job is owned by user" do describe "when launchctl job is owned by user" do
@ -125,7 +125,7 @@ describe Hbc::Artifact::Zap do
] ]
} }
let(:pkg_info_plist) { let(:pkg_info_plist) {
<<-PLIST.undent <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
@ -136,7 +136,7 @@ describe Hbc::Artifact::Zap do
<string>/</string> <string>/</string>
</dict> </dict>
</plist> </plist>
PLIST EOS
} }
it "can zap" do it "can zap" do

View File

@ -3,7 +3,7 @@ require "test_helper"
describe Hbc::CLI::Cat do describe Hbc::CLI::Cat do
describe "given a basic Cask" do describe "given a basic Cask" do
before do before do
@expected_output = <<-CLIOUTPUT.undent @expected_output = <<-EOS.undent
test_cask 'basic-cask' do test_cask 'basic-cask' do
version '1.2.3' version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
@ -13,7 +13,7 @@ describe Hbc::CLI::Cat do
app 'TestCask.app' app 'TestCask.app'
end end
CLIOUTPUT EOS
end end
it "displays the Cask file content about the specified Cask" do it "displays the Cask file content about the specified Cask" do

View File

@ -37,7 +37,7 @@ describe Hbc::CLI::Create do
it "drops a template down for the specified Cask" do it "drops a template down for the specified Cask" do
Hbc::CLI::Create.run("new-cask") Hbc::CLI::Create.run("new-cask")
template = File.read(Hbc.path("new-cask")) template = File.read(Hbc.path("new-cask"))
template.must_equal <<-TEMPLATE.undent template.must_equal <<-EOS.undent
cask 'new-cask' do cask 'new-cask' do
version '' version ''
sha256 '' sha256 ''
@ -49,7 +49,7 @@ describe Hbc::CLI::Create do
app '' app ''
end end
TEMPLATE EOS
end end
it "throws away additional Cask arguments and uses the first" do it "throws away additional Cask arguments and uses the first" do

View File

@ -4,11 +4,11 @@ describe Hbc::CLI::Search do
it "lists the available Casks that match the search term" do it "lists the available Casks that match the search term" do
lambda { lambda {
Hbc::CLI::Search.run("photoshop") Hbc::CLI::Search.run("photoshop")
}.must_output <<-OUTPUT.gsub(%r{^ *}, "") }.must_output <<-EOS.undent
==> Partial matches ==> Partial matches
adobe-photoshop-cc adobe-photoshop-cc
adobe-photoshop-lightroom adobe-photoshop-lightroom
OUTPUT EOS
end end
it "shows that there are no Casks matching a search term that did not result in anything" do it "shows that there are no Casks matching a search term that did not result in anything" do

View File

@ -57,11 +57,11 @@ describe Hbc::CLI::Uninstall do
timestamped_versions.each do |timestamped_version| timestamped_versions.each do |timestamped_version|
caskroom_path.join(".metadata", *timestamped_version, "Casks").tap(&:mkpath) caskroom_path.join(".metadata", *timestamped_version, "Casks").tap(&:mkpath)
.join("#{token}.rb").open("w") do |caskfile| .join("#{token}.rb").open("w") do |caskfile|
caskfile.puts <<-EOF.undent caskfile.puts <<-EOS.undent
cask '#{token}' do cask '#{token}' do
version '#{timestamped_version[0]}' version '#{timestamped_version[0]}'
end end
EOF EOS
end end
caskroom_path.join(timestamped_version[0]).mkpath caskroom_path.join(timestamped_version[0]).mkpath
end end
@ -112,13 +112,13 @@ describe Hbc::CLI::Uninstall do
saved_caskfile.dirname.mkpath saved_caskfile.dirname.mkpath
IO.write saved_caskfile, <<-EOF.undent IO.write saved_caskfile, <<-EOS.undent
cask 'ive-been-renamed' do cask 'ive-been-renamed' do
version :latest version :latest
app 'ive-been-renamed.app' app 'ive-been-renamed.app'
end end
EOF EOS
end end
after do after do

View File

@ -20,7 +20,7 @@ describe Hbc::DSL do
end end
it "prints a warning that it has encountered an unexpected method" do it "prints a warning that it has encountered an unexpected method" do
expected = Regexp.compile(<<-EOREGEX.undent.lines.map(&:chomp).join("")) expected = Regexp.compile(<<-EOS.undent.lines.map(&:chomp).join(""))
(?m) (?m)
Warning: Warning:
.* .*
@ -29,7 +29,7 @@ describe Hbc::DSL do
brew update; brew cleanup; brew cask cleanup brew update; brew cleanup; brew cask cleanup
.* .*
https://github.com/caskroom/homebrew-cask#reporting-bugs https://github.com/caskroom/homebrew-cask#reporting-bugs
EOREGEX EOS
TestHelper.must_output(self, attempt_unknown_method, expected) TestHelper.must_output(self, attempt_unknown_method, expected)
end end

View File

@ -11,13 +11,13 @@ describe Hbc::UrlChecker do
end end
it "properly populates the response code and headers from an http response" do it "properly populates the response code and headers from an http response" do
TestHelper.fake_response_for(TestHelper.test_cask.url, <<-RESPONSE.gsub(%r{^ *}, "")) TestHelper.fake_response_for(TestHelper.test_cask.url, <<-EOS.undent)
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/x-apple-diskimage Content-Type: application/x-apple-diskimage
ETag: "b4208f3e84967be4b078ecaa03fba941" ETag: "b4208f3e84967be4b078ecaa03fba941"
Content-Length: 23726161 Content-Length: 23726161
Last-Modified: Sun, 12 Aug 2012 21:17:21 GMT Last-Modified: Sun, 12 Aug 2012 21:17:21 GMT
RESPONSE EOS
checker = Hbc::UrlChecker.new(TestHelper.test_cask, TestHelper.fake_fetcher) checker = Hbc::UrlChecker.new(TestHelper.test_cask, TestHelper.fake_fetcher)
checker.run checker.run