Use () as delimiters for %Q and %q literals.
This commit is contained in:
parent
1a0f8b8a02
commit
8e9eae695a
@ -31,7 +31,7 @@ module Hbc
|
||||
print_stderr: false).stdout.sub(/\A\((.*)\)\Z/, '\1')
|
||||
odebug "Existing metadata is: '#{altnames}'"
|
||||
altnames.concat(", ") unless altnames.empty?
|
||||
altnames.concat(%Q{"#{altname}"})
|
||||
altnames.concat(%Q("#{altname}"))
|
||||
altnames = "(#{altnames})"
|
||||
|
||||
# Some packges are shipped as u=rx (e.g. Bitcoin Core)
|
||||
|
||||
@ -87,7 +87,7 @@ module Hbc
|
||||
def warn_for_unknown_directives(directives)
|
||||
unknown_keys = directives.keys - ORDERED_DIRECTIVES
|
||||
return if unknown_keys.empty?
|
||||
opoo %Q{Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. Running "brew update; brew cleanup; brew cask cleanup" will likely fix it.}
|
||||
opoo %Q(Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. Running "brew update; brew cleanup; brew cask cleanup" will likely fix it.)
|
||||
end
|
||||
|
||||
# Preserve prior functionality of script which runs first. Should rarely be needed.
|
||||
@ -129,7 +129,7 @@ module Hbc
|
||||
ohai "Quitting application ID #{id}"
|
||||
num_running = count_running_processes(id)
|
||||
next unless num_running > 0
|
||||
@command.run!("/usr/bin/osascript", args: ["-e", %Q{tell application id "#{id}" to quit}], sudo: true)
|
||||
@command.run!("/usr/bin/osascript", args: ["-e", %Q(tell application id "#{id}" to quit)], sudo: true)
|
||||
sleep 3
|
||||
end
|
||||
end
|
||||
@ -156,13 +156,13 @@ module Hbc
|
||||
|
||||
def count_running_processes(bundle_id)
|
||||
@command.run!("/usr/bin/osascript",
|
||||
args: ["-e", %Q{tell application "System Events" to count processes whose bundle identifier is "#{bundle_id}"}],
|
||||
args: ["-e", %Q(tell application "System Events" to count processes whose bundle identifier is "#{bundle_id}")],
|
||||
sudo: true).stdout.to_i
|
||||
end
|
||||
|
||||
def get_unix_pids(bundle_id)
|
||||
pid_string = @command.run!("/usr/bin/osascript",
|
||||
args: ["-e", %Q{tell application "System Events" to get the unix id of every process whose bundle identifier is "#{bundle_id}"}],
|
||||
args: ["-e", %Q(tell application "System Events" to get the unix id of every process whose bundle identifier is "#{bundle_id}")],
|
||||
sudo: true).stdout.chomp
|
||||
return [] unless pid_string =~ /\A\d+(?:\s*,\s*\d+)*\Z/ # sanity check
|
||||
pid_string.split(/\s*,\s*/).map(&:strip).map(&:to_i)
|
||||
@ -172,7 +172,7 @@ module Hbc
|
||||
Array(directives[:login_item]).each do |name|
|
||||
ohai "Removing login item #{name}"
|
||||
@command.run!("/usr/bin/osascript",
|
||||
args: ["-e", %Q{tell application "System Events" to delete every login item whose name is "#{name}"}],
|
||||
args: ["-e", %Q(tell application "System Events" to delete every login item whose name is "#{name}")],
|
||||
sudo: false)
|
||||
sleep 1
|
||||
end
|
||||
|
||||
@ -266,7 +266,7 @@ module Hbc
|
||||
next unless klass.visible
|
||||
puts " #{klass.command_name.ljust(max_command_len)} #{_help_for(klass)}"
|
||||
end
|
||||
puts %Q{\nSee also "man brew-cask"}
|
||||
puts %Q(\nSee also "man brew-cask")
|
||||
end
|
||||
|
||||
def help
|
||||
|
||||
@ -104,7 +104,7 @@ module Hbc
|
||||
end
|
||||
|
||||
def self.locale_variables
|
||||
ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect { |v| %Q{#{v}="#{ENV[v]}"} }.sort.join("\n")
|
||||
ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).collect { |v| %Q(#{v}="#{ENV[v]}") }.sort.join("\n")
|
||||
end
|
||||
|
||||
def self.privileged_uid
|
||||
@ -154,7 +154,7 @@ module Hbc
|
||||
|
||||
def self.render_env_var(var)
|
||||
if ENV.key?(var)
|
||||
%Q{#{var}="#{ENV[var]}"}
|
||||
%Q(#{var}="#{ENV[var]}")
|
||||
else
|
||||
none_string
|
||||
end
|
||||
|
||||
@ -9,7 +9,7 @@ module Hbc
|
||||
cask_path = Hbc.path(cask_token)
|
||||
odebug "Opening editor for Cask #{cask_token}"
|
||||
unless cask_path.exist?
|
||||
raise CaskUnavailableError, %Q{#{cask_token}, run "brew cask create #{cask_token}" to create a new Cask}
|
||||
raise CaskUnavailableError, %Q(#{cask_token}, run "brew cask create #{cask_token}" to create a new Cask)
|
||||
end
|
||||
exec_editor cask_path
|
||||
end
|
||||
|
||||
@ -23,7 +23,7 @@ module Hbc
|
||||
|
||||
class CaskAlreadyCreatedError < AbstractCaskErrorWithToken
|
||||
def to_s
|
||||
%Q{A Cask for #{token} already exists. Run "brew cask cat #{token}" to see it.}
|
||||
%Q(A Cask for #{token} already exists. Run "brew cask cat #{token}" to see it.)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ module Hbc
|
||||
end
|
||||
|
||||
def zap
|
||||
ohai %Q{Implied "brew cask uninstall #{@cask}"}
|
||||
ohai %Q(Implied "brew cask uninstall #{@cask}")
|
||||
uninstall_artifacts
|
||||
if Artifact::Zap.me?(@cask)
|
||||
ohai "Dispatching zap stanza"
|
||||
|
||||
@ -2,6 +2,6 @@ module HashValidator
|
||||
def assert_valid_keys(*valid_keys)
|
||||
unknown_keys = keys - valid_keys
|
||||
return if unknown_keys.empty?
|
||||
raise CaskError, %Q{Unknown keys: #{unknown_keys.inspect}. Running "#{UPDATE_CMD}" will likely fix it.}
|
||||
raise CaskError, %Q(Unknown keys: #{unknown_keys.inspect}. Running "#{UPDATE_CMD}" will likely fix it.)
|
||||
end
|
||||
end
|
||||
|
||||
@ -201,10 +201,10 @@ describe Hbc::Artifact::Uninstall do
|
||||
let(:bundle_id) { "my.fancy.package.app" }
|
||||
let(:count_processes_script) {
|
||||
'tell application "System Events" to count processes ' +
|
||||
%Q{whose bundle identifier is "#{bundle_id}"}
|
||||
%Q(whose bundle identifier is "#{bundle_id}")
|
||||
}
|
||||
let(:quit_application_script) {
|
||||
%Q{tell application id "#{bundle_id}" to quit}
|
||||
%Q(tell application id "#{bundle_id}" to quit)
|
||||
}
|
||||
|
||||
it "can uninstall" do
|
||||
@ -227,7 +227,7 @@ describe Hbc::Artifact::Uninstall do
|
||||
let(:unix_pids) { [12_345, 67_890] }
|
||||
let(:get_unix_pids_script) {
|
||||
'tell application "System Events" to get the unix id of every process ' +
|
||||
%Q{whose bundle identifier is "#{bundle_id}"}
|
||||
%Q(whose bundle identifier is "#{bundle_id}")
|
||||
}
|
||||
|
||||
it "can uninstall" do
|
||||
|
||||
@ -202,10 +202,10 @@ describe Hbc::Artifact::Zap do
|
||||
let(:bundle_id) { "my.fancy.package.app" }
|
||||
let(:count_processes_script) {
|
||||
'tell application "System Events" to count processes ' +
|
||||
%Q{whose bundle identifier is "#{bundle_id}"}
|
||||
%Q(whose bundle identifier is "#{bundle_id}")
|
||||
}
|
||||
let(:quit_application_script) {
|
||||
%Q{tell application id "#{bundle_id}" to quit}
|
||||
%Q(tell application id "#{bundle_id}" to quit)
|
||||
}
|
||||
|
||||
it "can zap" do
|
||||
@ -228,7 +228,7 @@ describe Hbc::Artifact::Zap do
|
||||
let(:unix_pids) { [12_345, 67_890] }
|
||||
let(:get_unix_pids_script) {
|
||||
'tell application "System Events" to get the unix id of every process ' +
|
||||
%Q{whose bundle identifier is "#{bundle_id}"}
|
||||
%Q(whose bundle identifier is "#{bundle_id}")
|
||||
}
|
||||
|
||||
it "can zap" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user