Skip to content

Commit

Permalink
(maint) - Add deep_merge gem dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Jan 26, 2024
1 parent 705fdee commit 05d0f65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 1 addition & 8 deletions lib/rspec-puppet-facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'facter'
require 'facterdb'
require 'json'
require 'deep_merge'

# The purpose of this module is to simplify the Puppet
# module's RSpec tests by looping through all supported
Expand Down Expand Up @@ -411,11 +412,3 @@ def self.facter_version_for_puppet_version(puppet_version)
:default => RspecPuppetFacts.facter_version_for_puppet_version(Puppet.version)
c.add_setting :facterdb_string_keys, :default => false
end

# monkey patch the Hash Class to add deep_merge
class ::Hash
def deep_merge(second)
merger = proc { |_, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : Array === v1 && Array === v2 ? v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2 }
merge(second.to_h, &merger)
end
end
1 change: 1 addition & 0 deletions rspec-puppet-facts.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'voxpupuli-rubocop', '~> 2.0'

s.add_runtime_dependency 'deep_merge', '~> 1.2'
s.add_runtime_dependency 'facter'
s.add_runtime_dependency 'facterdb', '>= 0.5.0'
s.add_runtime_dependency 'puppet'
Expand Down

0 comments on commit 05d0f65

Please sign in to comment.