Hello community,
here is the log from the commit of package rubygem-sprockets-helpers for
openSUSE:Factory checked in at 2020-10-05 19:33:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-sprockets-helpers (Old)
and /work/SRC/openSUSE:Factory/.rubygem-sprockets-helpers.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-sprockets-helpers"
Mon Oct 5 19:33:59 2020 rev:3 rq:838085 version:1.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-sprockets-helpers/rubygem-sprockets-helpers.changes
2020-05-11 13:39:59.968947241 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-sprockets-helpers.new.4249/rubygem-sprockets-helpers.changes
2020-10-05 19:34:00.533251991 +0200
@@ -1,0 +2,6 @@
+Fri Sep 25 14:59:24 UTC 2020 - Stephan Kulow <[email protected]>
+
+updated to version 1.4.0
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
sprockets-helpers-1.3.0.gem
New:
----
sprockets-helpers-1.4.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-sprockets-helpers.spec ++++++
--- /var/tmp/diff_new_pack.J3IAOd/_old 2020-10-05 19:34:01.197252641 +0200
+++ /var/tmp/diff_new_pack.J3IAOd/_new 2020-10-05 19:34:01.197252641 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-sprockets-helpers
-Version: 1.3.0
+Version: 1.4.0
Release: 0
%define mod_name sprockets-helpers
%define mod_full_name %{mod_name}-%{version}
++++++ sprockets-helpers-1.3.0.gem -> sprockets-helpers-1.4.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2020-04-23 16:03:35.000000000 +0200
+++ new/README.md 2020-08-31 17:44:06.000000000 +0200
@@ -1,6 +1,6 @@
# sprockets-helpers
-**Asset path helpers for Sprockets 3.x & <= 2.2 applications**
+**Asset path helpers for Sprockets 4.x & 3.x & <= 2.2 applications**
Sprockets::Helpers adds the asset_path helpers, familiar to Rails developers,
to Sprockets 2.x assets and applications.
@@ -222,6 +222,10 @@
end
```
+## Roda Integration
+
+See: https://github.com/hmdne/roda-sprockets
+
## Copyright
Copyright (c) 2011 [Peter Browne](http://petebrowne.com). See LICENSE for
details.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/asset_path.rb
new/lib/sprockets/helpers/asset_path.rb
--- old/lib/sprockets/helpers/asset_path.rb 2020-04-23 16:03:35.000000000
+0200
+++ new/lib/sprockets/helpers/asset_path.rb 2020-08-31 17:44:06.000000000
+0200
@@ -7,10 +7,11 @@
@uri = uri
@asset = asset
@environment = environment
+ @options = options
@options = {
:body => false,
- :digest => Helpers.digest,
- :prefix => Helpers.prefix
+ :digest => sprockets_helpers_settings.digest,
+ :prefix => sprockets_helpers_settings.prefix
}.merge options
@uri.path = @options[:digest] ? asset.digest_path : asset.logical_path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/base_path.rb
new/lib/sprockets/helpers/base_path.rb
--- old/lib/sprockets/helpers/base_path.rb 2020-04-23 16:03:35.000000000
+0200
+++ new/lib/sprockets/helpers/base_path.rb 2020-08-31 17:44:06.000000000
+0200
@@ -17,6 +17,10 @@
@options = options
end
+ def sprockets_helpers_settings
+ @options[:sprockets_helpers_settings]
+ end
+
# Returns the full path to the asset, complete with
# timestamp.
def to_s
@@ -53,7 +57,7 @@
def compute_asset_host # :nodoc:
return nil if options[:asset_host] == false
- if host = options[:asset_host] || Helpers.asset_host
+ if host = options[:asset_host] || sprockets_helpers_settings.asset_host
if host.respond_to?(:call)
host.call(uri.to_s)
elsif host =~ /%d/
@@ -69,7 +73,7 @@
# Pick a scheme for the protocol if we are using
# an asset host.
def compute_scheme # :nodoc:
- protocol = options[:protocol] || Helpers.protocol
+ protocol = options[:protocol] || sprockets_helpers_settings.protocol
if protocol.nil? || protocol == :relative
nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/file_path.rb
new/lib/sprockets/helpers/file_path.rb
--- old/lib/sprockets/helpers/file_path.rb 2020-04-23 16:03:35.000000000
+0200
+++ new/lib/sprockets/helpers/file_path.rb 2020-08-31 17:44:06.000000000
+0200
@@ -25,7 +25,7 @@
# Returns the mtime for the given path (relative to
# the output path). Returns nil if the file doesn't exist.
def compute_mtime # :nodoc:
- public_path = File.join(Helpers.public_path, uri.path)
+ public_path = File.join(sprockets_helpers_settings.public_path,
uri.path)
if File.exist?(public_path)
File.mtime(public_path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/manifest_path.rb
new/lib/sprockets/helpers/manifest_path.rb
--- old/lib/sprockets/helpers/manifest_path.rb 2020-04-23 16:03:35.000000000
+0200
+++ new/lib/sprockets/helpers/manifest_path.rb 2020-08-31 17:44:06.000000000
+0200
@@ -5,9 +5,10 @@
class ManifestPath < AssetPath
def initialize(uri, path, options = {})
@uri = uri
+ @options = options
@options = {
:body => false,
- :prefix => Helpers.prefix
+ :prefix => sprockets_helpers_settings.prefix
}.merge options
@uri.path = path.to_s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/settings.rb
new/lib/sprockets/helpers/settings.rb
--- old/lib/sprockets/helpers/settings.rb 1970-01-01 01:00:00.000000000
+0100
+++ new/lib/sprockets/helpers/settings.rb 2020-08-31 17:44:06.000000000
+0200
@@ -0,0 +1,66 @@
+module Sprockets
+ module Helpers
+ class Settings
+ # Link to assets from a dedicated server.
+ attr_accessor :asset_host
+
+ # When true, the asset paths will return digest paths.
+ attr_accessor :digest
+
+ # When true, expand assets.
+ attr_accessor :expand
+
+ # When true, force debug mode
+ # :debug => true equals
+ # :expand => true (unless using >= Sprockets 4.0)
+ # :digest => false
+ # :manifest => false
+ attr_accessor :debug
+
+ # Set the Sprockets environment to search for assets.
+ # This defaults to the context's #environment method.
+ attr_accessor :environment
+
+ # The manifest file used for lookup
+ attr_accessor :manifest
+
+ # The base URL the Sprocket environment is mapped to.
+ # This defaults to '/assets'.
+ def prefix
+ @prefix ||= '/assets'
+ @prefix.is_a?(Array) ? "/#{@prefix.first}" : @prefix
+ end
+ attr_writer :prefix
+
+ # Customize the protocol when using asset hosts.
+ # If the value is :relative, A relative protocol ('//')
+ # will be used.
+ def protocol
+ @protocol ||= 'http://'
+ end
+ attr_writer :protocol
+
+ # The path to the public directory, where the assets
+ # not managed by Sprockets will be located.
+ # Defaults to './public'
+ def public_path
+ @public_path ||= './public'
+ end
+ attr_writer :public_path
+
+ # The default options for each asset path method. This is where you
+ # can change your default directories for the fallback directory.
+ def default_path_options
+ @default_path_options ||= {
+ :audio_path => { :dir => 'audios' },
+ :font_path => { :dir => 'fonts' },
+ :image_path => { :dir => 'images' },
+ :javascript_path => { :dir => 'javascripts', :ext => 'js' },
+ :stylesheet_path => { :dir => 'stylesheets', :ext => 'css' },
+ :video_path => { :dir => 'videos' }
+ }
+ end
+ attr_writer :default_path_options
+ end
+ end
+end
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers/version.rb
new/lib/sprockets/helpers/version.rb
--- old/lib/sprockets/helpers/version.rb 2020-04-23 16:03:35.000000000
+0200
+++ new/lib/sprockets/helpers/version.rb 2020-08-31 17:44:06.000000000
+0200
@@ -2,6 +2,6 @@
module Sprockets
module Helpers
- VERSION = '1.3.0'
+ VERSION = '1.4.0'
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/sprockets/helpers.rb new/lib/sprockets/helpers.rb
--- old/lib/sprockets/helpers.rb 2020-04-23 16:03:35.000000000 +0200
+++ new/lib/sprockets/helpers.rb 2020-08-31 17:44:06.000000000 +0200
@@ -4,78 +4,30 @@
require 'sprockets/helpers/asset_path'
require 'sprockets/helpers/file_path'
require 'sprockets/helpers/manifest_path'
+require 'sprockets/helpers/settings'
require 'uri'
+require 'forwardable'
module Sprockets
module Helpers
class << self
- # Indicates whenever we are using Sprockets 3.x.
- attr_accessor :are_using_sprockets_3
+ extend Forwardable
- # Link to assets from a dedicated server.
- attr_accessor :asset_host
+ # Indicates whenever we are using Sprockets 3.x or higher.
+ attr_accessor :are_using_sprockets_3_plus
- # When true, the asset paths will return digest paths.
- attr_accessor :digest
+ # Indicates whenever we are using Sprockets 4.x or higher.
+ attr_accessor :are_using_sprockets_4_plus
- # When true, expand assets.
- attr_accessor :expand
-
- # When true, force debug mode
- # :debug => true equals
- # :expand => true
- # :digest => false
- # :manifest => false
- attr_accessor :debug
-
- # Set the Sprockets environment to search for assets.
- # This defaults to the context's #environment method.
- attr_accessor :environment
-
- # The manifest file used for lookup
- attr_accessor :manifest
-
- # The base URL the Sprocket environment is mapped to.
- # This defaults to '/assets'.
- def prefix
- @prefix ||= '/assets'
- @prefix.is_a?(Array) ? "/#{@prefix.first}" : @prefix
- end
- attr_writer :prefix
-
- # Customize the protocol when using asset hosts.
- # If the value is :relative, A relative protocol ('//')
- # will be used.
- def protocol
- @protocol ||= 'http://'
- end
- attr_writer :protocol
+ # Settings of Sprockets::Helpers
+ attr_accessor :settings
- # The path to the public directory, where the assets
- # not managed by Sprockets will be located.
- # Defaults to './public'
- def public_path
- @public_path ||= './public'
- end
- attr_writer :public_path
-
- # The default options for each asset path method. This is where you
- # can change your default directories for the fallback directory.
- def default_path_options
- @default_path_options ||= {
- :audio_path => { :dir => 'audios' },
- :font_path => { :dir => 'fonts' },
- :image_path => { :dir => 'images' },
- :javascript_path => { :dir => 'javascripts', :ext => 'js' },
- :stylesheet_path => { :dir => 'stylesheets', :ext => 'css' },
- :video_path => { :dir => 'videos' }
- }
- end
- attr_writer :default_path_options
+ # Access the settings directly for compatibility purposes.
+ def_delegators :@settings, *Settings.public_instance_methods(false)
# Convience method for configuring Sprockets::Helpers.
def configure
- yield self
+ yield settings
end
# Hack to ensure methods from Sprockets::Helpers override the
@@ -92,8 +44,11 @@
end
end
+ @settings = Settings.new
+
# We are checking here to skip this at runtime
- @are_using_sprockets_3 = Gem::Version.new(Sprockets::VERSION) >=
Gem::Version.new('3.0')
+ @are_using_sprockets_3_plus = Gem::Version.new(Sprockets::VERSION) >=
Gem::Version.new('3.0')
+ @are_using_sprockets_4_plus = Gem::Version.new(Sprockets::VERSION) >=
Gem::Version.new('4.0')
# Returns the path to an asset either in the Sprockets environment
# or the public directory. External URIs are untouched.
@@ -128,9 +83,9 @@
uri = URI.parse(source)
return source if uri.absolute?
- options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]
+ options[:prefix] = sprockets_helpers_settings.prefix unless
options[:prefix]
- if Helpers.debug || options[:debug]
+ if sprockets_helpers_settings.debug || options[:debug]
options[:manifest] = false
options[:digest] = false
options[:asset_host] = false
@@ -153,7 +108,9 @@
def asset_tag(source, options = {}, &block)
raise ::ArgumentError, 'block missing' unless block
- options = { :expand => !!Helpers.debug || !!Helpers.expand, :debug =>
Helpers.debug }.merge(options)
+ options = { :expand => (!!sprockets_helpers_settings.debug &&
!::Sprockets::Helpers.are_using_sprockets_4_plus) ||
+ !!sprockets_helpers_settings.expand,
+ :debug => sprockets_helpers_settings.debug }.merge(options)
path = asset_path(source, options)
output = if options[:expand] && path.respond_to?(:map)
@@ -167,7 +124,7 @@
end
def javascript_tag(source, options = {})
- options = Helpers.default_path_options[:javascript_path].merge(options)
+ options =
sprockets_helpers_settings.default_path_options[:javascript_path].merge(options)
asset_tag(source, options) do |path|
%Q(<script src="#{path}" type="text/javascript"></script>)
end
@@ -176,7 +133,7 @@
def stylesheet_tag(source, options = {})
media = options.delete(:media)
media_attr = media.nil? ? nil : " media=\"#{media}\""
- options = Helpers.default_path_options[:stylesheet_path].merge(options)
+ options =
sprockets_helpers_settings.default_path_options[:stylesheet_path].merge(options)
asset_tag(source, options) do |path|
%Q(<link rel="stylesheet" type="text/css" href="#{path}"#{media_attr}>)
end
@@ -202,7 +159,7 @@
# audio_path 'http://www.example.com/img/audio.mp3' # =>
'http://www.example.com/img/audio.mp3'
#
def audio_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:audio_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:audio_path].merge(options)
end
alias_method :path_to_audio, :audio_path
@@ -226,7 +183,7 @@
# font_path 'http://www.example.com/img/font.ttf' # =>
'http://www.example.com/img/font.ttf'
#
def font_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:font_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:font_path].merge(options)
end
alias_method :path_to_font, :font_path
@@ -250,7 +207,7 @@
# image_path 'http://www.example.com/img/edit.png' # =>
'http://www.example.com/img/edit.png'
#
def image_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:image_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:image_path].merge(options)
end
alias_method :path_to_image, :image_path
@@ -275,7 +232,7 @@
# javascript_path 'http://www.example.com/js/xmlhr.js' # =>
'http://www.example.com/js/xmlhr.js'
#
def javascript_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:javascript_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:javascript_path].merge(options)
end
alias_method :path_to_javascript, :javascript_path
@@ -300,7 +257,7 @@
# stylesheet_path 'http://www.example.com/css/style.css' # =>
'http://www.example.com/css/style.css'
#
def stylesheet_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:stylesheet_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:stylesheet_path].merge(options)
end
alias_method :path_to_stylesheet, :stylesheet_path
@@ -324,7 +281,7 @@
# video_path 'http://www.example.com/img/video.mp4' # =>
'http://www.example.com/img/video.mp4'
#
def video_path(source, options = {})
- asset_path source,
Helpers.default_path_options[:video_path].merge(options)
+ asset_path source,
sprockets_helpers_settings.default_path_options[:video_path].merge(options)
end
alias_method :path_to_video, :video_path
@@ -332,19 +289,38 @@
# Returns the Sprockets environment #asset_path uses to search for
# assets. This can be overridden for more control, if necessary.
- # Defaults to Sprockets::Helpers.environment or the envrionment
+ # For even more control, you just need to override
#sprockets_helper_settings.
+ # Defaults to sprockets_helpers_settings.environment or the environment
# returned by #environment.
def assets_environment
- Helpers.environment || environment
+ sprockets_helpers_settings.environment || environment
+ end
+
+ # Returns the Sprockets helpers settings. This can be overridden for
+ # more control, for instance if you want to support polyinstantiation
+ # in your application.
+ def sprockets_helpers_settings
+ Helpers.settings
end
def find_asset_path(uri, source, options = {})
- if Helpers.manifest && options[:manifest] != false
- manifest_path = Helpers.manifest.assets[uri.path]
+ options = options.merge(:sprockets_helpers_settings =>
sprockets_helpers_settings,
+ :debug => sprockets_helpers_settings.debug)
+
+ if sprockets_helpers_settings.manifest && options[:manifest] != false
+ manifest_path = sprockets_helpers_settings.manifest.assets[uri.path]
return Helpers::ManifestPath.new(uri, manifest_path, options) if
manifest_path
end
- if Sprockets::Helpers.are_using_sprockets_3
+ if Sprockets::Helpers.are_using_sprockets_4_plus
+ resolved, _ = assets_environment.resolve(uri.path, pipeline:
options[:debug] ? :debug : nil)
+
+ if resolved
+ return Helpers::AssetPath.new(uri, assets_environment[uri.path,
pipeline: options[:debug] ? :debug : nil], assets_environment, options)
+ else
+ return Helpers::FilePath.new(uri, options)
+ end
+ elsif Sprockets::Helpers.are_using_sprockets_3_plus
resolved, _ = assets_environment.resolve(uri.path)
if resolved
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2020-04-23 16:03:35.000000000 +0200
+++ new/metadata 2020-08-31 17:44:06.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: sprockets-helpers
version: !ruby/object:Gem::Version
- version: 1.3.0
+ version: 1.4.0
platform: ruby
authors:
- Pete Browne
-autorequire:
+autorequire:
bindir: bin
cert_chain: []
-date: 2020-04-23 00:00:00.000000000 Z
+date: 2020-08-31 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: sprockets
@@ -129,6 +129,7 @@
- lib/sprockets/helpers/base_path.rb
- lib/sprockets/helpers/file_path.rb
- lib/sprockets/helpers/manifest_path.rb
+- lib/sprockets/helpers/settings.rb
- lib/sprockets/helpers/version.rb
- spec/spec_helper.rb
- spec/sprockets-helpers_spec.rb
@@ -137,7 +138,7 @@
licenses:
- MIT
metadata: {}
-post_install_message:
+post_install_message:
rdoc_options: []
require_paths:
- lib
@@ -152,8 +153,8 @@
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.0.1
-signing_key:
+rubygems_version: 3.0.3
+signing_key:
specification_version: 4
summary: Asset path helpers for Sprockets 2.x & 3.x applications
test_files: