Hello community,

here is the log from the commit of package rubygem-sprockets for 
openSUSE:Factory checked in at 2016-04-28 16:53:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-sprockets (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-sprockets.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-sprockets"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-sprockets/rubygem-sprockets.changes      
2015-12-01 09:18:49.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-sprockets.new/rubygem-sprockets.changes 
2016-04-28 16:56:49.000000000 +0200
@@ -1,0 +2,39 @@
+Thu Apr  7 04:40:02 UTC 2016 - [email protected]
+
+- updated to version 3.6.0
+ see installed CHANGELOG.md
+
+-------------------------------------------------------------------
+Sat Dec 12 05:31:55 UTC 2015 - [email protected]
+
+- updated to version 3.5.2
+ see installed CHANGELOG.md
+
+  **3.5.2** (December 8, 2015)
+  
+  * Fix JRuby bug with concurrent-ruby.
+  * Fix disabling gzip generation in cached environments.
+
+-------------------------------------------------------------------
+Tue Dec  8 05:33:34 UTC 2015 - [email protected]
+
+- updated to version 3.5.1
+ see installed CHANGELOG.md
+
+  **3.5.1** (December 5, 2015)
+  
+  * Fix gzip asset generation for assets already on disk.
+
+-------------------------------------------------------------------
+Fri Dec  4 05:32:38 UTC 2015 - [email protected]
+
+- updated to version 3.5.0
+ see installed CHANGELOG.md
+
+  **Master**
+  
+  **3.5.0** (December 3, 2015)
+  
+  * Reintroduce Gzip file generation for non-binary assets.
+
+-------------------------------------------------------------------

Old:
----
  sprockets-3.4.1.gem

New:
----
  sprockets-3.6.0.gem

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

Other differences:
------------------
++++++ rubygem-sprockets.spec ++++++
--- /var/tmp/diff_new_pack.mcc8ap/_old  2016-04-28 16:56:49.000000000 +0200
+++ /var/tmp/diff_new_pack.mcc8ap/_new  2016-04-28 16:56:49.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-sprockets
 #
-# Copyright (c) 2015 SUSE LINUX 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
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-sprockets
-Version:        3.4.1
+Version:        3.6.0
 Release:        0
 %define mod_name sprockets
 %define mod_full_name %{mod_name}-%{version}

++++++ sprockets-3.4.1.gem -> sprockets-3.6.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md    2015-11-25 18:53:36.000000000 +0100
+++ new/CHANGELOG.md    2016-04-06 20:20:58.000000000 +0200
@@ -1,3 +1,22 @@
+**3.6.0** (April 6, 2016)
+
+* Add `Manifest#find_sources` to return the source of the compiled assets.
+* Fix the list of compressable mime types.
+* Improve performance of the `FileStore` cache.
+
+**3.5.2** (December 8, 2015)
+
+* Fix JRuby bug with concurrent-ruby.
+* Fix disabling gzip generation in cached environments.
+
+**3.5.1** (December 5, 2015)
+
+* Fix gzip asset generation for assets already on disk.
+
+**3.5.0** (December 3, 2015)
+
+* Reintroduce Gzip file generation for non-binary assets.
+
 **3.4.1** (November 25, 2015)
 
 * PathUtils::Entries will no longer error on an empty directory.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md       2015-11-25 18:53:36.000000000 +0100
+++ new/README.md       2016-04-06 20:20:58.000000000 +0200
@@ -20,6 +20,16 @@
 gem 'sprockets', '~> 3.0'
 ```
 
+## Using sprockets
+
+For most people interested in using sprockets you will want to see [End User 
Asset Generation](guides/end_user_asset_generation.md) guide. This contains 
information about sprocket's directive syntax, and default processing behavior.
+
+If you are a framework developer that is using sprockets, see [Building an 
Asset Processing Framework](guides/building_an_asset_processing_framework.md).
+
+If you are a library developer who is extending the functionality of 
sprockets, see [Extending Sprockets](guides/extending_sprockets.md).
+
+Below is a disjointed mix of documentation for all three of these roles. 
Eventually they will be moved to an appropriate guide, for now the recommended 
way to consume documentation is to view the appropriate guide first and then 
supplement with docs from the README.
+
 ## Behavior
 
 ### Index files are proxies for folders
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/cache.rb new/lib/sprockets/cache.rb
--- old/lib/sprockets/cache.rb  2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/cache.rb  2016-04-06 20:20:58.000000000 +0200
@@ -153,7 +153,9 @@
       #
       # Returns a String with a length less than 250 characters.
       def expand_key(key)
-        
"sprockets/v#{VERSION}/#{DigestUtils.pack_urlsafe_base64digest(DigestUtils.digest(key))}"
+        digest_key = 
DigestUtils.pack_urlsafe_base64digest(DigestUtils.digest(key))
+        namespace = digest_key[0, 2]
+        "sprockets/v#{VERSION}/#{namespace}/#{digest_key}"
       end
 
       PEEK_SIZE = 100
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/compressing.rb 
new/lib/sprockets/compressing.rb
--- old/lib/sprockets/compressing.rb    2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/compressing.rb    2016-04-06 20:20:58.000000000 +0200
@@ -70,5 +70,25 @@
 
       register_bundle_processor 'application/javascript', klass
     end
+
+    # Public: Checks if Gzip is enabled.
+    def gzip?
+      config[:gzip_enabled]
+    end
+
+    # Public: Checks if Gzip is disabled.
+    def skip_gzip?
+      !gzip?
+    end
+
+    # Public: Enable or disable the creation of Gzip files.
+    #
+    # Defaults to true.
+    #
+    #     environment.gzip = false
+    #
+    def gzip=(gzip)
+      self.config = config.merge(gzip_enabled: gzip).freeze
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/loader.rb new/lib/sprockets/loader.rb
--- old/lib/sprockets/loader.rb 2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/loader.rb 2016-04-06 20:20:58.000000000 +0200
@@ -143,11 +143,10 @@
           })
           validate_processor_result!(result)
           source = result.delete(:data)
-          metadata = result.merge!(
-            charset: source.encoding.name.downcase,
-            digest: digest(source),
-            length: source.bytesize
-          )
+          metadata = result
+          metadata[:charset] = source.encoding.name.downcase unless 
metadata.key?(:charset)
+          metadata[:digest]  = digest(source)
+          metadata[:length]  = source.bytesize
         else
           dependencies << build_file_digest_uri(unloaded.filename)
           metadata = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/manifest.rb 
new/lib/sprockets/manifest.rb
--- old/lib/sprockets/manifest.rb       2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/manifest.rb       2016-04-06 20:20:58.000000000 +0200
@@ -1,6 +1,10 @@
 require 'json'
 require 'time'
+
+require 'concurrent'
+
 require 'sprockets/manifest_utils'
+require 'sprockets/utils/gzip'
 
 module Sprockets
   # The Manifest logs the contents of assets compiled to a single directory. It
@@ -145,6 +149,23 @@
       nil
     end
 
+    # Public: Find the source of assets by paths.
+    #
+    # Returns Enumerator of assets file content.
+    def find_sources(*args)
+      return to_enum(__method__, *args) unless block_given?
+
+      if environment
+        find(*args).each do |asset|
+          yield asset.source
+        end
+      else
+        args.each do |path|
+          yield File.binread(File.join(dir, assets[path]))
+        end
+      end
+    end
+
     # Compile and write asset to directory. The asset is written to a
     # fingerprinted filename like
     # `application-2e8e9a7c6b0aafa0c9bdeec90ea30213.js`. An entry is
@@ -157,7 +178,9 @@
         raise Error, "manifest requires environment for compilation"
       end
 
-      filenames = []
+      filenames              = []
+      concurrent_compressors = []
+      concurrent_writers     = []
 
       find(*args) do |asset|
         files[asset.digest_path] = {
@@ -183,11 +206,28 @@
           logger.debug "Skipping #{target}, already exists"
         else
           logger.info "Writing #{target}"
-          asset.write_to target
+          write_file = Concurrent::Future.execute { asset.write_to target }
+          concurrent_writers << write_file
         end
-
         filenames << asset.filename
+
+        next if environment.skip_gzip?
+        gzip = Utils::Gzip.new(asset)
+        next if gzip.cannot_compress?(environment.mime_types)
+
+        if File.exist?("#{target}.gz")
+          logger.debug "Skipping #{target}.gz, already exists"
+        else
+          logger.info "Writing #{target}.gz"
+          concurrent_compressors << Concurrent::Future.execute do
+            write_file.wait! if write_file
+            gzip.compress(target)
+          end
+        end
+
       end
+      concurrent_writers.each(&:wait!)
+      concurrent_compressors.each(&:wait!)
       save
 
       filenames
@@ -200,6 +240,7 @@
     #
     def remove(filename)
       path = File.join(dir, filename)
+      gzip = "#{path}.gz"
       logical_path = files[filename]['logical_path']
 
       if assets[logical_path] == filename
@@ -208,6 +249,7 @@
 
       files.delete(filename)
       FileUtils.rm(path) if File.exist?(path)
+      FileUtils.rm(gzip) if File.exist?(gzip)
 
       save
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/path_utils.rb 
new/lib/sprockets/path_utils.rb
--- old/lib/sprockets/path_utils.rb     2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/path_utils.rb     2016-04-06 20:20:58.000000000 +0200
@@ -1,5 +1,3 @@
-require 'fileutils'
-
 module Sprockets
   # Internal: File and path related utilities. Mixed into Environment.
   #
@@ -276,9 +274,9 @@
         yield f
       end
 
-      FileUtils.mv(tmpname, filename)
+      File.rename(tmpname, filename)
     ensure
-      FileUtils.rm(tmpname) if File.exist?(tmpname)
+      File.delete(tmpname) if File.exist?(tmpname)
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/utils/gzip.rb 
new/lib/sprockets/utils/gzip.rb
--- old/lib/sprockets/utils/gzip.rb     1970-01-01 01:00:00.000000000 +0100
+++ new/lib/sprockets/utils/gzip.rb     2016-04-06 20:20:58.000000000 +0200
@@ -0,0 +1,67 @@
+module Sprockets
+  module Utils
+    class Gzip
+      # Private: Generates a gzipped file based off of reference file.
+      def initialize(asset)
+        @content_type  = asset.content_type
+        @source        = asset.source
+        @charset       = asset.charset
+      end
+
+      # What non-text mime types should we compress? This list comes from:
+      # 
https://www.fastly.com/blog/new-gzip-settings-and-deciding-what-compress
+      COMPRESSABLE_MIME_TYPES = {
+        "application/vnd.ms-fontobject" => true,
+        "application/x-font-opentype" => true,
+        "application/x-font-ttf" => true,
+        "image/x-icon" => true,
+        "image/svg+xml" => true
+      }
+
+      # Private: Returns whether or not an asset can be compressed.
+      #
+      # We want to compress any file that is text based.
+      # You do not want to compress binary
+      # files as they may already be compressed and running them
+      # through a compression algorithm would make them larger.
+      #
+      # Return Boolean.
+      def can_compress?(mime_types)
+        # The "charset" of a mime type is present if the value is
+        # encoded text. We can check this value to see if the asset
+        # can be compressed.
+        #
+        # We also check against our list of non-text compressible mime types
+        @charset || COMPRESSABLE_MIME_TYPES.include?(@content_type)
+      end
+
+      # Private: Opposite of `can_compress?`.
+      #
+      # Returns Boolean.
+      def cannot_compress?(mime_types)
+        !can_compress?(mime_types)
+      end
+
+      # Private: Generates a gzipped file based off of reference asset.
+      #
+      # Compresses the target asset's contents and puts it into a file with
+      # the same name plus a `.gz` extension in the same folder as the 
original.
+      # Does not modify the target asset.
+      #
+      # Returns nothing.
+      def compress(target)
+        mtime = PathUtils.stat(target).mtime
+        PathUtils.atomic_write("#{target}.gz") do |f|
+          gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
+          gz.mtime = mtime
+          gz.write(@source)
+          gz.close
+
+          File.utime(mtime, mtime, f.path)
+        end
+
+        nil
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets/version.rb new/lib/sprockets/version.rb
--- old/lib/sprockets/version.rb        2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets/version.rb        2016-04-06 20:20:58.000000000 +0200
@@ -1,3 +1,3 @@
 module Sprockets
-  VERSION = "3.4.1"
+  VERSION = "3.6.0"
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/sprockets.rb new/lib/sprockets.rb
--- old/lib/sprockets.rb        2015-11-25 18:53:36.000000000 +0100
+++ new/lib/sprockets.rb        2016-04-06 20:20:58.000000000 +0200
@@ -33,7 +33,8 @@
     registered_transformers: Hash.new { |h, k| {}.freeze }.freeze,
     root: File.expand_path('..', __FILE__).freeze,
     transformers: Hash.new { |h, k| {}.freeze }.freeze,
-    version: ""
+    version: "",
+    gzip_enabled: true
   }.freeze
   self.computed_config = {}
 
@@ -75,6 +76,7 @@
 
   # Common font types
   register_mime_type 'application/vnd.ms-fontobject', extensions: ['.eot']
+  register_mime_type 'application/x-font-opentype', extensions: ['.otf']
   register_mime_type 'application/x-font-ttf', extensions: ['.ttf']
   register_mime_type 'application/font-woff', extensions: ['.woff']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-11-25 18:53:36.000000000 +0100
+++ new/metadata        2016-04-06 20:20:58.000000000 +0200
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: sprockets
 version: !ruby/object:Gem::Version
-  version: 3.4.1
+  version: 3.6.0
 platform: ruby
 authors:
 - Sam Stephenson
@@ -9,7 +9,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-11-25 00:00:00.000000000 Z
+date: 2016-04-06 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: rack
@@ -32,6 +32,20 @@
       - !ruby/object:Gem::Version
         version: '3'
 - !ruby/object:Gem::Dependency
+  name: concurrent-ruby
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - "~>"
+      - !ruby/object:Gem::Version
+        version: '1.0'
+  type: :runtime
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - "~>"
+      - !ruby/object:Gem::Version
+        version: '1.0'
+- !ruby/object:Gem::Dependency
   name: closure-compiler
   requirement: !ruby/object:Gem::Requirement
     requirements:
@@ -295,6 +309,7 @@
 - lib/sprockets/uri_tar.rb
 - lib/sprockets/uri_utils.rb
 - lib/sprockets/utils.rb
+- lib/sprockets/utils/gzip.rb
 - lib/sprockets/version.rb
 - lib/sprockets/yui_compressor.rb
 homepage: https://github.com/rails/sprockets
@@ -317,7 +332,7 @@
       version: '0'
 requirements: []
 rubyforge_project: sprockets
-rubygems_version: 2.5.0
+rubygems_version: 2.5.1
 signing_key: 
 specification_version: 4
 summary: Rack-based asset packaging system


Reply via email to