Skip to content
Snippets Groups Projects
Commit 3d3a03f7 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #950 from MikeMcQuaid/extend-rubocop

Fix Library/Homebrew/extend RuboCop warnings
parents e10234f6 b42f646c
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ module HomebrewArgvExtension
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)
opt_prefix = HOMEBREW_PREFIX.join("opt", rack.basename)
......@@ -79,7 +79,7 @@ module HomebrewArgvExtension
if (prefix = f.installed_prefix).directory?
Keg.new(prefix)
else
raise MultipleVersionsInstalledError.new(rack.basename)
raise MultipleVersionsInstalledError, rack.basename
end
end
rescue FormulaUnavailableError
......@@ -211,7 +211,7 @@ module HomebrewArgvExtension
# installation run.
def build_formula_from_source?(f)
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 }
end
......
......@@ -12,9 +12,9 @@ module SharedEnvExtension
include CompilerConstants
# @private
CC_FLAG_VARS = %w[CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS]
CC_FLAG_VARS = %w[CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS].freeze
# @private
FC_FLAG_VARS = %w[FCFLAGS FFLAGS]
FC_FLAG_VARS = %w[FCFLAGS FFLAGS].freeze
# @private
SANITIZED_VARS = %w[
CDPATH GREP_OPTIONS CLICOLOR_FORCE
......@@ -25,7 +25,7 @@ module SharedEnvExtension
CMAKE_PREFIX_PATH CMAKE_INCLUDE_PATH CMAKE_FRAMEWORK_PATH
GOBIN GOPATH GOROOT PERL_MB_OPT PERL_MM_OPT
LIBRARY_PATH
]
].freeze
# @private
def setup_build_environment(formula = nil)
......@@ -193,13 +193,19 @@ module SharedEnvExtension
def userpaths!
paths = self["PATH"].split(File::PATH_SEPARATOR)
# 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.
new_paths << "#{HOMEBREW_PREFIX}/bin"
# reset of self["PATH"]
new_paths += 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)
end
......
......@@ -7,8 +7,8 @@ module Stdenv
include SharedEnvExtension
# @private
SAFE_CFLAGS_FLAGS = "-w -pipe"
DEFAULT_FLAGS = "-march=core2 -msse4"
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
DEFAULT_FLAGS = "-march=core2 -msse4".freeze
def self.extended(base)
unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/"bin"
......
......@@ -183,7 +183,7 @@ module Superenv
end
def determine_dependencies
deps.map {|d| d.name}.join(",")
deps.map(&:name).join(",")
end
def determine_cmake_prefix_path
......
......@@ -60,10 +60,10 @@ module FileUtils
# > When a new file is created, it is given the group of the directory which
# contains it.
group_id = if HOMEBREW_BREW_FILE.grpowned?
HOMEBREW_BREW_FILE.stat.gid
else
Process.gid
end
HOMEBREW_BREW_FILE.stat.gid
else
Process.gid
end
begin
chown(nil, group_id, tmpdir)
rescue Errno::EPERM
......
......@@ -24,10 +24,10 @@ class DevelopmentTools
def installation_instructions
if MacOS.version >= "10.9"
<<-EOS.undent
Install the Command Line Tools:
xcode-select --install
EOS
<<-EOS.undent
Install the Command Line Tools:
xcode-select --install
EOS
elsif MacOS.version == "10.8" || MacOS.version == "10.7"
<<-EOS.undent
Install the Command Line Tools from
......
......@@ -20,7 +20,7 @@ module DiskUsageExtension
out = ""
compute_disk_usage
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
private
......@@ -153,7 +153,7 @@ class Pathname
end unless method_defined?(:binwrite)
def binread(*open_args)
open("rb", *open_args) { |f| f.read }
open("rb", *open_args, &:read)
end unless method_defined?(:binread)
# NOTE always overwrites
......@@ -196,7 +196,7 @@ class Pathname
# @private
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)
......@@ -295,7 +295,7 @@ class Pathname
# @private
def text_executable?
/^#!\s*\S+/ === open("r") { |f| f.read(1024) }
/^#!\s*\S+/ =~ open("r") { |f| f.read(1024) }
end
# @private
......@@ -334,7 +334,7 @@ class Pathname
# @private
def resolved_path
self.symlink? ? dirname+readlink : self
symlink? ? dirname+readlink : self
end
# @private
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment