aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/.rubocop.yml5
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb12
-rw-r--r--Library/Homebrew/cask/lib/hbc/auditor.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask_dependencies.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/cleanup.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/dmg.rb12
-rw-r--r--Library/Homebrew/cask/lib/hbc/download_strategy.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb8
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/locations.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/pkg.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/scopes.rb16
-rw-r--r--Library/Homebrew/cask/lib/hbc/source.rb4
-rw-r--r--Library/Homebrew/cask/lib/hbc/system_command.rb4
15 files changed, 47 insertions, 46 deletions
diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml
index a6485dca4..a85f0dcab 100644
--- a/Library/Homebrew/.rubocop.yml
+++ b/Library/Homebrew/.rubocop.yml
@@ -9,6 +9,11 @@ AllCops:
- '**/Casks/**/*'
- '**/vendor/**/*'
+Style/BlockDelimiters:
+ Exclude:
+ - '**/cask/spec/**/*'
+ - '**/cask/test/**/*'
+
# so many of these in formulae but none in here
Lint/AmbiguousRegexpLiteral:
Enabled: true
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
index b780d4662..e76561e92 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb
@@ -28,15 +28,15 @@ module Hbc
# sources and should be refactored for consistency
def self.expand_path_strings(path_strings)
- path_strings.map { |path_string|
+ path_strings.map do |path_string|
path_string.start_with?("~") ? Pathname.new(path_string).expand_path : Pathname.new(path_string)
- }
+ end
end
def self.remove_relative_path_strings(action, path_strings)
- relative = path_strings.map { |path_string|
+ relative = path_strings.map do |path_string|
path_string if %r{/\.\.(?:/|\Z)}.match(path_string) || !%r{\A/}.match(path_string)
- }.compact
+ end.compact
relative.each do |path_string|
opoo "Skipping #{action} for relative path #{path_string}"
end
@@ -44,9 +44,9 @@ module Hbc
end
def self.remove_undeletable_path_strings(action, path_strings)
- undeletable = path_strings.map { |path_string|
+ undeletable = path_strings.map do |path_string|
path_string if MacOS.undeletable?(Pathname.new(path_string))
- }.compact
+ end.compact
undeletable.each do |path_string|
opoo "Skipping #{action} for undeletable path #{path_string}"
end
diff --git a/Library/Homebrew/cask/lib/hbc/auditor.rb b/Library/Homebrew/cask/lib/hbc/auditor.rb
index a02476ccb..e2d5dea0e 100644
--- a/Library/Homebrew/cask/lib/hbc/auditor.rb
+++ b/Library/Homebrew/cask/lib/hbc/auditor.rb
@@ -6,12 +6,12 @@ module Hbc
begin
saved_languages = MacOS.instance_variable_get(:@languages)
- languages_blocks.keys.map { |languages|
+ languages_blocks.keys.map do |languages|
ohai "Auditing language: #{languages.map { |lang| "'#{lang}'" }.join(", ")}"
MacOS.instance_variable_set(:@languages, languages)
audit_cask_instance(Hbc.load(cask.sourcefile_path), audit_download, check_token_conflicts)
CLI::Cleanup.run(cask.token) if audit_download
- }.all?
+ end.all?
ensure
MacOS.instance_variable_set(:@languages, saved_languages)
end
diff --git a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
index 4b4f042d8..fe5d1b743 100644
--- a/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
+++ b/Library/Homebrew/cask/lib/hbc/cask_dependencies.rb
@@ -12,7 +12,7 @@ module Hbc
def graph_dependencies
deps_in = ->(csk) { csk.depends_on ? csk.depends_on.cask || [] : [] }
- walk = lambda { |acc, deps|
+ walk = lambda do |acc, deps|
deps.each do |dep|
next if acc.key?(dep)
succs = deps_in.call Hbc.load(dep)
@@ -20,7 +20,7 @@ module Hbc
walk.call(acc, succs)
end
acc
- }
+ end
graphed = walk.call({}, @cask.depends_on.cask)
TopologicalHash[graphed]
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
index e65ee422d..2273280b9 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -76,9 +76,9 @@ module Hbc
else
start_withs = tokens.map { |token| "#{token}--" }
- cache_files.select { |path|
+ cache_files.select do |path|
path.basename.to_s.start_with?(*start_withs)
- }
+ end
end
delete_paths(deletable_cache_files)
diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
index 4e2c4e1e3..987455ad7 100644
--- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb
@@ -78,12 +78,12 @@ module Hbc
end
def bom_filelist_from_path(mount)
- Dir.chdir(mount) {
- Dir.glob("**/*", File::FNM_DOTMATCH).map { |path|
+ Dir.chdir(mount) do
+ Dir.glob("**/*", File::FNM_DOTMATCH).map do |path|
next if skip_path?(Pathname(path))
path == "." ? path : path.prepend("./")
- }.compact.join("\n").concat("\n")
- }
+ end.compact.join("\n").concat("\n")
+ end
end
def skip_path?(path)
@@ -117,9 +117,7 @@ module Hbc
def mounts_from_plist(plist)
return [] unless plist.respond_to?(:fetch)
- plist.fetch("system-entities", []).map { |entity|
- entity["mount-point"]
- }.compact
+ plist.fetch("system-entities", []).map { |e| e["mount-point"] }.compact
end
def assert_mounts_found
diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
index 1d22e2ed2..4a601af2b 100644
--- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb
+++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb
@@ -40,9 +40,9 @@ module Hbc
end
def extract_ref
- key = REF_TYPES.find { |type|
+ key = REF_TYPES.find do |type|
uri_object.respond_to?(type) && uri_object.send(type)
- }
+ end
[key, key ? uri_object.send(key) : nil]
end
diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb
index a955da216..1a8bbe3a0 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -123,9 +123,9 @@ module Hbc
end
MacOS.languages.map(&Locale.method(:parse)).each do |locale|
- key = @language_blocks.keys.detect { |strings|
+ key = @language_blocks.keys.detect do |strings|
strings.any? { |string| locale.include?(string) }
- }
+ end
next if key.nil?
diff --git a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
index 5a17c09f2..8e120d8a8 100644
--- a/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
+++ b/Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb
@@ -93,19 +93,17 @@ module Hbc
[[operator, release]]
else
raise "'depends_on macos' comparison expressions cannot be combined" if @macos.first.is_a?(Symbol)
- Array(*arg).map { |elt|
- self.class.coerce_os_release(elt)
- }.sort
+ [*arg].map(&self.class.method(:coerce_os_release)).sort
end
@macos.concat(macos)
end
def arch=(*arg)
@arch ||= []
- arches = Array(*arg).map { |elt|
+ arches = Array(*arg).map do |elt|
elt = elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
ARCH_SYNONYMS.key?(elt) ? ARCH_SYNONYMS[elt] : elt
- }
+ end
invalid_arches = arches - VALID_ARCHES.keys
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty?
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 171405fa1..0c50e3757 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -171,10 +171,10 @@ module Hbc
def arch_dependencies
return if @cask.depends_on.arch.nil?
@current_arch ||= { type: Hardware::CPU.type, bits: Hardware::CPU.bits }
- return if @cask.depends_on.arch.any? { |arch|
+ return if @cask.depends_on.arch.any? do |arch|
arch[:type] == @current_arch[:type] &&
Array(arch[:bits]).include?(@current_arch[:bits])
- }
+ end
raise CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(", ")}], but you are running #{@current_arch}"
end
diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb
index a7757aea4..40933911d 100644
--- a/Library/Homebrew/cask/lib/hbc/locations.rb
+++ b/Library/Homebrew/cask/lib/hbc/locations.rb
@@ -141,9 +141,9 @@ module Hbc
token_with_tap = if query =~ %r{\A[^/]+/[^/]+/[^/]+\Z}
query_without_extension
else
- all_tokens.detect { |tap_and_token|
+ all_tokens.detect do |tap_and_token|
tap_and_token.split("/")[2] == query_without_extension
- }
+ end
end
if token_with_tap
diff --git a/Library/Homebrew/cask/lib/hbc/pkg.rb b/Library/Homebrew/cask/lib/hbc/pkg.rb
index 7d4a9251a..eacd5157e 100644
--- a/Library/Homebrew/cask/lib/hbc/pkg.rb
+++ b/Library/Homebrew/cask/lib/hbc/pkg.rb
@@ -1,9 +1,9 @@
module Hbc
class Pkg
def self.all_matching(regexp, command)
- command.run("/usr/sbin/pkgutil", args: ["--pkgs=#{regexp}"]).stdout.split("\n").map { |package_id|
+ command.run("/usr/sbin/pkgutil", args: ["--pkgs=#{regexp}"]).stdout.split("\n").map do |package_id|
new(package_id.chomp, command)
- }
+ end
end
attr_reader :package_id
diff --git a/Library/Homebrew/cask/lib/hbc/scopes.rb b/Library/Homebrew/cask/lib/hbc/scopes.rb
index 8520028c9..aa870eec5 100644
--- a/Library/Homebrew/cask/lib/hbc/scopes.rb
+++ b/Library/Homebrew/cask/lib/hbc/scopes.rb
@@ -15,11 +15,11 @@ module Hbc
end
def all_tokens
- Tap.map { |t|
- t.cask_files.map { |p|
+ Tap.map do |t|
+ t.cask_files.map do |p|
"#{t.name}/#{File.basename(p, ".rb")}"
- }
- }.flatten
+ end
+ end.flatten
end
def installed
@@ -28,19 +28,19 @@ module Hbc
# TODO: speed up Hbc::Source::Tapped (main perf drag is calling Hbc.all_tokens repeatedly)
# TODO: ability to specify expected source when calling Hbc.load (minor perf benefit)
Pathname.glob(caskroom.join("*"))
- .map { |caskroom_path|
+ .map do |caskroom_path|
token = caskroom_path.basename.to_s
- path_to_cask = all_tapped_cask_dirs.find { |tap_dir|
+ path_to_cask = all_tapped_cask_dirs.find do |tap_dir|
tap_dir.join("#{token}.rb").exist?
- }
+ end
if path_to_cask
Hbc.load(path_to_cask.join("#{token}.rb"))
else
Hbc.load(token)
end
- }
+ end
end
end
end
diff --git a/Library/Homebrew/cask/lib/hbc/source.rb b/Library/Homebrew/cask/lib/hbc/source.rb
index ae1fdaf8a..5f2e9ddfe 100644
--- a/Library/Homebrew/cask/lib/hbc/source.rb
+++ b/Library/Homebrew/cask/lib/hbc/source.rb
@@ -23,10 +23,10 @@ module Hbc
def self.for_query(query)
odebug "Translating '#{query}' into a valid Cask source"
raise CaskUnavailableError, query if query.to_s =~ /^\s*$/
- source = sources.find { |s|
+ source = sources.find do |s|
odebug "Testing source class #{s}"
s.me?(query)
- }
+ end
raise CaskUnavailableError, query unless source
odebug "Success! Using source class #{source}"
resolved_cask_source = source.new(query)
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb
index 41fa924f9..de544f1b7 100644
--- a/Library/Homebrew/cask/lib/hbc/system_command.rb
+++ b/Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -66,13 +66,13 @@ module Hbc
end
def expanded_command
- @expanded_command ||= command.map { |arg|
+ @expanded_command ||= command.map do |arg|
if arg.respond_to?(:to_path)
File.absolute_path(arg)
else
String(arg)
end
- }
+ end
end
def each_output_line(&b)