Hello community,

here is the log from the commit of package rubygem-jbuilder for 
openSUSE:Factory checked in at 2016-08-26 23:16:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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        
2016-06-12 18:54:36.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-jbuilder.new/rubygem-jbuilder.changes   
2016-08-26 23:16:28.000000000 +0200
@@ -1,0 +2,12 @@
+Thu Jul 21 04:30:38 UTC 2016 - [email protected]
+
+- updated to version 2.6.0
+ see installed CHANGELOG.md
+
+  2.6.0
+  -----
+  
+  * [Rails 5 cache! with expire 
support](https://github.com/rails/jbuilder/commit/d61e3354563863731bc1f358f495b1dbb7ae9d32)
+  * [Generated view DRYed by using model 
partial](https://github.com/rails/jbuilder/commit/83256f4d7e9211c9dc47972feaed7fd31e4f7cac)
+
+-------------------------------------------------------------------

Old:
----
  jbuilder-2.5.0.gem

New:
----
  jbuilder-2.6.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-jbuilder.spec ++++++
--- /var/tmp/diff_new_pack.CqQAel/_old  2016-08-26 23:16:28.000000000 +0200
+++ /var/tmp/diff_new_pack.CqQAel/_new  2016-08-26 23:16:28.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-jbuilder
-Version:        2.5.0
+Version:        2.6.0
 Release:        0
 %define mod_name jbuilder
 %define mod_full_name %{mod_name}-%{version}

++++++ jbuilder-2.5.0.gem -> jbuilder-2.6.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2016-05-30 23:10:24.000000000 +0200
+++ new/.travis.yml     2016-07-21 00:55:51.000000000 +0200
@@ -7,8 +7,8 @@
   - 1.9
   - 2.0
   - 2.1
-  - 2.2.4
-  - 2.3.0
+  - 2.2.5
+  - 2.3.1
   - ruby-head
   - jruby-19mode
   - rbx
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Appraisals new/Appraisals
--- old/Appraisals      2016-05-30 23:10:24.000000000 +0200
+++ new/Appraisals      2016-07-21 00:55:51.000000000 +0200
@@ -38,7 +38,7 @@
 end
 
 appraise "rails-5-0" do
-  gem "railties", ">= 5.0.0.beta2", "< 5.1"
-  gem "actionpack", ">= 5.0.0.beta2", "< 5.1"
-  gem "activemodel", ">= 5.0.0.beta2", "< 5.1"
+  gem "railties",    "~> 5.0.0"
+  gem "actionpack",  "~> 5.0.0"
+  gem "activemodel", "~> 5.0.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2016-05-30 23:10:24.000000000 +0200
+++ new/CHANGELOG.md    2016-07-21 00:55:51.000000000 +0200
@@ -1,5 +1,11 @@
 # Changelog
 
+2.6.0
+-----
+
+* [Rails 5 cache! with expire 
support](https://github.com/rails/jbuilder/commit/d61e3354563863731bc1f358f495b1dbb7ae9d32)
+* [Generated view DRYed by using model 
partial](https://github.com/rails/jbuilder/commit/83256f4d7e9211c9dc47972feaed7fd31e4f7cac)
+
 2.5.0
 -----
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CONTRIBUTING.md new/CONTRIBUTING.md
--- old/CONTRIBUTING.md 2016-05-30 23:10:24.000000000 +0200
+++ new/CONTRIBUTING.md 2016-07-21 00:55:51.000000000 +0200
@@ -2,9 +2,9 @@
 =====================
 
 [![Build 
Status](https://api.travis-ci.org/rails/jbuilder.svg?branch=master)][travis]
-[![Gem Version](http://img.shields.io/gem/v/jbuilder.svg)][gem]
-[![Code 
Climate](http://img.shields.io/codeclimate/github/rails/jbuilder.svg)][codeclimate]
-[![Dependencies 
Status](http://img.shields.io/gemnasium/rails/jbuilder.svg)][gemnasium]
+[![Gem Version](https://badge.fury.io/rb/jbuilder.svg)][gem]
+[![Code 
Climate](https://codeclimate.com/github/rails/jbuilder/badges/gpa.svg)][codeclimate]
+[![Dependencies Status](https://gemnasium.com/rails/jbuilder.svg)][gemnasium]
 
 [travis]: https://travis-ci.org/rails/jbuilder
 [gem]: https://rubygems.org/gems/jbuilder
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2016-05-30 23:10:24.000000000 +0200
+++ new/README.md       2016-07-21 00:55:51.000000000 +0200
@@ -6,7 +6,7 @@
 example:
 
 ``` ruby
-# app/views/message/show.json.jbuilder
+# app/views/messages/show.json.jbuilder
 
 json.content format_content(@message.content)
 json.(@message, :created_at, :updated_at)
@@ -64,7 +64,7 @@
   json.set! :name, 'David'
 end
 
-# => "author": { "name": "David" }
+# => {"author": { "name": "David" }}
 ```
 
 Top level arrays can be handled directly.  Useful for index and other 
collection actions.
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jbuilder.gemspec new/jbuilder.gemspec
--- old/jbuilder.gemspec        2016-05-30 23:10:24.000000000 +0200
+++ new/jbuilder.gemspec        2016-07-21 00:55:51.000000000 +0200
@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name     = 'jbuilder'
-  s.version  = '2.5.0'
+  s.version  = '2.6.0'
   s.authors  = ['David Heinemeier Hansson', 'Pavel Pravosud']
   s.email    = ['[email protected]', '[email protected]']
   s.summary  = 'Create JSON structures via a Builder-style DSL'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/generators/rails/jbuilder_generator.rb 
new/lib/generators/rails/jbuilder_generator.rb
--- old/lib/generators/rails/jbuilder_generator.rb      2016-05-30 
23:10:24.000000000 +0200
+++ new/lib/generators/rails/jbuilder_generator.rb      2016-07-21 
00:55:51.000000000 +0200
@@ -20,6 +20,7 @@
           filename = filename_with_extensions(view)
           template filename, File.join('app/views', controller_file_path, 
filename)
         end
+        template filename_with_extensions('partial'), File.join('app/views', 
controller_file_path, filename_with_extensions("_#{singular_table_name}"))
       end
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/generators/rails/templates/index.json.jbuilder 
new/lib/generators/rails/templates/index.json.jbuilder
--- old/lib/generators/rails/templates/index.json.jbuilder      2016-05-30 
23:10:24.000000000 +0200
+++ new/lib/generators/rails/templates/index.json.jbuilder      2016-07-21 
00:55:51.000000000 +0200
@@ -1,4 +1 @@
-json.array!(@<%= plural_table_name %>) do |<%= singular_table_name %>|
-  json.extract! <%= singular_table_name %>, <%= attributes_list %>
-  json.url <%= singular_table_name %>_url(<%= singular_table_name %>, format: 
:json)
-end
+json.array! @<%= plural_table_name %>, partial: '<%= plural_table_name %>/<%= 
singular_table_name %>', as: :<%= singular_table_name %>
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/generators/rails/templates/partial.json.jbuilder 
new/lib/generators/rails/templates/partial.json.jbuilder
--- old/lib/generators/rails/templates/partial.json.jbuilder    1970-01-01 
01:00:00.000000000 +0100
+++ new/lib/generators/rails/templates/partial.json.jbuilder    2016-07-21 
00:55:51.000000000 +0200
@@ -0,0 +1,2 @@
+json.extract! <%= singular_table_name %>, <%= attributes_list_with_timestamps 
%>
+json.url <%= singular_table_name %>_url(<%= singular_table_name %>, format: 
:json)
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/generators/rails/templates/show.json.jbuilder 
new/lib/generators/rails/templates/show.json.jbuilder
--- old/lib/generators/rails/templates/show.json.jbuilder       2016-05-30 
23:10:24.000000000 +0200
+++ new/lib/generators/rails/templates/show.json.jbuilder       2016-07-21 
00:55:51.000000000 +0200
@@ -1 +1 @@
-json.extract! @<%= singular_table_name %>, <%= attributes_list_with_timestamps 
%>
+json.partial! "<%= plural_table_name %>/<%= singular_table_name %>", <%= 
singular_table_name %>: @<%= singular_table_name %>
\ No newline at end of file
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       2016-05-30 23:10:24.000000000 
+0200
+++ new/lib/jbuilder/jbuilder_template.rb       2016-07-21 00:55:51.000000000 
+0200
@@ -32,7 +32,7 @@
   #   end
   def cache!(key=nil, options={})
     if @context.controller.perform_caching
-      value = ::Rails.cache.fetch(_cache_key(key, options), options) do
+      value = _cache_fragment_for(key, options) do
         _scope { yield self }
       end
 
@@ -102,9 +102,35 @@
     @context.render options
   end
 
+  def _cache_fragment_for(key, options, &block)
+    key = _cache_key(key, options)
+    _read_fragment_cache(key, options) || _write_fragment_cache(key, options, 
&block)
+  end
+
+  def _read_fragment_cache(key, options = nil)
+    @context.controller.instrument_fragment_cache :read_fragment, key do
+      ::Rails.cache.read(key, options)
+    end
+  end
+
+  def _write_fragment_cache(key, options = nil)
+    @context.controller.instrument_fragment_cache :write_fragment, key do
+      yield.tap do |value|
+        ::Rails.cache.write(key, value, options)
+      end
+    end
+  end
+
   def _cache_key(key, options)
-    key = _fragment_name_with_digest(key, options)
-    key = url_for(key).split('://', 2).last if ::Hash === key
+    name_options = options.slice(:skip_digest, :virtual_path)
+    key = _fragment_name_with_digest(key, name_options)
+
+    if @context.respond_to?(:fragment_cache_key)
+      key = @context.fragment_cache_key(key)
+    else
+      key = url_for(key).split('://', 2).last if ::Hash === key
+    end
+
     ::ActiveSupport::Cache.expand_cache_key(key, :jbuilder)
   end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/jbuilder/railtie.rb new/lib/jbuilder/railtie.rb
--- old/lib/jbuilder/railtie.rb 2016-05-30 23:10:24.000000000 +0200
+++ new/lib/jbuilder/railtie.rb 2016-07-21 00:55:51.000000000 +0200
@@ -3,7 +3,7 @@
 
 class Jbuilder
   class Railtie < ::Rails::Railtie
-    initializer :jbuilder do |app|
+    initializer :jbuilder do
       ActiveSupport.on_load :action_view do
         ActionView::Template.register_template_handler :jbuilder, 
JbuilderHandler
         require 'jbuilder/dependency_tracker'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2016-05-30 23:10:24.000000000 +0200
+++ new/metadata        2016-07-21 00:55:51.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: jbuilder
 version: !ruby/object:Gem::Version
-  version: 2.5.0
+  version: 2.6.0
 platform: ruby
 authors:
 - David Heinemeier Hansson
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2016-05-30 00:00:00.000000000 Z
+date: 2016-07-20 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: activesupport
@@ -75,6 +75,7 @@
 - lib/generators/rails/templates/api_controller.rb
 - lib/generators/rails/templates/controller.rb
 - lib/generators/rails/templates/index.json.jbuilder
+- lib/generators/rails/templates/partial.json.jbuilder
 - lib/generators/rails/templates/show.json.jbuilder
 - lib/jbuilder.rb
 - lib/jbuilder/blank.rb
@@ -111,7 +112,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.5.2
+rubygems_version: 2.6.4
 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_generator_test.rb 
new/test/jbuilder_generator_test.rb
--- old/test/jbuilder_generator_test.rb 2016-05-30 23:10:24.000000000 +0200
+++ new/test/jbuilder_generator_test.rb 2016-07-21 00:55:51.000000000 +0200
@@ -14,19 +14,25 @@
     %w(index show).each do |view|
       assert_file "app/views/posts/#{view}.json.jbuilder"
     end
+    assert_file "app/views/posts/_post.json.jbuilder"
   end
 
   test 'index content' do
     run_generator
 
     assert_file 'app/views/posts/index.json.jbuilder' do |content|
-      assert_match /json\.array!\(@posts\) do \|post\|/, content
-      assert_match /json\.extract! post, :id, :title, :body/, content
-      assert_match /json\.url post_url\(post, format: :json\)/, content
+      assert_match /json.array! @posts, partial: 'posts\/post', as: :post/, 
content
     end
 
     assert_file 'app/views/posts/show.json.jbuilder' do |content|
-      assert_match /json\.extract! @post, :id, :title, :body, :created_at, 
:updated_at/, content
+      assert_match /json.partial! \"posts\/post\", post: @post/, content
+    end
+    
+    assert_file 'app/views/posts/_post.json.jbuilder' do |content|            
+      assert_match /json\.extract! post, :id, :title, :body/, content
+      assert_match /json\.url post_url\(post, format: :json\)/, content
     end
+    
+
   end
 end
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  2016-05-30 23:10:24.000000000 +0200
+++ new/test/jbuilder_template_test.rb  2016-07-21 00:55:51.000000000 +0200
@@ -332,6 +332,35 @@
     JBUILDER
   end
 
+  test "fragment caching uses fragment_cache_key" do
+    undef_context_methods :fragment_name_with_digest, :cache_fragment_name
+
+    @context.expects(:fragment_cache_key).with("cachekey")
+
+    jbuild <<-JBUILDER
+      json.cache! "cachekey" do
+        json.name "Cache"
+      end
+    JBUILDER
+  end
+
+  test "fragment caching instrumentation" do
+    undef_context_methods :fragment_name_with_digest, :cache_fragment_name
+
+    payloads = {}
+    ActiveSupport::Notifications.subscribe("read_fragment.action_controller") 
{ |*args| payloads[:read_fragment] = args.last }
+    ActiveSupport::Notifications.subscribe("write_fragment.action_controller") 
{ |*args| payloads[:write_fragment] = args.last }
+
+    jbuild <<-JBUILDER
+      json.cache! "cachekey" do
+        json.name "Cache"
+      end
+    JBUILDER
+
+    assert_equal "jbuilder/cachekey", payloads[:read_fragment][:key]
+    assert_equal "jbuilder/cachekey", payloads[:write_fragment][:key]
+  end
+
   test "current cache digest option accepts options" do
     undef_context_methods :fragment_name_with_digest
 
@@ -343,6 +372,18 @@
         json.name "Cache"
       end
     JBUILDER
+  end
+
+  test "fragment caching accepts expires_in option" do
+    undef_context_methods :fragment_name_with_digest
+
+    @context.expects(:cache_fragment_name).with("cachekey", {})
+
+    jbuild <<-JBUILDER
+      json.cache! "cachekey", expires_in: 1.minute do
+        json.name "Cache"
+      end
+    JBUILDER
   end
 
   test "does not perform caching when controller.perform_caching is false" do


Reply via email to