external_asset_pipeline 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 547629ac518b2b784df463acc7a930892f395d3d6537e1491a11b149fb12efb7
4
- data.tar.gz: aa861afcb41156923afa22e359d024f08b264fd8ff30280381f7aeefdfff3f70
3
+ metadata.gz: 277f7dca5593faff66735a6fa238128fc8a810d0d59e31afa461d9bbde910372
4
+ data.tar.gz: 0f2e02b7e3dc90821642e4315045394943b01594667e63f6d15cb60e94b657bd
5
5
  SHA512:
6
- metadata.gz: ae6bc9ebe73f48d7edb7eab1dc7e07f2318552336a34d9a26bf376f5cdf540da733d94b847d314879e322e0d4f45ed0cf34d30698460cd2dff56b2d92c38657c
7
- data.tar.gz: 1c9a91b49c48a3d00ac615a81459cdcbdc9dfaf3bedfb5417a298c37df6730a563096c9a24451c8c06e8c1eec3ece10ccf9ccacee62f7a3ff23e6ac86381c61c
6
+ metadata.gz: 68daf25b4678a9aa512ef5ba00a506ebca6205cf6ac8778ee507bf3d601a9b01992475755c512d31d4fe5a1877f407f6a4aaf2c994637d138b66fb8ef541df68
7
+ data.tar.gz: 4d1fbf67ea7d1d4ea56c3102f52b65239faa305f7568087d779515eb59cb7ea6e7fc250956cd0f359619fa426c3d32e5578ddce64a426406209201f047fe4d47
@@ -10,6 +10,7 @@ module ExternalAssetPipeline
10
10
  :fall_back_to_sprockets,
11
11
  :logger,
12
12
  :manifest_filename,
13
+ :prepend_assets_prefix_to_manifest_values,
13
14
  :public_path
14
15
 
15
16
  alias cache_manifest? cache_manifest
@@ -34,6 +35,11 @@ module ExternalAssetPipeline
34
35
  @fall_back_to_sprockets = false
35
36
  @logger = Logger.new(STDOUT)
36
37
  @manifest_filename = 'manifest.json'
38
+ @prepend_assets_prefix_to_manifest_values = true
39
+ end
40
+
41
+ def manifest_value_prefix
42
+ @prepend_assets_prefix_to_manifest_values ? "#{@assets_prefix}/" : ''
37
43
  end
38
44
 
39
45
  def configure
@@ -10,7 +10,7 @@ module ExternalAssetPipeline
10
10
 
11
11
  def find(name)
12
12
  value = data[name.to_s]
13
- { path: "#{@config.assets_prefix}/#{value}" } if value
13
+ { path: "#{@config.manifest_value_prefix}#{value}" } if value
14
14
  end
15
15
 
16
16
  def fall_back_to_sprockets?
@@ -18,10 +18,6 @@ module ExternalAssetPipeline
18
18
 
19
19
  private
20
20
 
21
- def data
22
- load
23
- end
24
-
25
21
  def load
26
22
  if @server.running?
27
23
  manifest_path = "#{@config.assets_prefix}/#{@config.manifest_filename}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ExternalAssetPipeline
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: external_asset_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Macklin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-19 00:00:00.000000000 Z
11
+ date: 2019-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -47,7 +47,6 @@ files:
47
47
  - lib/external_asset_pipeline/dev_server.rb
48
48
  - lib/external_asset_pipeline/helper.rb
49
49
  - lib/external_asset_pipeline/manifest.rb
50
- - lib/external_asset_pipeline/origin.rb
51
50
  - lib/external_asset_pipeline/priority_manifest.rb
52
51
  - lib/external_asset_pipeline/railtie.rb
53
52
  - lib/external_asset_pipeline/server_manifest.rb
@@ -57,8 +56,8 @@ licenses:
57
56
  - MIT
58
57
  metadata:
59
58
  homepage_uri: https://github.com/rails-front-end/external_asset_pipeline
60
- source_code_uri: https://github.com/rails-front-end/external_asset_pipeline/tree/v0.3.0
61
- changelog_uri: https://github.com/rails-front-end/external_asset_pipeline/blob/v0.3.0/CHANGELOG.md
59
+ source_code_uri: https://github.com/rails-front-end/external_asset_pipeline/tree/v0.4.0
60
+ changelog_uri: https://github.com/rails-front-end/external_asset_pipeline/blob/v0.4.0/CHANGELOG.md
62
61
  post_install_message:
63
62
  rdoc_options: []
64
63
  require_paths:
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
-
5
- # rubocop:disable all
6
- module ExternalAssetPipeline
7
- class Origin
8
- def initialize(server:, fallback:)
9
- @server = server
10
- @fallback = fallback
11
- end
12
-
13
- # USE THIS VERSION IF IT WORKS!
14
- # Run some tests in the demo app with different asset_host procs
15
- # _Might_ need to define this proc inside a module that includes
16
- # ActionView::Helpers::AssetUrlHelper in order for
17
- # compute_asset_host to be available - not sure.
18
- def call(source, request = nil)
19
- if @server.running?
20
- @server.origin
21
- else
22
- ComputeAssetHostProxy.new(request).call(source, host: @fallback)
23
- end
24
- end
25
-
26
- class ComputeAssetHostProxy
27
- include ActionView::Helpers::AssetUrlHelper
28
-
29
- attr_reader :request
30
-
31
- def initialize(request:)
32
- @request = request
33
- end
34
-
35
- def call(source, host:)
36
- compute_asset_host(source, host: host)
37
- end
38
- end
39
-
40
- def ugly_call(source, request)
41
- # Ugh, this is so ugly
42
- # the logic in the elsif branch is copied from
43
- # https://github.com/rails/rails/blob/b13a5cb83ea00d6a3d71320fd276ca21049c2544/actionview/lib/action_view/helpers/asset_url_helper.rb#L280-L284
44
- if server.running?
45
- server.origin
46
- elsif fallback.respond_to?(:call)
47
- arity =
48
- if fallback.respond_to?(:arity)
49
- host.arity
50
- else
51
- host.method(:call).arity
52
- end
53
- args = [source]
54
- args << request if request && (arity > 1 || arity < 0)
55
- fallback.call(*args)
56
- else
57
- fallback
58
- end
59
- end
60
- end
61
- end
62
- # rubocop:enable all