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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 656523e5106429d46d4ef06f9e49a9d8b0c7c6e9a5887034137ee94959833827
4
- data.tar.gz: a9a823309ae222cf1fdaf789fd0619c51649abddd8cd11d8235516cd2a725edf
3
+ metadata.gz: f3eca9645ece86fd7d459f856d4bd5927218a0bf2793800d79893f182802b3e8
4
+ data.tar.gz: ce397508bfee8960426520195c3a9916f782e816add006c936d53a36fccb6c56
5
5
  SHA512:
6
- metadata.gz: ea5984af832c0541ad530607e548b77c35a265fcf30bb38f439424b17834766ec2ee14d1e04964f58a86332e42ee90a1e5a19f8be158e5f7cad81a831ca61e30
7
- data.tar.gz: 58d11b450a70857fe77fb6eb157eca3109fcd34ebda8bfa515bbe728248aa2a22935f0055c1df96345bd40f8c0b74f554957495b30af50be1e4d612f04aad779
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
@@ -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
 
@@ -38,7 +38,7 @@ module Hanami
38
38
  def values
39
39
  Hash[
40
40
  target: _convert_to_url(@asset.expanded_fingerprinted_target),
41
- sri: subresource_integrity_values
41
+ sri: subresource_integrity_values
42
42
  ]
43
43
  end
44
44
 
@@ -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 0.1.0
180
+ # @since 1.3.0
181
181
  # @api private
182
182
  def destination_name
183
- result = @name.relative? ? relative_destination_name : absolute_destination_name
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?
@@ -8,7 +8,7 @@ module Hanami
8
8
  class Less < Compiler
9
9
  # @since 0.3.0
10
10
  # @api private
11
- EXTENSIONS = /\.(less)\z/
11
+ EXTENSIONS = /\.(less)\z/.freeze
12
12
 
13
13
  # @since 0.3.0
14
14
  # @api private
@@ -8,7 +8,7 @@ module Hanami
8
8
  class Sass < Compiler
9
9
  # @since 0.3.0
10
10
  # @api private
11
- EXTENSIONS = /\.(sass|scss)\z/
11
+ EXTENSIONS = /\.(sass|scss)\z/.freeze
12
12
 
13
13
  # @since 0.1.0
14
14
  # @api private
@@ -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: _typed_asset_path(source, JAVASCRIPT_EXT, push: push, as: :script),
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: STYLESHEET_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: FAVICON_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
@@ -3,6 +3,6 @@ module Hanami
3
3
  # Defines the version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '1.3.0'.freeze
6
+ VERSION = '1.3.1'.freeze
7
7
  end
8
8
  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.0
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: 2018-10-24 00:00:00.000000000 Z
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: '0'
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: '0'
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
- rubyforge_project:
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