Hello community, here is the log from the commit of package rubygem-jbuilder for openSUSE:Factory checked in at 2015-03-11 09:57:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-jbuilder (Old) and /work/SRC/openSUSE:Factory/.rubygem-jbuilder.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-jbuilder" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-jbuilder/rubygem-jbuilder.changes 2015-02-23 13:19:34.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-jbuilder.new/rubygem-jbuilder.changes 2015-03-11 09:57:23.000000000 +0100 @@ -1,0 +2,12 @@ +Sat Mar 7 05:28:40 UTC 2015 - co...@suse.com + +- updated to version 2.2.10 + * Add Jbuilder::Blank#empty? to tell if attributes are empty [#257] + +------------------------------------------------------------------- +Fri Mar 6 18:06:43 UTC 2015 - co...@suse.com + +- updated to version 2.2.9 + * Support `partial!` call with `locals` option in `JbuilderTemplate` [#251](https://github.com/rails/jbuilder/pull/251) + +------------------------------------------------------------------- Old: ---- jbuilder-2.2.8.gem New: ---- jbuilder-2.2.10.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-jbuilder.spec ++++++ --- /var/tmp/diff_new_pack.dDoL4i/_old 2015-03-11 09:57:24.000000000 +0100 +++ /var/tmp/diff_new_pack.dDoL4i/_new 2015-03-11 09:57:24.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-jbuilder -Version: 2.2.8 +Version: 2.2.10 Release: 0 %define mod_name jbuilder %define mod_full_name %{mod_name}-%{version} ++++++ jbuilder-2.2.8.gem -> jbuilder-2.2.10.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2015-02-22 06:54:27.000000000 +0100 +++ new/.travis.yml 2015-03-06 21:49:54.000000000 +0100 @@ -18,14 +18,6 @@ - gemfiles/rails_4_2.gemfile matrix: - exclude: - - rvm: 2.2 - gemfile: gemfiles/rails_3_0.gemfile - - rvm: 2.2 - gemfile: gemfiles/rails_3_1.gemfile - - rvm: 2.2 - gemfile: gemfiles/rails_3_2.gemfile - allow_failures: - rvm: jruby-19mode - rvm: rbx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Appraisals new/Appraisals --- old/Appraisals 2015-02-22 06:54:27.000000000 +0100 +++ new/Appraisals 2015-03-06 21:49:54.000000000 +0100 @@ -1,14 +1,17 @@ appraise "rails-3-0" do + gem "test-unit" gem "railties", "~> 3.0.0" gem "actionpack", "~> 3.0.0" end appraise "rails-3-1" do + gem "test-unit" gem "railties", "~> 3.1.0" gem "actionpack", "~> 3.1.0" end appraise "rails-3-2" do + gem "test-unit" gem "railties", "~> 3.2.0" gem "actionpack", "~> 3.2.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2015-02-22 06:54:27.000000000 +0100 +++ new/CHANGELOG.md 2015-03-06 21:49:54.000000000 +0100 @@ -1,5 +1,15 @@ # Changelog +2.2.10 +------ + +* Add Jbuilder::Blank#empty? to tell if attributes are empty [#257](https://github.com/rails/jbuilder/pull/257) [@a2ikm](https://github.com/a2ikm) + +2.2.9 +----- + +* Support `partial!` call with `locals` option in `JbuilderTemplate` [#251](https://github.com/rails/jbuilder/pull/251) + 2.2.8 ----- * [Raise ArrayError when trying to add key to an array](https://github.com/rails/jbuilder/commit/869e4be1ad165ce986d8fca78311bdd3ed166087) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2015-02-22 06:54:27.000000000 +0100 +++ new/README.md 2015-03-06 21:49:54.000000000 +0100 @@ -181,6 +181,17 @@ json.comments @post.comments, partial: 'comment/comment', as: :comment ``` +You can pass any objects into partial templates with or without `:locals` option. + +```ruby +json.partial! 'sub_template', locals: { user: user } + +# or + +json.partial! 'sub_template', user: user +``` + + You can explicitly make Jbuilder object return null if you want: ``` ruby Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/rails_3_0.gemfile new/gemfiles/rails_3_0.gemfile --- old/gemfiles/rails_3_0.gemfile 2015-02-22 06:54:27.000000000 +0100 +++ new/gemfiles/rails_3_0.gemfile 2015-03-06 21:49:54.000000000 +0100 @@ -5,6 +5,7 @@ gem "rake" gem "mocha", :require => false gem "appraisal" +gem "test-unit" gem "railties", "~> 3.0.0" gem "actionpack", "~> 3.0.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/rails_3_1.gemfile new/gemfiles/rails_3_1.gemfile --- old/gemfiles/rails_3_1.gemfile 2015-02-22 06:54:27.000000000 +0100 +++ new/gemfiles/rails_3_1.gemfile 2015-03-06 21:49:54.000000000 +0100 @@ -5,6 +5,7 @@ gem "rake" gem "mocha", :require => false gem "appraisal" +gem "test-unit" gem "railties", "~> 3.1.0" gem "actionpack", "~> 3.1.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/rails_3_2.gemfile new/gemfiles/rails_3_2.gemfile --- old/gemfiles/rails_3_2.gemfile 2015-02-22 06:54:27.000000000 +0100 +++ new/gemfiles/rails_3_2.gemfile 2015-03-06 21:49:54.000000000 +0100 @@ -5,6 +5,7 @@ gem "rake" gem "mocha", :require => false gem "appraisal" +gem "test-unit" gem "railties", "~> 3.2.0" gem "actionpack", "~> 3.2.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jbuilder.gemspec new/jbuilder.gemspec --- old/jbuilder.gemspec 2015-02-22 06:54:27.000000000 +0100 +++ new/jbuilder.gemspec 2015-03-06 21:49:54.000000000 +0100 @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'jbuilder' - s.version = '2.2.8' + s.version = '2.2.10' s.authors = ['David Heinemeier Hansson', 'Pavel Pravosud'] s.email = ['da...@37signals.com', 'pa...@pravosud.com'] s.summary = 'Create JSON structures via a Builder-style DSL' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/jbuilder/blank.rb new/lib/jbuilder/blank.rb --- old/lib/jbuilder/blank.rb 2015-02-22 06:54:27.000000000 +0100 +++ new/lib/jbuilder/blank.rb 2015-03-06 21:49:54.000000000 +0100 @@ -3,5 +3,9 @@ def ==(other) super || Blank === other end + + def empty? + true + end end end 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 2015-02-22 06:54:27.000000000 +0100 +++ new/lib/jbuilder/jbuilder_template.rb 2015-03-06 21:49:54.000000000 +0100 @@ -17,11 +17,16 @@ def partial!(name_or_options, locals = {}) case name_or_options when ::Hash - # partial! partial: 'name', locals: { foo: 'bar' } + # partial! partial: 'name', foo: 'bar' options = name_or_options else + # partial! 'name', locals: {foo: 'bar'} + if locals.one? && (locals.keys.first == :locals) + options = locals.merge(partial: name_or_options) + else + options = { partial: name_or_options, locals: locals } + end # partial! 'name', foo: 'bar' - options = { partial: name_or_options, locals: locals } as = locals.delete(:as) options[:as] = as if as.present? options[:collection] = locals[:collection] if locals.key?(:collection) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-02-22 06:54:27.000000000 +0100 +++ new/metadata 2015-03-06 21:49:54.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: jbuilder version: !ruby/object:Gem::Version - version: 2.2.8 + version: 2.2.10 platform: ruby authors: - David Heinemeier Hansson @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-02-22 00:00:00.000000000 Z +date: 2015-03-06 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: activesupport diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/jbuilder_template_test.rb new/test/jbuilder_template_test.rb --- old/test/jbuilder_template_test.rb 2015-02-22 06:54:27.000000000 +0100 +++ new/test/jbuilder_template_test.rb 2015-03-06 21:49:54.000000000 +0100 @@ -40,7 +40,7 @@ def partials { - '_partial.json.jbuilder' => 'json.content "hello"', + '_partial.json.jbuilder' => 'foo ||= "hello"; json.content foo', '_blog_post.json.jbuilder' => BLOG_POST_PARTIAL, '_collection.json.jbuilder' => COLLECTION_PARTIAL } @@ -110,6 +110,22 @@ assert_equal 'hello', MultiJson.load(json)['content'] end + test 'partial! + locals via :locals option' do + json = render_jbuilder <<-JBUILDER + json.partial! 'partial', locals: { foo: 'howdy' } + JBUILDER + + assert_equal 'howdy', MultiJson.load(json)['content'] + end + + test 'partial! + locals without :locals key' do + json = render_jbuilder <<-JBUILDER + json.partial! 'partial', foo: 'goodbye' + JBUILDER + + assert_equal 'goodbye', MultiJson.load(json)['content'] + end + test 'partial! renders collections' do json = render_jbuilder <<-JBUILDER json.partial! 'blog_post', :collection => BLOG_POST_COLLECTION, :as => :blog_post 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 2015-02-22 06:54:27.000000000 +0100 +++ new/test/jbuilder_test.rb 2015-03-06 21:49:54.000000000 +0100 @@ -645,6 +645,13 @@ assert_nil result['author'] end + test 'empty attributes respond to empty?' do + attributes = Jbuilder.new.attributes! + assert attributes.empty? + assert attributes.blank? + assert !attributes.present? + end + test 'throws ArrayError when trying to add a key to an array' do assert_raise Jbuilder::ArrayError do jbuild do |json| -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org