diff options
| author | Mike McQuaid | 2016-09-11 19:11:50 +0100 |
|---|---|---|
| committer | GitHub | 2016-09-11 19:11:50 +0100 |
| commit | 2b45ae483199d846b84fea4826b2a20fe74d1dbe (patch) | |
| tree | eb92ba14d61309094dc74ff0c3f08dfe56c0d434 /Library | |
| parent | 5eeba79c278cbca51aaad252b8bfddf5f377cd3c (diff) | |
| parent | caecead7a7157e51b4ff3989604816e087707895 (diff) | |
| download | brew-2b45ae483199d846b84fea4826b2a20fe74d1dbe.tar.bz2 | |
Merge pull request #926 from MikeMcQuaid/os-rubocop
Fix Library/Homebrew/os* RuboCop warnings
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/architecture_list.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/cctools_mach.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/linkage_checker.rb | 42 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/sdk.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/version.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xcode.rb | 71 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xquartz.rb | 6 |
8 files changed, 66 insertions, 67 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 6d5c81182..22e7305b9 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -200,7 +200,7 @@ module OS "7.3" => { :clang => "7.3", :clang_build => 703 }, "7.3.1" => { :clang => "7.3", :clang_build => 703 }, "8.0" => { :clang => "8.0", :clang_build => 800 }, - } + }.freeze def compilers_standard? STANDARD_COMPILERS.fetch(Xcode.version.to_s).all? do |method, build| diff --git a/Library/Homebrew/os/mac/architecture_list.rb b/Library/Homebrew/os/mac/architecture_list.rb index 964cfed0c..595c8f169 100644 --- a/Library/Homebrew/os/mac/architecture_list.rb +++ b/Library/Homebrew/os/mac/architecture_list.rb @@ -28,7 +28,7 @@ module ArchitectureListExtension end 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 # @private @@ -48,7 +48,7 @@ module ArchitectureListExtension def intersects_all?(*set) set.all? do |archset| - archset.any? { |a| self.include? a } + archset.any? { |a| include? a } end end end diff --git a/Library/Homebrew/os/mac/cctools_mach.rb b/Library/Homebrew/os/mac/cctools_mach.rb index 36f508d28..7e8f9a4d3 100644 --- a/Library/Homebrew/os/mac/cctools_mach.rb +++ b/Library/Homebrew/os/mac/cctools_mach.rb @@ -73,7 +73,7 @@ module CctoolsMachO id = libs.shift[OTOOL_RX, 1] if path.dylib? libs.map! { |lib| lib[OTOOL_RX, 1] }.compact! - return id, libs + [id, libs] end end diff --git a/Library/Homebrew/os/mac/linkage_checker.rb b/Library/Homebrew/os/mac/linkage_checker.rb index a992f3d10..e014e3816 100644 --- a/Library/Homebrew/os/mac/linkage_checker.rb +++ b/Library/Homebrew/os/mac/linkage_checker.rb @@ -51,28 +51,28 @@ class LinkageChecker end def check_undeclared_deps - filter_out = proc do |dep| - next true if dep.build? - next false unless dep.optional? || dep.recommended? - formula.build.without?(dep) - end - declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) - declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact - declared_dep_names = (declared_deps + declared_requirement_deps).map { |dep| dep.split("/").last } - undeclared_deps = @brewed_dylibs.keys.select do |full_name| - name = full_name.split("/").last - next false if name == formula.name - !declared_dep_names.include?(name) - end - undeclared_deps.sort do |a,b| - if a.include?("/") && !b.include?("/") - 1 - elsif !a.include?("/") && b.include?("/") - -1 - else - a <=> b - end + filter_out = proc do |dep| + next true if dep.build? + next false unless dep.optional? || dep.recommended? + formula.build.without?(dep) + end + declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) + declared_requirement_deps = formula.requirements.reject { |req| filter_out.call(req) }.map(&:default_formula).compact + declared_dep_names = (declared_deps + declared_requirement_deps).map { |dep| dep.split("/").last } + undeclared_deps = @brewed_dylibs.keys.select do |full_name| + name = full_name.split("/").last + next false if name == formula.name + !declared_dep_names.include?(name) + end + undeclared_deps.sort do |a, b| + if a.include?("/") && !b.include?("/") + 1 + elsif !a.include?("/") && b.include?("/") + -1 + else + a <=> b end + end end def display_normal_output diff --git a/Library/Homebrew/os/mac/sdk.rb b/Library/Homebrew/os/mac/sdk.rb index bb943bb34..a4eba815d 100644 --- a/Library/Homebrew/os/mac/sdk.rb +++ b/Library/Homebrew/os/mac/sdk.rb @@ -24,7 +24,7 @@ module OS def latest_sdk 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 end diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index f48e38d47..8d96bd3b9 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -12,8 +12,8 @@ module OS :lion => "10.7", :snow_leopard => "10.6", :leopard => "10.5", - :tiger => "10.4" - } + :tiger => "10.4", + }.freeze def self.from_symbol(sym) str = SYMBOLS.fetch(sym) do diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index b08e901cd..647515a17 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -3,8 +3,8 @@ module OS module Xcode extend self - V4_BUNDLE_ID = "com.apple.dt.Xcode" - V3_BUNDLE_ID = "com.apple.Xcode" + V4_BUNDLE_ID = "com.apple.dt.Xcode".freeze + V3_BUNDLE_ID = "com.apple.Xcode".freeze def latest_version case MacOS.version @@ -104,18 +104,17 @@ module OS #{prefix}/usr/bin/xcodebuild #{which("xcodebuild")} ].uniq.each do |xcodebuild_path| - if File.executable? xcodebuild_path - xcodebuild_output = Utils.popen_read(xcodebuild_path, "-version") - next unless $?.success? + next unless File.executable? xcodebuild_path + xcodebuild_output = Utils.popen_read(xcodebuild_path, "-version") + next unless $?.success? - xcode_version = xcodebuild_output[/Xcode (\d(\.\d)*)/, 1] - return xcode_version if xcode_version + xcode_version = xcodebuild_output[/Xcode (\d(\.\d)*)/, 1] + return xcode_version if xcode_version - # Xcode 2.x's xcodebuild has a different version string - case xcodebuild_output[/DevToolsCore-(\d+\.\d)/, 1] - when "515.0" then return "2.0" - when "798.0" then return "2.5" - end + # Xcode 2.x's xcodebuild has a different version string + case xcodebuild_output[/DevToolsCore-(\d+\.\d)/, 1] + when "515.0" then return "2.0" + when "798.0" then return "2.5" end end @@ -125,25 +124,25 @@ module OS # be removed in a future version. To remain compatible, guard usage of # Xcode.version with an Xcode.installed? check. case (DevelopmentTools.clang_version.to_f * 10).to_i - when 0 then "dunno" - when 1..14 then "3.2.2" - when 15 then "3.2.4" - when 16 then "3.2.5" - when 17..20 then "4.0" - when 21 then "4.1" - when 22..30 then "4.2" - when 31 then "4.3" - when 40 then "4.4" - when 41 then "4.5" - when 42 then "4.6" - when 50 then "5.0" - when 51 then "5.1" - when 60 then "6.0" - when 61 then "6.1" - when 70 then "7.0" - when 73 then "7.3" - when 80 then "8.0" - else "8.0" + when 0 then "dunno" + when 1..14 then "3.2.2" + when 15 then "3.2.4" + when 16 then "3.2.5" + when 17..20 then "4.0" + when 21 then "4.1" + when 22..30 then "4.2" + when 31 then "4.3" + when 40 then "4.4" + when 41 then "4.5" + when 42 then "4.6" + when 50 then "5.0" + when 51 then "5.1" + when 60 then "6.0" + when 61 then "6.1" + when 70 then "7.0" + when 73 then "7.3" + when 80 then "8.0" + else "8.0" end end @@ -167,11 +166,11 @@ module OS module CLT extend self - STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" - FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" - MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" - MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base" # obsolete - MAVERICKS_PKG_PATH = "/Library/Developer/CommandLineTools" + STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo".freeze + FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI".freeze + MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze + MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete + MAVERICKS_PKG_PATH = "/Library/Developer/CommandLineTools".freeze # Returns true even if outdated tools are installed, e.g. # tools from Xcode 4.x on 10.9 diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index dfb8afee7..9a610e29f 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -5,9 +5,9 @@ module OS module XQuartz extend self - FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" - APPLE_BUNDLE_ID = "org.x.X11" - FORGE_PKG_ID = "org.macosforge.xquartz.pkg" + FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11".freeze + APPLE_BUNDLE_ID = "org.x.X11".freeze + FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze PKGINFO_VERSION_MAP = { "2.6.34" => "2.6.3", |
