Merge pull request #926 from MikeMcQuaid/os-rubocop

Fix Library/Homebrew/os* RuboCop warnings
This commit is contained in:
Mike McQuaid 2016-09-11 19:11:50 +01:00 committed by GitHub
commit 2b45ae4831
8 changed files with 66 additions and 67 deletions

View File

@ -200,7 +200,7 @@ module OS
"7.3" => { :clang => "7.3", :clang_build => 703 }, "7.3" => { :clang => "7.3", :clang_build => 703 },
"7.3.1" => { :clang => "7.3", :clang_build => 703 }, "7.3.1" => { :clang => "7.3", :clang_build => 703 },
"8.0" => { :clang => "8.0", :clang_build => 800 }, "8.0" => { :clang => "8.0", :clang_build => 800 },
} }.freeze
def compilers_standard? def compilers_standard?
STANDARD_COMPILERS.fetch(Xcode.version.to_s).all? do |method, build| STANDARD_COMPILERS.fetch(Xcode.version.to_s).all? do |method, build|

View File

@ -28,7 +28,7 @@ module ArchitectureListExtension
end end
def ppc? def ppc?
(Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| self.include? a } (Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| include? a }
end end
# @private # @private
@ -48,7 +48,7 @@ module ArchitectureListExtension
def intersects_all?(*set) def intersects_all?(*set)
set.all? do |archset| set.all? do |archset|
archset.any? { |a| self.include? a } archset.any? { |a| include? a }
end end
end end
end end

View File

@ -73,7 +73,7 @@ module CctoolsMachO
id = libs.shift[OTOOL_RX, 1] if path.dylib? id = libs.shift[OTOOL_RX, 1] if path.dylib?
libs.map! { |lib| lib[OTOOL_RX, 1] }.compact! libs.map! { |lib| lib[OTOOL_RX, 1] }.compact!
return id, libs [id, libs]
end end
end end

View File

@ -64,7 +64,7 @@ class LinkageChecker
next false if name == formula.name next false if name == formula.name
!declared_dep_names.include?(name) !declared_dep_names.include?(name)
end end
undeclared_deps.sort do |a,b| undeclared_deps.sort do |a, b|
if a.include?("/") && !b.include?("/") if a.include?("/") && !b.include?("/")
1 1
elsif !a.include?("/") && b.include?("/") elsif !a.include?("/") && b.include?("/")

View File

@ -24,7 +24,7 @@ module OS
def latest_sdk def latest_sdk
return if sdk_paths.empty? return if sdk_paths.empty?
v, path = sdk_paths.max {|a, b| OS::Mac::Version.new(a[0]) <=> OS::Mac::Version.new(b[0])} v, path = sdk_paths.max { |a, b| OS::Mac::Version.new(a[0]) <=> OS::Mac::Version.new(b[0]) }
SDK.new v, path SDK.new v, path
end end

View File

@ -12,8 +12,8 @@ module OS
:lion => "10.7", :lion => "10.7",
:snow_leopard => "10.6", :snow_leopard => "10.6",
:leopard => "10.5", :leopard => "10.5",
:tiger => "10.4" :tiger => "10.4",
} }.freeze
def self.from_symbol(sym) def self.from_symbol(sym)
str = SYMBOLS.fetch(sym) do str = SYMBOLS.fetch(sym) do

View File

@ -3,8 +3,8 @@ module OS
module Xcode module Xcode
extend self extend self
V4_BUNDLE_ID = "com.apple.dt.Xcode" V4_BUNDLE_ID = "com.apple.dt.Xcode".freeze
V3_BUNDLE_ID = "com.apple.Xcode" V3_BUNDLE_ID = "com.apple.Xcode".freeze
def latest_version def latest_version
case MacOS.version case MacOS.version
@ -104,7 +104,7 @@ module OS
#{prefix}/usr/bin/xcodebuild #{prefix}/usr/bin/xcodebuild
#{which("xcodebuild")} #{which("xcodebuild")}
].uniq.each do |xcodebuild_path| ].uniq.each do |xcodebuild_path|
if File.executable? xcodebuild_path next unless File.executable? xcodebuild_path
xcodebuild_output = Utils.popen_read(xcodebuild_path, "-version") xcodebuild_output = Utils.popen_read(xcodebuild_path, "-version")
next unless $?.success? next unless $?.success?
@ -117,7 +117,6 @@ module OS
when "798.0" then return "2.5" when "798.0" then return "2.5"
end end
end end
end
# The remaining logic provides a fake Xcode version for CLT-only # The remaining logic provides a fake Xcode version for CLT-only
# systems. This behavior only exists because Homebrew used to assume # systems. This behavior only exists because Homebrew used to assume
@ -167,11 +166,11 @@ module OS
module CLT module CLT
extend self extend self
STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo".freeze
FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI".freeze
MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze
MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base" # obsolete MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete
MAVERICKS_PKG_PATH = "/Library/Developer/CommandLineTools" MAVERICKS_PKG_PATH = "/Library/Developer/CommandLineTools".freeze
# Returns true even if outdated tools are installed, e.g. # Returns true even if outdated tools are installed, e.g.
# tools from Xcode 4.x on 10.9 # tools from Xcode 4.x on 10.9

View File

@ -5,9 +5,9 @@ module OS
module XQuartz module XQuartz
extend self extend self
FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11".freeze
APPLE_BUNDLE_ID = "org.x.X11" APPLE_BUNDLE_ID = "org.x.X11".freeze
FORGE_PKG_ID = "org.macosforge.xquartz.pkg" FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze
PKGINFO_VERSION_MAP = { PKGINFO_VERSION_MAP = {
"2.6.34" => "2.6.3", "2.6.34" => "2.6.3",