Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Jan 19, 2024
1 parent cc2750d commit b1820b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Library/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ Style/InverseMethods:
- "Homebrew/rubocops/**/*.rb"
- "Homebrew/sorbet/tapioca/require.rb"
- "Homebrew/standalone/init.rb"
- "Homebrew/utils/gems.rb"
InverseMethods:
:include?: :exclude?
:exclude?: :include?
Expand All @@ -369,6 +370,7 @@ Style/InvertibleUnlessCondition:
- "Homebrew/rubocops/**/*.rb"
- "Homebrew/sorbet/tapioca/require.rb"
- "Homebrew/standalone/init.rb"
- "Homebrew/utils/gems.rb"
InverseMethods:
# Favor `if a != b` over `unless a == b`
:==: :!=
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/utils/gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def setup_gem_environment!(setup_path: true)

# Add necessary Ruby and Gem binary directories to `PATH`.
paths = ENV.fetch("PATH").split(":")
paths.unshift(ruby_bindir) if paths.exclude?(ruby_bindir)
paths.unshift(Gem.bindir) if paths.exclude?(Gem.bindir)
paths.unshift(ruby_bindir) unless paths.include?(ruby_bindir)
paths.unshift(Gem.bindir) unless paths.include?(Gem.bindir)
ENV["PATH"] = paths.compact.join(":")

# Set envs so the above binaries can be invoked.
Expand Down Expand Up @@ -135,7 +135,7 @@ def install_gem!(name, version: nil, setup_gem_environment: true)
specs.each do |spec|
spec.require_paths.each do |path|
full_path = File.join(spec.full_gem_path, path)
$LOAD_PATH.unshift full_path if $LOAD_PATH.exclude?(full_path)
$LOAD_PATH.unshift full_path unless $LOAD_PATH.include?(full_path)
end
end
rescue Gem::UnsatisfiableDependencyError
Expand Down

0 comments on commit b1820b7

Please sign in to comment.