Hello community, here is the log from the commit of package rubygem-deep_merge for openSUSE:Factory checked in at 2016-08-05 18:16:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-deep_merge (Old) and /work/SRC/openSUSE:Factory/.rubygem-deep_merge.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-deep_merge" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-deep_merge/rubygem-deep_merge.changes 2014-12-03 22:47:41.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-deep_merge.new/rubygem-deep_merge.changes 2016-08-05 18:17:06.000000000 +0200 @@ -1,0 +2,25 @@ +Tue Aug 2 04:30:57 UTC 2016 - co...@suse.com + +- updated to version 1.1.1 + see installed CHANGELOG + + 2016-08-01 Jason Frey <fryg...@gmail.com> + * Ship version 1.1.1 + + * Fixed release date in the gemspec. + + 2016-08-01 Jason Frey <fryg...@gmail.com> + * Ship version 1.1.0 + + * Add testing for newer Ruby 2.2, 2.3, head, and jruby-head. + + 2016-06-14 Michael Sievers <michael_siev...@web.de> + * Add extend_existing_arrays option + + 2016-06-07 Jason Frey <fryg...@gmail.com> + * Add overwrite_arrays option + + 2016-04-08 Dan Deleo <d...@kallistec.com> + * Remove support for old Ruby 1.8 and 1.9 + +------------------------------------------------------------------- Old: ---- deep_merge-1.0.1.gem New: ---- deep_merge-1.1.1.gem gem2rpm.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-deep_merge.spec ++++++ --- /var/tmp/diff_new_pack.8Mgx18/_old 2016-08-05 18:17:07.000000000 +0200 +++ /var/tmp/diff_new_pack.8Mgx18/_new 2016-08-05 18:17:07.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-deep_merge # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,23 +15,32 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# + Name: rubygem-deep_merge -Version: 1.0.1 +Version: 1.1.1 Release: 0 %define mod_name deep_merge %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 5 -BuildRequires: %{ruby} BuildRequires: %{rubygem gem2rpm} -Url: http://github.com/danielsdeleo/deep_merge +BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 +Url: https://github.com/danielsdeleo/deep_merge Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source1: gem2rpm.yml Summary: Merge Deeply Nested Hashes License: MIT Group: Development/Languages/Ruby %description -Recursively merge hashes. Now works with Ruby 1.9 and ActiveSupport. +Recursively merge hashes. %prep @@ -39,7 +48,7 @@ %install %gem_install \ - --doc-files="CHANGELOG README.md" \ + --doc-files="CHANGELOG LICENSE README.md" \ -f %gem_packages ++++++ deep_merge-1.0.1.gem -> deep_merge-1.1.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG new/CHANGELOG --- old/CHANGELOG 2014-01-21 19:10:15.000000000 +0100 +++ new/CHANGELOG 2016-08-02 00:18:09.000000000 +0200 @@ -1,4 +1,25 @@ +2016-08-01 Jason Frey <fryg...@gmail.com> + * Ship version 1.1.1 + + * Fixed release date in the gemspec. + +2016-08-01 Jason Frey <fryg...@gmail.com> + * Ship version 1.1.0 + + * Add testing for newer Ruby 2.2, 2.3, head, and jruby-head. + +2016-06-14 Michael Sievers <michael_siev...@web.de> + * Add extend_existing_arrays option + +2016-06-07 Jason Frey <fryg...@gmail.com> + * Add overwrite_arrays option + +2016-04-08 Dan Deleo <d...@kallistec.com> + * Remove support for old Ruby 1.8 and 1.9 + 2014-01-21 Dan DeLeo <d...@kallistec.com> + * Ship version 1.0.1 + * Update knockout behavior to better handle nil (b7de40b5) 2011-08-15 Dan DeLeo <d...@kallistec.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/LICENSE new/LICENSE --- old/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/LICENSE 2016-08-02 00:18:09.000000000 +0200 @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2008-2016 Steve Midgley, Daniel DeLeo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2014-01-21 19:10:15.000000000 +0100 +++ new/README.md 2016-08-02 00:18:09.000000000 +0200 @@ -29,12 +29,16 @@ Set to true to skip any unmergeable elements from source :knockout_prefix DEFAULT: nil Set to string value to signify prefix which deletes elements from existing element + :overwrite_arrays DEFAULT: false + Set to true if you want to avoid merging arrays :sort_merged_arrays DEFAULT: false Set to true to sort all arrays that are merged together :unpack_arrays DEFAULT: nil Set to string value to run "Array::join" then "String::split" against all arrays :merge_hash_arrays DEFAULT: false Set to true to merge hashes within arrays + :extend_existing_arrays DEFAULT: false + Set to true to extend existing arrays, instead of overwriting them :merge_debug DEFAULT: false Set to true to get console output of merge process for debugging @@ -57,6 +61,15 @@ dest.ko_deep_merge!(source) Results: {:x => ""} +**:overwrite_arrays** + +The purpose of this is to provide a way to replace Arrays instead of having them merge together. + + source = {:x => ['1', '2']} + dest = {:x => ['3', '4']} + dest.deep_merge!(source, {:overwrite_arrays => true}) + Results: {:x => ['1', '2']} + **:unpack_arrays** The purpose of this is to permit compound elements to be passed in as strings and to be converted into discrete array elements @@ -77,6 +90,15 @@ dest.deep_merge!(source, {:merge_hash_arrays => true}) Results: {:x => [{:y => 1, :z => 2}]} +**:extend_existing_arrays** + +Push src elements to existing arrays, instead of overwriting them. + + source = { "property" => "4" } + dest = { "property" => ["1", "2", "3"] } + dest.deep_merge!(source, {:extend_existing_arrays => true}) + Results: {"property" => ["1", "2", "3", "4"]} + There are many tests for this library - and you can learn more about the features and usages of deep_merge! by just browsing the test examples. Using deep_merge in Rails @@ -110,4 +132,4 @@ `deep_merge` was written by Steve Midgley, and is now maintained by Daniel DeLeo. The official home of `deep_merge` on the internet is now https://github.com/danielsdeleo/deep_merge -Copyright (c) 2008 Steve Midgley, released under the MIT license +Copyright (c) 2008-2016 Steve Midgley, released under the MIT license Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/deep_merge/core.rb new/lib/deep_merge/core.rb --- old/lib/deep_merge/core.rb 2014-01-21 19:10:15.000000000 +0100 +++ new/lib/deep_merge/core.rb 2016-08-02 00:18:09.000000000 +0200 @@ -26,6 +26,8 @@ # Set to true to skip any unmergeable elements from source # :knockout_prefix DEFAULT: nil # Set to string value to signify prefix which deletes elements from existing element + # :overwrite_arrays DEFAULT: false + # Set to true if you want to avoid merging arrays # :sort_merged_arrays DEFAULT: false # Set to true to sort all arrays that are merged together # :unpack_arrays DEFAULT: nil @@ -74,10 +76,15 @@ raise InvalidParameter, "overwrite_unmergeable must be true if knockout_prefix is specified in deep_merge!" if knockout_prefix && !overwrite_unmergeable # if present: we will split and join arrays on this char before merging array_split_char = options[:unpack_arrays] || false + # request that we avoid merging arrays + overwrite_arrays = options[:overwrite_arrays] || false # request that we sort together any arrays when they are merged sort_merged_arrays = options[:sort_merged_arrays] || false # request that arrays of hashes are merged together merge_hash_arrays = options[:merge_hash_arrays] || false + # request to extend existing arrays, instead of overwriting them + extend_existing_arrays = options[:extend_existing_arrays] || false + di = options[:debug_indent] || '' # do nothing if source is nil return dest if source.nil? @@ -105,6 +112,8 @@ end dest[src_key] = deep_merge!(src_value, src_dup, options.merge(:debug_indent => di + ' ')) end + elsif dest.kind_of?(Array) && extend_existing_arrays + dest.push(source) else # dest isn't a hash, so we overwrite it completely (if permitted) if overwrite_unmergeable puts "#{di} overwriting dest: #{src_key.inspect} => #{src_value.inspect} -over-> #{dest.inspect}" if merge_debug @@ -114,58 +123,67 @@ end elsif source.kind_of?(Array) puts "#{di}Arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug - # if we are instructed, join/split any source arrays before processing - if array_split_char - puts "#{di} split/join on source: #{source.inspect}" if merge_debug - source = source.join(array_split_char).split(array_split_char) - if dest.kind_of?(Array) - dest = dest.join(array_split_char).split(array_split_char) + if overwrite_arrays + puts "#{di} overwrite arrays" if merge_debug + dest = source + else + # if we are instructed, join/split any source arrays before processing + if array_split_char + puts "#{di} split/join on source: #{source.inspect}" if merge_debug + source = source.join(array_split_char).split(array_split_char) + if dest.kind_of?(Array) + dest = dest.join(array_split_char).split(array_split_char) + end end - end - # if there's a naked knockout_prefix in source, that means we are to truncate dest - if knockout_prefix && source.index(knockout_prefix) - dest = clear_or_nil(dest); source.delete(knockout_prefix) - end - if dest.kind_of?(Array) - if knockout_prefix - print "#{di} knocking out: " if merge_debug - # remove knockout prefix items from both source and dest - source.delete_if do |ko_item| - retval = false - item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item - if item != ko_item - print "#{ko_item} - " if merge_debug - dest.delete(item) - dest.delete(ko_item) - retval = true + # if there's a naked knockout_prefix in source, that means we are to truncate dest + if knockout_prefix && source.index(knockout_prefix) + dest = clear_or_nil(dest); source.delete(knockout_prefix) + end + if dest.kind_of?(Array) + if knockout_prefix + print "#{di} knocking out: " if merge_debug + # remove knockout prefix items from both source and dest + source.delete_if do |ko_item| + retval = false + item = ko_item.respond_to?(:gsub) ? ko_item.gsub(%r{^#{knockout_prefix}}, "") : ko_item + if item != ko_item + print "#{ko_item} - " if merge_debug + dest.delete(item) + dest.delete(ko_item) + retval = true + end + retval end - retval + puts if merge_debug end - puts if merge_debug - end - puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug - source_all_hashes = source.all? { |i| i.kind_of?(Hash) } - dest_all_hashes = dest.all? { |i| i.kind_of?(Hash) } - if merge_hash_arrays && source_all_hashes && dest_all_hashes - # merge hashes in lists - list = [] - dest.each_index do |i| - list[i] = deep_merge!(source[i] || {}, dest[i], - options.merge(:debug_indent => di + ' ')) + puts "#{di} merging arrays: #{source.inspect} :: #{dest.inspect}" if merge_debug + source_all_hashes = source.all? { |i| i.kind_of?(Hash) } + dest_all_hashes = dest.all? { |i| i.kind_of?(Hash) } + if merge_hash_arrays && source_all_hashes && dest_all_hashes + # merge hashes in lists + list = [] + dest.each_index do |i| + list[i] = deep_merge!(source[i] || {}, dest[i], + options.merge(:debug_indent => di + ' ')) + end + list += source[dest.count..-1] if source.count > dest.count + dest = list + else + dest = dest | source end - list += source[dest.count..-1] if source.count > dest.count - dest = list - else - dest = dest | source + dest.sort! if sort_merged_arrays + elsif overwrite_unmergeable + puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) end - dest.sort! if sort_merged_arrays - elsif overwrite_unmergeable - puts "#{di} overwriting dest: #{source.inspect} -over-> #{dest.inspect}" if merge_debug - dest = overwrite_unmergeables(source, dest, options) end else # src_hash is not an array or hash, so we'll have to overwrite dest - puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug - dest = overwrite_unmergeables(source, dest, options) + if dest.kind_of?(Array) && extend_existing_arrays + dest.push(source) + else + puts "#{di}Others: #{source.inspect} :: #{dest.inspect}" if merge_debug + dest = overwrite_unmergeables(source, dest, options) + end end puts "#{di}Returning #{dest.inspect}" if merge_debug dest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2014-01-21 19:10:15.000000000 +0100 +++ new/metadata 2016-08-02 00:18:09.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: deep_merge version: !ruby/object:Gem::Version - version: 1.0.1 + version: 1.1.1 platform: ruby authors: - Steve Midgley autorequire: bindir: bin cert_chain: [] -date: 2011-07-28 00:00:00.000000000 Z +date: 2016-08-01 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -24,14 +24,30 @@ - - "~>" - !ruby/object:Gem::Version version: '10.1' -description: Recursively merge hashes. Now works with Ruby 1.9 and ActiveSupport +- !ruby/object:Gem::Dependency + name: test-unit-minitest + requirement: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - ">=" + - !ruby/object:Gem::Version + version: '0' +description: Recursively merge hashes. email: d...@kallistec.com executables: [] extensions: [] extra_rdoc_files: +- LICENSE - README.md files: - CHANGELOG +- LICENSE - README.md - Rakefile - lib/deep_merge.rb @@ -39,7 +55,7 @@ - lib/deep_merge/deep_merge_hash.rb - lib/deep_merge/rails_compat.rb - test/test_deep_merge.rb -homepage: http://github.com/danielsdeleo/deep_merge +homepage: https://github.com/danielsdeleo/deep_merge licenses: - MIT metadata: {} @@ -59,7 +75,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.1.11 +rubygems_version: 2.4.5.1 signing_key: specification_version: 4 summary: Merge Deeply Nested Hashes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_deep_merge.rb new/test/test_deep_merge.rb --- old/test/test_deep_merge.rb 2014-01-21 19:10:15.000000000 +0100 +++ new/test/test_deep_merge.rb 2016-08-02 00:18:09.000000000 +0200 @@ -87,6 +87,12 @@ DeepMerge::deep_merge!(hash_src, hash_dst) assert_equal(["2","4","1","3"], hash_dst['property']) + # hashes holding array (overwrite) + hash_src = {"property" => ["1","3"]} + hash_dst = {"property" => ["2","4"]} + DeepMerge::deep_merge!(hash_src, hash_dst, {:overwrite_arrays => true}) + assert_equal(["1","3"], hash_dst['property']) + # hashes holding array (sorted) hash_src = {"property" => ["1","3"]} hash_dst = {"property" => ["2","4"]} @@ -213,6 +219,18 @@ DeepMerge::deep_merge!(hash_src, hash_dst) assert_equal({"property" => {"bedroom_count" => {"king_bed" => [nil, 3], "queen_bed" => [4, nil, 1]}, "bathroom_count" => [nil, "2", "1"]}}, hash_dst) + # if extend_existig_arrays == true && destination.kind_of?(Array) && source element is neither array nor hash, push source to destionation + hash_src = { "property" => "4" } + hash_dst = { "property" => ["1", "2", "3"] } + DeepMerge::deep_merge!(hash_src, hash_dst, :extend_existing_arrays => true) + assert_equal({"property" => ["1", "2", "3", "4"]}, hash_dst) + + # if extend_existig_arrays == true && destination.kind_of?(Array) && source.kind_of(Hash), push source to destionation + hash_src = { "property" => {:number => "3"} } + hash_dst = { "property" => [{:number => "1"}, {:number => "2"}] } + DeepMerge::deep_merge!(hash_src, hash_dst, :extend_existing_arrays => true) + assert_equal({"property"=>[{:number=>"1"}, {:number=>"2"}, {:number=>"3"}]}, hash_dst) + # test parameter management for knockout_prefix and overwrite unmergable assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})} assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})} ++++++ gem2rpm.yml ++++++ # --- # ## used by gem2rpm # :summary: this is a custom summary # ## used by gem2rpm # :description: |- # this is a custom description # # it can be multiline # ## used by gem2rpm # :license: MIT or Ruby # ## used by gem2rpm and gem_packages # :version_suffix: -x_y # ## used by gem2rpm and gem_packages # :disable_docs: true # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm # :preamble: |- # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm # :patches: # foo.patch: -p1 # bar.patch: # ## used by gem2rpm :sources: # - foo.desktop # - bar.desktop # :gem_install_args: '....' # ## used by gem2rpm # :pre_install: |- # %if 0%{?use_system_libev} # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm # :post_install: |- # # delete custom files here or do other fancy stuff # install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse # ## used by gem2rpm # :testsuite_command: |- # (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem2rpm # :scripts: # :post: |- # /bin/echo foo # ## used by gem_packages # :main: # :preamble: |- # Requires: util-linux # Recommends: pwgen # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem_packages # :custom: # apache: # :preamble: |- # Requires: ..... # :filelist: |- # /etc/apache2/conf.d/passenger.conf # :summary: Custom summary is optional # :description: |- # Custom description is optional # # bar # :post: |- # /bin/echo foo #