Hello community,
here is the log from the commit of package rubygem-jbuilder for
openSUSE:Factory checked in at 2020-03-07 21:38:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-jbuilder (Old)
and /work/SRC/openSUSE:Factory/.rubygem-jbuilder.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-jbuilder"
Sat Mar 7 21:38:27 2020 rev:22 rq:773774 version:2.10.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-jbuilder/rubygem-jbuilder.changes
2019-05-17 23:44:38.673863996 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-jbuilder.new.26092/rubygem-jbuilder.changes
2020-03-07 21:38:34.124285526 +0100
@@ -1,0 +2,12 @@
+Mon Feb 10 14:57:42 UTC 2020 - Stephan Kulow <[email protected]>
+
+- updated to version 2.10.0
+ see installed CHANGELOG.md
+
+ 2.10.0
+ ----------
+
+ * Requires Rails 5+ and Ruby 2.2+
+ * Nested hashes are deep-merged
+
+-------------------------------------------------------------------
Old:
----
jbuilder-2.9.1.gem
New:
----
jbuilder-2.10.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-jbuilder.spec ++++++
--- /var/tmp/diff_new_pack.PqPKiL/_old 2020-03-07 21:38:34.828286001 +0100
+++ /var/tmp/diff_new_pack.PqPKiL/_new 2020-03-07 21:38:34.832286004 +0100
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-jbuilder
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@@ -24,15 +24,15 @@
#
Name: rubygem-jbuilder
-Version: 2.9.1
+Version: 2.10.0
Release: 0
%define mod_name jbuilder
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: %{ruby >= 1.9.3}
+BuildRequires: %{ruby >= 2.2.2}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: ruby-macros >= 5
-Url: https://github.com/rails/jbuilder
+URL: https://github.com/rails/jbuilder
Source: https://rubygems.org/gems/%{mod_full_name}.gem
Source1: gem2rpm.yml
Summary: Create JSON structures via a Builder-style DSL
++++++ jbuilder-2.9.1.gem -> jbuilder-2.10.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 2019-05-14 19:38:31.000000000 +0200
+++ new/.travis.yml 2020-02-10 02:41:10.000000000 +0100
@@ -16,7 +16,6 @@
- rbx-3.107
gemfile:
- - gemfiles/rails_4_2.gemfile
- gemfiles/rails_5_0.gemfile
- gemfiles/rails_5_1.gemfile
- gemfiles/rails_5_2.gemfile
@@ -24,26 +23,7 @@
- gemfiles/rails_head.gemfile
matrix:
- include:
- - rvm: 1.9
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: 2.0
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: 2.1
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: 2.3
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: jruby-19mode
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: rbx-3.107
- gemfile: gemfiles/rails_4_2.gemfile
exclude:
- - rvm: 2.4.6
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: 2.5.5
- gemfile: gemfiles/rails_4_2.gemfile
- - rvm: 2.6.2
- gemfile: gemfiles/rails_4_2.gemfile
- rvm: 2.2.10
gemfile: gemfiles/rails_6_0.gemfile
- rvm: 2.3.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Appraisals new/Appraisals
--- old/Appraisals 2019-05-14 19:38:31.000000000 +0200
+++ new/Appraisals 2020-02-10 02:41:10.000000000 +0100
@@ -1,24 +1,18 @@
-appraise "rails-4-2" do
- gem "rails", "~> 4.2.0"
+appraise "rails-5-0" do
+ gem "rails", "~> 5.0.0"
end
-if RUBY_VERSION >= "2.2.2"
- appraise "rails-5-0" do
- gem "rails", "~> 5.0.0"
- end
-
- appraise "rails-5-1" do
- gem "rails", "~> 5.1.0"
- end
+appraise "rails-5-1" do
+ gem "rails", "~> 5.1.0"
+end
- appraise "rails-5-2" do
- gem "rails", "~> 5.2.0"
- end
+appraise "rails-5-2" do
+ gem "rails", "~> 5.2.0"
end
if RUBY_VERSION >= "2.5.0"
appraise "rails-6-0" do
- gem "rails", "~> 6.0.0.rc1"
+ gem "rails", "~> 6.0.0"
end
appraise "rails-head" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2019-05-14 19:38:31.000000000 +0200
+++ new/CHANGELOG.md 2020-02-10 02:41:10.000000000 +0100
@@ -1,5 +1,11 @@
# Changelog
+2.10.0
+----------
+
+* Requires Rails 5+ and Ruby 2.2+
+* Nested hashes are deep-merged
+
2.9.1
-----
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gemfiles/rails_4_2.gemfile
new/gemfiles/rails_4_2.gemfile
--- old/gemfiles/rails_4_2.gemfile 2019-05-14 19:38:31.000000000 +0200
+++ new/gemfiles/rails_4_2.gemfile 1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-# This file was generated by Appraisal
-
-source "https://rubygems.org"
-
-gem "rake"
-gem "mocha", require: false
-gem "appraisal"
-gem "rails", "~> 4.2.0"
-
-gemspec path: "../"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/gemfiles/rails_6_0.gemfile
new/gemfiles/rails_6_0.gemfile
--- old/gemfiles/rails_6_0.gemfile 2019-05-14 19:38:31.000000000 +0200
+++ new/gemfiles/rails_6_0.gemfile 2020-02-10 02:41:10.000000000 +0100
@@ -5,6 +5,6 @@
gem "rake"
gem "mocha", require: false
gem "appraisal"
-gem "rails", "~> 6.0.0.rc1"
+gem "rails", "~> 6.0.0"
gemspec path: "../"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/jbuilder.gemspec new/jbuilder.gemspec
--- old/jbuilder.gemspec 2019-05-14 19:38:31.000000000 +0200
+++ new/jbuilder.gemspec 2020-02-10 02:41:10.000000000 +0100
@@ -1,15 +1,15 @@
Gem::Specification.new do |s|
s.name = 'jbuilder'
- s.version = '2.9.1'
+ s.version = '2.10.0'
s.authors = 'David Heinemeier Hansson'
s.email = '[email protected]'
s.summary = 'Create JSON structures via a Builder-style DSL'
s.homepage = 'https://github.com/rails/jbuilder'
s.license = 'MIT'
- s.required_ruby_version = '>= 1.9.3'
+ s.required_ruby_version = '>= 2.2.2'
- s.add_dependency 'activesupport', '>= 4.2.0'
+ s.add_dependency 'activesupport', '>= 5.0.0'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/generators/rails/templates/api_controller.rb
new/lib/generators/rails/templates/api_controller.rb
--- old/lib/generators/rails/templates/api_controller.rb 2019-05-14
19:38:31.000000000 +0200
+++ new/lib/generators/rails/templates/api_controller.rb 2020-02-10
02:41:10.000000000 +0100
@@ -51,7 +51,7 @@
@<%= singular_table_name %> = <%= orm_class.find(class_name,
"params[:id]") %>
end
- # Never trust parameters from the scary internet, only allow the white
list through.
+ # Only allow a list of trusted parameters through.
def <%= "#{singular_table_name}_params" %>
<%- if attributes_names.empty? -%>
params.fetch(<%= ":#{singular_table_name}" %>, {})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/generators/rails/templates/controller.rb
new/lib/generators/rails/templates/controller.rb
--- old/lib/generators/rails/templates/controller.rb 2019-05-14
19:38:31.000000000 +0200
+++ new/lib/generators/rails/templates/controller.rb 2020-02-10
02:41:10.000000000 +0100
@@ -72,7 +72,7 @@
@<%= singular_table_name %> = <%= orm_class.find(class_name,
"params[:id]") %>
end
- # Never trust parameters from the scary internet, only allow the white
list through.
+ # Only allow a list of trusted parameters through.
def <%= "#{singular_table_name}_params" %>
<%- if attributes_names.empty? -%>
params.fetch(<%= ":#{singular_table_name}" %>, {})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/jbuilder/jbuilder_template.rb
new/lib/jbuilder/jbuilder_template.rb
--- old/lib/jbuilder/jbuilder_template.rb 2019-05-14 19:38:31.000000000
+0200
+++ new/lib/jbuilder/jbuilder_template.rb 2020-02-10 02:41:10.000000000
+0100
@@ -73,8 +73,8 @@
# json.cache_if! !admin?, @person, expires_in: 10.minutes do
# json.extract! @person, :name, :age
# end
- def cache_if!(condition, *args)
- condition ? cache!(*args, &::Proc.new) : yield
+ def cache_if!(condition, *args, &block)
+ condition ? cache!(*args, &block) : yield
end
def target!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/jbuilder.rb new/lib/jbuilder.rb
--- old/lib/jbuilder.rb 2019-05-14 19:38:31.000000000 +0200
+++ new/lib/jbuilder.rb 2020-02-10 02:41:10.000000000 +0100
@@ -4,6 +4,7 @@
require 'jbuilder/errors'
require 'json'
require 'ostruct'
+require 'active_support/core_ext/hash/deep_merge'
class Jbuilder
@@key_formatter = nil
@@ -26,12 +27,12 @@
BLANK = Blank.new
NON_ENUMERABLES = [ ::Struct, ::OpenStruct ].to_set
- def set!(key, value = BLANK, *args)
+ def set!(key, value = BLANK, *args, &block)
result = if ::Kernel.block_given?
if !_blank?(value)
# json.comments @post.comments { |comment| ... }
# { "comments": [ { ... }, { ... } ] }
- _scope{ array! value, &::Proc.new }
+ _scope{ array! value, &block }
else
# json.comments { ... }
# { "comments": ... }
@@ -61,9 +62,9 @@
_set_value key, result
end
- def method_missing(*args)
+ def method_missing(*args, &block)
if ::Kernel.block_given?
- set!(*args, &::Proc.new)
+ set!(*args, &block)
else
set!(*args)
end
@@ -163,7 +164,7 @@
#
# [ { "name": David", "age": 32 }, { "name": Jamie", "age": 31 } ]
#
- # If you are using Ruby 1.9+, you can use the call syntax instead of an
explicit extract! call:
+ # You can use the call syntax instead of an explicit extract! call:
#
# json.(@people) { |person| ... }
#
@@ -181,11 +182,11 @@
# json.array! [1, 2, 3]
#
# [1,2,3]
- def array!(collection = [], *attributes)
+ def array!(collection = [], *attributes, &block)
array = if collection.nil?
[]
elsif ::Kernel.block_given?
- _map_collection(collection, &::Proc.new)
+ _map_collection(collection, &block)
elsif attributes.any?
_map_collection(collection) { |element| extract! element, *attributes }
else
@@ -220,9 +221,9 @@
end
end
- def call(object, *attributes)
+ def call(object, *attributes, &block)
if ::Kernel.block_given?
- array! object, &::Proc.new
+ array! object, &block
else
extract! object, *attributes
end
@@ -275,7 +276,7 @@
elsif ::Array === current_value && ::Array === updates
current_value + updates
elsif ::Hash === current_value && ::Hash === updates
- current_value.merge(updates)
+ current_value.deep_merge(updates)
else
raise MergeError.build(current_value, updates)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2019-05-14 19:38:31.000000000 +0200
+++ new/metadata 2020-02-10 02:41:10.000000000 +0100
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: jbuilder
version: !ruby/object:Gem::Version
- version: 2.9.1
+ version: 2.10.0
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2019-05-14 00:00:00.000000000 Z
+date: 2020-02-10 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: activesupport
@@ -16,14 +16,14 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 4.2.0
+ version: 5.0.0
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 4.2.0
+ version: 5.0.0
description:
email: [email protected]
executables: []
@@ -39,7 +39,6 @@
- MIT-LICENSE
- README.md
- Rakefile
-- gemfiles/rails_4_2.gemfile
- gemfiles/rails_5_0.gemfile
- gemfiles/rails_5_1.gemfile
- gemfiles/rails_5_2.gemfile
@@ -80,14 +79,14 @@
requirements:
- - ">="
- !ruby/object:Gem::Version
- version: 1.9.3
+ version: 2.2.2
required_rubygems_version: !ruby/object:Gem::Requirement
requirements:
- - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.0.3
+rubygems_version: 3.0.6
signing_key:
specification_version: 4
summary: Create JSON structures via a Builder-style DSL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/jbuilder_test.rb new/test/jbuilder_test.rb
--- old/test/jbuilder_test.rb 2019-05-14 19:38:31.000000000 +0200
+++ new/test/jbuilder_test.rb 2020-02-10 02:41:10.000000000 +0100
@@ -99,7 +99,7 @@
assert_equal 32, result['age']
end
- test 'extracting from object using call style for 1.9' do
+ test 'extracting from object using call style' do
person = Struct.new(:name, :age).new('David', 32)
result = jbuild do |json|
@@ -159,6 +159,25 @@
assert_equal 32, result['author']['age']
end
+ test 'nested blocks are additive' do
+ result = jbuild do |json|
+ json.author do
+ json.name do
+ json.first 'David'
+ end
+ end
+
+ json.author do
+ json.name do
+ json.last 'Heinemeier Hansson'
+ end
+ end
+ end
+
+ assert_equal 'David', result['author']['name']['first']
+ assert_equal 'Heinemeier Hansson', result['author']['name']['last']
+ end
+
test 'support merge! method' do
result = jbuild do |json|
json.merge! 'foo' => 'bar'