hanami-assets 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/hanami-assets.gemspec +1 -1
- data/lib/hanami/assets/bundler/manifest_entry.rb +1 -1
- data/lib/hanami/assets/compiler.rb +12 -3
- data/lib/hanami/assets/compilers/less.rb +1 -1
- data/lib/hanami/assets/compilers/sass.rb +1 -1
- data/lib/hanami/assets/configuration.rb +17 -0
- data/lib/hanami/assets/helpers.rb +5 -7
- data/lib/hanami/assets/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3eca9645ece86fd7d459f856d4bd5927218a0bf2793800d79893f182802b3e8
|
4
|
+
data.tar.gz: ce397508bfee8960426520195c3a9916f782e816add006c936d53a36fccb6c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e0993d7081bdb900809b102654b2cd808a020e8e210c4e54b475b1d89f13c500f0ae636622972f737c342671715a0e4067f9c508f92e9fbf1e953b045d18852
|
7
|
+
data.tar.gz: ad68fce253795abe8b209d694205db4c239ede2cc9c6553126e2a214093ed0f76dd20dd480a114ebfdaa77a0fc4e76dbed445ee78bba748ff85a25875df7cbed
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Hanami::Assets
|
2
2
|
Assets management for Ruby web applications
|
3
3
|
|
4
|
+
## v1.3.1 - 2019-01-18
|
5
|
+
### Added
|
6
|
+
- [Luca Guidi] Official support for Ruby: MRI 2.6
|
7
|
+
- [Luca Guidi] Support `bundler` 2.0+
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- [Luca Guidi] Make optional nested assets feature to maintain backward compatibility with `1.2.x`
|
11
|
+
|
4
12
|
## v1.3.0 - 2018-10-24
|
5
13
|
|
6
14
|
## v1.3.0.beta1 - 2018-08-08
|
data/hanami-assets.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency 'hanami-helpers', '~> 1.3'
|
25
25
|
spec.add_runtime_dependency 'tilt', '~> 2.0', '>= 2.0.2'
|
26
26
|
|
27
|
-
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'bundler', '>= 1.6', '< 3'
|
28
28
|
spec.add_development_dependency 'rake', '~> 12.0'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
30
30
|
|
@@ -177,11 +177,10 @@ module Hanami
|
|
177
177
|
relative_destination_name(name: Pathname.new(result), add_prefix: false)
|
178
178
|
end
|
179
179
|
|
180
|
-
# @since
|
180
|
+
# @since 1.3.0
|
181
181
|
# @api private
|
182
182
|
def destination_name
|
183
|
-
result =
|
184
|
-
result = result.to_s
|
183
|
+
result = destination_path
|
185
184
|
|
186
185
|
if compile?
|
187
186
|
result.scan(/\A[[[:alnum:]][\-\_]]*\.[[\w]]*/).first || result
|
@@ -190,6 +189,16 @@ module Hanami
|
|
190
189
|
end
|
191
190
|
end
|
192
191
|
|
192
|
+
# @since 1.3.1
|
193
|
+
# @api private
|
194
|
+
def destination_path
|
195
|
+
if @configuration.nested
|
196
|
+
@name.relative? ? relative_destination_name : absolute_destination_name
|
197
|
+
else
|
198
|
+
::File.basename(@name)
|
199
|
+
end.to_s
|
200
|
+
end
|
201
|
+
|
193
202
|
# @since 0.1.0
|
194
203
|
# @api private
|
195
204
|
def exist?
|
@@ -129,6 +129,17 @@ module Hanami
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
# Support for nested path
|
133
|
+
#
|
134
|
+
# @since 1.3.1
|
135
|
+
def nested(value = nil)
|
136
|
+
if value.nil?
|
137
|
+
@nested
|
138
|
+
else
|
139
|
+
@nested = !!value # rubocop:disable Style/DoubleNegation
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
132
143
|
# Subresource integrity mode
|
133
144
|
#
|
134
145
|
# Determine if the helpers should generate the integrity attribute for an
|
@@ -506,6 +517,7 @@ module Hanami
|
|
506
517
|
c.subresource_integrity = subresource_integrity
|
507
518
|
c.cdn = cdn
|
508
519
|
c.compile = compile
|
520
|
+
c.nested = nested
|
509
521
|
c.public_directory = public_directory
|
510
522
|
c.manifest = manifest
|
511
523
|
c.sources = sources.dup
|
@@ -526,6 +538,7 @@ module Hanami
|
|
526
538
|
@cdn = false
|
527
539
|
@fingerprint = false
|
528
540
|
@compile = false
|
541
|
+
@nested = false
|
529
542
|
@base_url = nil
|
530
543
|
@destination_directory = nil
|
531
544
|
@public_manifest = Config::NullManifest.new(self)
|
@@ -569,6 +582,10 @@ module Hanami
|
|
569
582
|
# @api private
|
570
583
|
attr_writer :compile
|
571
584
|
|
585
|
+
# @since 1.3.1
|
586
|
+
# @api private
|
587
|
+
attr_writer :nested
|
588
|
+
|
572
589
|
# @since 0.1.0
|
573
590
|
# @api private
|
574
591
|
attr_writer :scheme
|
@@ -65,7 +65,7 @@ module Hanami
|
|
65
65
|
|
66
66
|
# @since 1.1.0
|
67
67
|
# @api private
|
68
|
-
QUERY_STRING_MATCHER =
|
68
|
+
QUERY_STRING_MATCHER = /\?/.freeze
|
69
69
|
|
70
70
|
include Hanami::Helpers::HtmlHelper
|
71
71
|
|
@@ -181,7 +181,7 @@ module Hanami
|
|
181
181
|
|
182
182
|
_safe_tags(*sources) do |source|
|
183
183
|
attributes = {
|
184
|
-
src:
|
184
|
+
src: _typed_asset_path(source, JAVASCRIPT_EXT, push: push, as: :script),
|
185
185
|
type: JAVASCRIPT_MIME_TYPE
|
186
186
|
}
|
187
187
|
attributes.merge!(options)
|
@@ -284,7 +284,7 @@ module Hanami
|
|
284
284
|
attributes = {
|
285
285
|
href: _typed_asset_path(source, STYLESHEET_EXT, push: push, as: :style),
|
286
286
|
type: STYLESHEET_MIME_TYPE,
|
287
|
-
rel:
|
287
|
+
rel: STYLESHEET_REL
|
288
288
|
}
|
289
289
|
attributes.merge!(options)
|
290
290
|
|
@@ -445,7 +445,7 @@ module Hanami
|
|
445
445
|
|
446
446
|
attributes = {
|
447
447
|
href: asset_path(source, push: options.delete(:push) || false, as: :image),
|
448
|
-
rel:
|
448
|
+
rel: FAVICON_REL,
|
449
449
|
type: FAVICON_MIME_TYPE
|
450
450
|
}
|
451
451
|
attributes.merge!(options)
|
@@ -909,9 +909,7 @@ module Hanami
|
|
909
909
|
options[:src] = asset_path(src, push: options.delete(:push) || false, as: as)
|
910
910
|
end
|
911
911
|
|
912
|
-
if !options[:src] && !block_given?
|
913
|
-
raise ArgumentError.new('You should provide a source via `src` option or with a `source` HTML tag')
|
914
|
-
end
|
912
|
+
raise ArgumentError.new('You should provide a source via `src` option or with a `source` HTML tag') if !options[:src] && !block_given?
|
915
913
|
|
916
914
|
options
|
917
915
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -64,14 +64,20 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '1.6'
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3'
|
68
71
|
type: :development
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
75
|
- - ">="
|
73
76
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
77
|
+
version: '1.6'
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '3'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: rake
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,8 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
250
|
- !ruby/object:Gem::Version
|
245
251
|
version: '0'
|
246
252
|
requirements: []
|
247
|
-
|
248
|
-
rubygems_version: 2.7.7
|
253
|
+
rubygems_version: 3.0.2
|
249
254
|
signing_key:
|
250
255
|
specification_version: 4
|
251
256
|
summary: Assets management
|