Merge pull request #950 from MikeMcQuaid/extend-rubocop
Fix Library/Homebrew/extend RuboCop warnings
This commit is contained in:
commit
3d3a03f75a
@ -57,7 +57,7 @@ module HomebrewArgvExtension
|
|||||||
|
|
||||||
dirs = rack.directory? ? rack.subdirs : []
|
dirs = rack.directory? ? rack.subdirs : []
|
||||||
|
|
||||||
raise NoSuchKegError.new(rack.basename) if dirs.empty?
|
raise NoSuchKegError, rack.basename if dirs.empty?
|
||||||
|
|
||||||
linked_keg_ref = HOMEBREW_LIBRARY.join("LinkedKegs", rack.basename)
|
linked_keg_ref = HOMEBREW_LIBRARY.join("LinkedKegs", rack.basename)
|
||||||
opt_prefix = HOMEBREW_PREFIX.join("opt", rack.basename)
|
opt_prefix = HOMEBREW_PREFIX.join("opt", rack.basename)
|
||||||
@ -79,7 +79,7 @@ module HomebrewArgvExtension
|
|||||||
if (prefix = f.installed_prefix).directory?
|
if (prefix = f.installed_prefix).directory?
|
||||||
Keg.new(prefix)
|
Keg.new(prefix)
|
||||||
else
|
else
|
||||||
raise MultipleVersionsInstalledError.new(rack.basename)
|
raise MultipleVersionsInstalledError, rack.basename
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
@ -211,7 +211,7 @@ module HomebrewArgvExtension
|
|||||||
# installation run.
|
# installation run.
|
||||||
def build_formula_from_source?(f)
|
def build_formula_from_source?(f)
|
||||||
return true if build_all_from_source?
|
return true if build_all_from_source?
|
||||||
return false unless (build_from_source? || build_bottle?)
|
return false unless build_from_source? || build_bottle?
|
||||||
formulae.any? { |argv_f| argv_f.full_name == f.full_name }
|
formulae.any? { |argv_f| argv_f.full_name == f.full_name }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,9 @@ module SharedEnvExtension
|
|||||||
include CompilerConstants
|
include CompilerConstants
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
CC_FLAG_VARS = %w[CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS]
|
CC_FLAG_VARS = %w[CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS].freeze
|
||||||
# @private
|
# @private
|
||||||
FC_FLAG_VARS = %w[FCFLAGS FFLAGS]
|
FC_FLAG_VARS = %w[FCFLAGS FFLAGS].freeze
|
||||||
# @private
|
# @private
|
||||||
SANITIZED_VARS = %w[
|
SANITIZED_VARS = %w[
|
||||||
CDPATH GREP_OPTIONS CLICOLOR_FORCE
|
CDPATH GREP_OPTIONS CLICOLOR_FORCE
|
||||||
@ -25,7 +25,7 @@ module SharedEnvExtension
|
|||||||
CMAKE_PREFIX_PATH CMAKE_INCLUDE_PATH CMAKE_FRAMEWORK_PATH
|
CMAKE_PREFIX_PATH CMAKE_INCLUDE_PATH CMAKE_FRAMEWORK_PATH
|
||||||
GOBIN GOPATH GOROOT PERL_MB_OPT PERL_MM_OPT
|
GOBIN GOPATH GOROOT PERL_MB_OPT PERL_MM_OPT
|
||||||
LIBRARY_PATH
|
LIBRARY_PATH
|
||||||
]
|
].freeze
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def setup_build_environment(formula = nil)
|
def setup_build_environment(formula = nil)
|
||||||
@ -193,13 +193,19 @@ module SharedEnvExtension
|
|||||||
def userpaths!
|
def userpaths!
|
||||||
paths = self["PATH"].split(File::PATH_SEPARATOR)
|
paths = self["PATH"].split(File::PATH_SEPARATOR)
|
||||||
# put Superenv.bin and opt path at the first
|
# put Superenv.bin and opt path at the first
|
||||||
new_paths = paths.select { |p| p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV") || p.start_with?("#{HOMEBREW_PREFIX}/opt") }
|
new_paths = paths.select { |p| p.start_with?("#{HOMEBREW_REPOSITORY}/Library/ENV", "#{HOMEBREW_PREFIX}/opt") }
|
||||||
# XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin.
|
# XXX hot fix to prefer brewed stuff (e.g. python) over /usr/bin.
|
||||||
new_paths << "#{HOMEBREW_PREFIX}/bin"
|
new_paths << "#{HOMEBREW_PREFIX}/bin"
|
||||||
# reset of self["PATH"]
|
# reset of self["PATH"]
|
||||||
new_paths += paths
|
new_paths += paths
|
||||||
# user paths
|
# user paths
|
||||||
new_paths += ORIGINAL_PATHS.map { |p| p.realpath.to_s rescue nil } - %w[/usr/X11/bin /opt/X11/bin]
|
new_paths += ORIGINAL_PATHS.map do |p|
|
||||||
|
begin
|
||||||
|
p.realpath.to_s
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end - %w[/usr/X11/bin /opt/X11/bin]
|
||||||
self["PATH"] = new_paths.uniq.join(File::PATH_SEPARATOR)
|
self["PATH"] = new_paths.uniq.join(File::PATH_SEPARATOR)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -7,8 +7,8 @@ module Stdenv
|
|||||||
include SharedEnvExtension
|
include SharedEnvExtension
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
SAFE_CFLAGS_FLAGS = "-w -pipe"
|
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
|
||||||
DEFAULT_FLAGS = "-march=core2 -msse4"
|
DEFAULT_FLAGS = "-march=core2 -msse4".freeze
|
||||||
|
|
||||||
def self.extended(base)
|
def self.extended(base)
|
||||||
unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"
|
unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"
|
||||||
|
|||||||
@ -183,7 +183,7 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def determine_dependencies
|
def determine_dependencies
|
||||||
deps.map {|d| d.name}.join(",")
|
deps.map(&:name).join(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
def determine_cmake_prefix_path
|
def determine_cmake_prefix_path
|
||||||
|
|||||||
@ -20,7 +20,7 @@ module DiskUsageExtension
|
|||||||
out = ""
|
out = ""
|
||||||
compute_disk_usage
|
compute_disk_usage
|
||||||
out << "#{number_readable(@file_count)} files, " if @file_count > 1
|
out << "#{number_readable(@file_count)} files, " if @file_count > 1
|
||||||
out << "#{disk_usage_readable(@disk_usage)}"
|
out << disk_usage_readable(@disk_usage).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -153,7 +153,7 @@ class Pathname
|
|||||||
end unless method_defined?(:binwrite)
|
end unless method_defined?(:binwrite)
|
||||||
|
|
||||||
def binread(*open_args)
|
def binread(*open_args)
|
||||||
open("rb", *open_args) { |f| f.read }
|
open("rb", *open_args, &:read)
|
||||||
end unless method_defined?(:binread)
|
end unless method_defined?(:binread)
|
||||||
|
|
||||||
# NOTE always overwrites
|
# NOTE always overwrites
|
||||||
@ -196,7 +196,7 @@ class Pathname
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def cp_path_sub(pattern, replacement)
|
def cp_path_sub(pattern, replacement)
|
||||||
raise "#{self} does not exist" unless self.exist?
|
raise "#{self} does not exist" unless exist?
|
||||||
|
|
||||||
dst = sub(pattern, replacement)
|
dst = sub(pattern, replacement)
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ class Pathname
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def text_executable?
|
def text_executable?
|
||||||
/^#!\s*\S+/ === open("r") { |f| f.read(1024) }
|
/^#!\s*\S+/ =~ open("r") { |f| f.read(1024) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
@ -334,7 +334,7 @@ class Pathname
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def resolved_path
|
def resolved_path
|
||||||
self.symlink? ? dirname+readlink : self
|
symlink? ? dirname+readlink : self
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user