cmd/update-report: fix Rubocop warnings.

This commit is contained in:
Mike McQuaid 2016-09-10 10:24:57 +01:00
parent 49e009df29
commit cc526601cf

View File

@ -134,13 +134,13 @@ module Homebrew
world_writable = legacy_cache.stat.mode & 0777 == 0777 world_writable = legacy_cache.stat.mode & 0777 == 0777
return if world_writable return if world_writable
return if legacy_cache.symlink? return if legacy_cache.symlink?
return if !legacy_cache.owned? && legacy_cache.lstat.uid != 0 return if !legacy_cache.owned? && legacy_cache.lstat.uid.nonzero?
ohai "Migrating #{legacy_cache} to #{HOMEBREW_CACHE}..." ohai "Migrating #{legacy_cache} to #{HOMEBREW_CACHE}..."
HOMEBREW_CACHE.mkpath HOMEBREW_CACHE.mkpath
legacy_cache.cd do legacy_cache.cd do
legacy_cache.entries.each do |f| legacy_cache.entries.each do |f|
next if [".", "..", ".migration_attempted"].include? "#{f}" next if [".", "..", ".migration_attempted"].include? f.to_s
begin begin
FileUtils.cp_r f, HOMEBREW_CACHE FileUtils.cp_r f, HOMEBREW_CACHE
rescue rescue
@ -173,7 +173,7 @@ module Homebrew
link_src_dst_dirs(HOMEBREW_REPOSITORY/"etc/bash_completion.d", link_src_dst_dirs(HOMEBREW_REPOSITORY/"etc/bash_completion.d",
HOMEBREW_PREFIX/"etc/bash_completion.d", command) HOMEBREW_PREFIX/"etc/bash_completion.d", command)
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/doc/homebrew", link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/doc/homebrew",
HOMEBREW_PREFIX/"share/doc/homebrew", command, link_dir: true) HOMEBREW_PREFIX/"share/doc/homebrew", command, :link_dir => true)
link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/zsh/site-functions", link_src_dst_dirs(HOMEBREW_REPOSITORY/"share/zsh/site-functions",
HOMEBREW_PREFIX/"share/zsh/site-functions", command) HOMEBREW_PREFIX/"share/zsh/site-functions", command)
link_path_manpages(HOMEBREW_REPOSITORY/"share", command) link_path_manpages(HOMEBREW_REPOSITORY/"share", command)
@ -359,10 +359,10 @@ class Reporter
private private
def repo_var def repo_var
@repo_var ||= tap.path.to_s. @repo_var ||= tap.path.to_s
strip_prefix(Tap::TAP_DIRECTORY.to_s). .strip_prefix(Tap::TAP_DIRECTORY.to_s)
tr("^A-Za-z0-9", "_"). .tr("^A-Za-z0-9", "_")
upcase .upcase
end end
def diff def diff
@ -387,7 +387,7 @@ class ReporterHub
def add(reporter) def add(reporter)
@reporters << reporter @reporters << reporter
report = reporter.report.delete_if { |k,v| v.empty? } report = reporter.report.delete_if { |_k, v| v.empty? }
@hash.update(report) { |_key, oldval, newval| oldval.concat(newval) } @hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
end end