Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Jan 13, 2024
1 parent c678491 commit 07f98a9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
!**/vendor/bundle/ruby/*/gems/*/lib
!**/vendor/bundle/ruby/*/gems/addressable-*/data
!**/vendor/bundle/ruby/*/gems/public_suffix-*/data
!**/vendor/bundle/ruby/*/gems/rubocop-performance-*/config
!**/vendor/bundle/ruby/*/gems/rubocop-rails-*/config
!**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/config
!**/vendor/bundle/ruby/*/gems/rubocop-sorbet-*/config
!**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/

# Ignore partially included gems where we don't need all files
**/vendor/gems/mechanize-*/.*
Expand Down Expand Up @@ -138,6 +133,7 @@
**/vendor/bundle/ruby/*/gems/simplecov_json_formatter-*/
**/vendor/bundle/ruby/*/gems/simpleidn-*/
**/vendor/bundle/ruby/*/gems/sorbet-*/
!**/vendor/bundle/ruby/*/gems/sorbet-runtime-*/
**/vendor/bundle/ruby/*/gems/spoom-*/
**/vendor/bundle/ruby/*/gems/stackprof-*/
**/vendor/bundle/ruby/*/gems/strscan-*/
Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/extend/hash/deep_merge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Hash
# h2 = { b: 250, c: { c1: 200 } }
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
# # => { a: 100, b: 450, c: { c1: 300 } }
def deep_merge(other_hash, &block) = dup.deep_merge!(other_hash, &block)
def deep_merge(other_hash, &block)
dup.deep_merge!(other_hash, &block)
end

# Same as +deep_merge+, but modifies +self+.
def deep_merge!(other_hash, &block)
Expand Down
8 changes: 6 additions & 2 deletions Library/Homebrew/extend/object/deep_dup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Object
# object.instance_variable_defined?(:@a) # => false
# dup.instance_variable_defined?(:@a) # => true
sig { returns(T.self_type) }
def deep_dup = duplicable? ? dup : self
def deep_dup
duplicable? ? dup : self
end
end

class Array
Expand All @@ -27,7 +29,9 @@ class Array
# array[1][2] # => nil
# dup[1][2] # => 4
sig { returns(T.self_type) }
def deep_dup = T.unsafe(self).map(&:deep_dup)
def deep_dup
T.unsafe(self).map(&:deep_dup)
end
end

class Hash
Expand Down
9 changes: 5 additions & 4 deletions Library/Homebrew/global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
require "forwardable"
require "set"

require "extend/array"
require "extend/blank"
require "extend/enumerable"
require "extend/string"

HOMEBREW_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_DEFAULT_DOMAIN").freeze
HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV.fetch("HOMEBREW_BREW_DEFAULT_GIT_REMOTE").freeze
Expand Down Expand Up @@ -61,10 +66,6 @@
%r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze
HOMEBREW_BOTTLES_EXTNAME_REGEX = /\.([a-z0-9_]+)\.bottle\.(?:(\d+)\.)?tar\.gz$/.freeze

require "extend/array"
require "extend/blank"
require "extend/enumerable"
require "extend/string"
require "env_config"
require "macos_version"
require "os"
Expand Down

0 comments on commit 07f98a9

Please sign in to comment.