rails-assets-manifest 2.1.2 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +25 -19
- data/.markdownlint.yaml +22 -0
- data/.rubocop.yml +5 -46
- data/Appraisals +4 -4
- data/CHANGELOG.md +44 -14
- data/Gemfile +6 -3
- data/README.md +30 -10
- data/gemfiles/rails_5.2.gemfile +4 -1
- data/gemfiles/rails_6.0.gemfile +4 -1
- data/gemfiles/rails_6.1.gemfile +4 -1
- data/gemfiles/{rails_master.gemfile → rails_7.0.gemfile} +5 -2
- data/lib/rails/assets/manifest/helper.rb +4 -12
- data/lib/rails/assets/manifest/manifest.rb +5 -9
- data/lib/rails/assets/manifest/railtie.rb +6 -11
- data/lib/rails/assets/manifest/version.rb +4 -4
- data/lib/rails/assets/manifest.rb +5 -4
- data/rails-assets-manifest.gemspec +6 -3
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5974a3b4fff5b1fe7707a7df0aaaf7d354c8d020561055bacac3cc9dc39e6355
|
4
|
+
data.tar.gz: 30f7391c4b4e56f7df9c2af7ddc22ae80571a7c8fe8651f8d8248eb5a2edc493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6195b6c9b380df50db4d494e766f3255c32974e5594174044a41dc0081d3b612c7463a45204b844f4caa9622ae4aed4417c764503e0fe983dc235428ed3b89ff
|
7
|
+
data.tar.gz: 34c468a647f03cf79c25f409c2e660fb891265fb3bba513742b06bcaceeaa8a2b974d2e8325d87c2371ca674de711109ae3b5a2033c55e7fef28bd168a5def29
|
data/.github/workflows/test.yml
CHANGED
@@ -3,32 +3,41 @@ name: test
|
|
3
3
|
on: push
|
4
4
|
jobs:
|
5
5
|
rspec:
|
6
|
-
name: "
|
7
|
-
runs-on: ubuntu-
|
6
|
+
name: "ruby:${{ matrix.ruby }} rails:${{ matrix.rails }} ${{ matrix.variant }}"
|
7
|
+
runs-on: ubuntu-22.04
|
8
8
|
|
9
9
|
strategy:
|
10
10
|
fail-fast: false
|
11
11
|
matrix:
|
12
12
|
ruby:
|
13
|
+
- "3.2"
|
14
|
+
- "3.1"
|
13
15
|
- "3.0"
|
14
16
|
- "2.7"
|
15
|
-
- "2.6"
|
16
|
-
- "2.5"
|
17
17
|
rails:
|
18
|
+
- "7.0"
|
18
19
|
- "6.1"
|
19
20
|
- "6.0"
|
20
21
|
- "5.2"
|
21
|
-
|
22
|
+
variant:
|
23
|
+
- ""
|
24
|
+
- "no-sprockets"
|
22
25
|
exclude:
|
26
|
+
- ruby: "3.2"
|
27
|
+
rails: "5.2"
|
28
|
+
- ruby: "3.1"
|
29
|
+
rails: "6.0"
|
30
|
+
- ruby: "3.1"
|
31
|
+
rails: "5.2"
|
23
32
|
- ruby: "3.0"
|
24
33
|
rails: "5.2"
|
25
|
-
- ruby: "2.6"
|
26
|
-
rails: master
|
27
|
-
- ruby: "2.5"
|
28
|
-
rails: master
|
29
34
|
|
30
35
|
env:
|
31
36
|
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
|
37
|
+
BUNDLE_WITHOUT: development
|
38
|
+
BUNDLE_JOBS: 4
|
39
|
+
BUNDLE_RETRY: 3
|
40
|
+
VARIANT: ${{ matrix.variant }}
|
32
41
|
|
33
42
|
steps:
|
34
43
|
- uses: actions/checkout@master
|
@@ -36,26 +45,23 @@ jobs:
|
|
36
45
|
with:
|
37
46
|
ruby-version: ${{ matrix.ruby }}
|
38
47
|
bundler-cache: true
|
39
|
-
env:
|
40
|
-
BUNDLE_WITHOUT: development
|
41
|
-
BUNDLE_JOBS: 4
|
42
|
-
BUNDLE_RETRY: 3
|
43
48
|
|
44
49
|
- run: bundle exec rspec --color
|
45
50
|
|
46
51
|
rubocop:
|
47
52
|
name: rubocop
|
48
|
-
runs-on: ubuntu-
|
53
|
+
runs-on: ubuntu-22.04
|
54
|
+
|
55
|
+
env:
|
56
|
+
BUNDLE_WITHOUT: development
|
57
|
+
BUNDLE_JOBS: 4
|
58
|
+
BUNDLE_RETRY: 3
|
49
59
|
|
50
60
|
steps:
|
51
61
|
- uses: actions/checkout@master
|
52
62
|
- uses: ruby/setup-ruby@v1
|
53
63
|
with:
|
54
|
-
ruby-version: 3.
|
64
|
+
ruby-version: 3.1
|
55
65
|
bundler-cache: true
|
56
|
-
env:
|
57
|
-
BUNDLE_WITHOUT: development
|
58
|
-
BUNDLE_JOBS: 4
|
59
|
-
BUNDLE_RETRY: 3
|
60
66
|
|
61
67
|
- run: bundle exec rubocop --parallel --fail-level E
|
data/.markdownlint.yaml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# markdownlint config
|
2
|
+
|
3
|
+
# The CHANGELOG contains duplicated headers by design
|
4
|
+
MD024: false
|
5
|
+
|
6
|
+
# MD013/line-length: disable line length for all. We prefer lines as
|
7
|
+
# long as paragraph with in-editor line breaks.
|
8
|
+
MD013: false
|
9
|
+
|
10
|
+
# MD033/no-inline-html: allow often need tags
|
11
|
+
MD033:
|
12
|
+
allowed_elements:
|
13
|
+
- figure
|
14
|
+
- figcaption
|
15
|
+
|
16
|
+
# MD046/code-block-style: code block style conflicting with
|
17
|
+
# admonitions...
|
18
|
+
MD046: false
|
19
|
+
|
20
|
+
# MD048/code-fence-style: code fence style
|
21
|
+
MD048:
|
22
|
+
style: backtick
|
data/.rubocop.yml
CHANGED
@@ -1,48 +1,7 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-config: default.yml
|
3
|
+
|
1
4
|
AllCops:
|
2
|
-
|
3
|
-
|
4
|
-
TargetRubyVersion: 2.5
|
5
|
+
TargetRubyVersion: 2.7
|
6
|
+
SuggestExtensions: False
|
5
7
|
NewCops: enable
|
6
|
-
|
7
|
-
Layout/CaseIndentation:
|
8
|
-
EnforcedStyle: end
|
9
|
-
IndentOneStep: true
|
10
|
-
SupportedStyles:
|
11
|
-
- case
|
12
|
-
- end
|
13
|
-
|
14
|
-
Layout/ArgumentAlignment:
|
15
|
-
EnforcedStyle: with_fixed_indentation
|
16
|
-
|
17
|
-
Layout/SpaceInsideBlockBraces:
|
18
|
-
EnforcedStyle: space
|
19
|
-
EnforcedStyleForEmptyBraces: no_space
|
20
|
-
SpaceBeforeBlockParameters: false
|
21
|
-
|
22
|
-
Layout/SpaceInsideHashLiteralBraces:
|
23
|
-
EnforcedStyle: no_space
|
24
|
-
|
25
|
-
|
26
|
-
Metrics/BlockLength:
|
27
|
-
Exclude:
|
28
|
-
- spec/**/*_spec.rb
|
29
|
-
|
30
|
-
Metrics/LineLength:
|
31
|
-
Exclude:
|
32
|
-
- spec/**/*_spec.rb
|
33
|
-
|
34
|
-
|
35
|
-
Style/ClassAndModuleChildren:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Style/Documentation:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Style/RaiseArgs:
|
42
|
-
EnforcedStyle: compact
|
43
|
-
|
44
|
-
Style/SignalException:
|
45
|
-
EnforcedStyle: only_raise
|
46
|
-
|
47
|
-
Style/TrivialAccessors:
|
48
|
-
AllowPredicates: true
|
data/Appraisals
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
appraise 'rails-7.0' do
|
4
|
+
gem 'rails', '~> 7.0.0'
|
5
|
+
end
|
6
|
+
|
3
7
|
appraise 'rails-6.1' do
|
4
8
|
gem 'rails', '~> 6.1.0'
|
5
9
|
end
|
@@ -11,7 +15,3 @@ end
|
|
11
15
|
appraise 'rails-5.2' do
|
12
16
|
gem 'rails', '~> 5.2.0'
|
13
17
|
end
|
14
|
-
|
15
|
-
appraise 'rails-master' do
|
16
|
-
gem 'rails', github: 'rails/rails'
|
17
|
-
end
|
data/CHANGELOG.md
CHANGED
@@ -3,9 +3,8 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Changelog](http://keepachangelog.com/).
|
5
5
|
|
6
|
-
|
7
|
-
|
8
6
|
## Unreleased
|
7
|
+
|
9
8
|
---
|
10
9
|
|
11
10
|
### New
|
@@ -16,64 +15,95 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
|
|
16
15
|
|
17
16
|
### Breaks
|
18
17
|
|
18
|
+
## 3.0.1 - (2023-08-17)
|
19
|
+
|
20
|
+
---
|
21
|
+
|
22
|
+
### Fixes
|
23
|
+
|
24
|
+
- Active View: nil is not a valid asset source issue in production app
|
25
|
+
|
26
|
+
## 3.0.0 - (2022-02-08)
|
27
|
+
|
28
|
+
---
|
29
|
+
|
30
|
+
### New
|
31
|
+
|
32
|
+
- Test integration with a Rails application without sprockets
|
33
|
+
- Add support for Rails 7.0 and Ruby 3.1
|
34
|
+
|
35
|
+
### Breaks
|
36
|
+
|
37
|
+
- Default to `public/assets/assets-manifest.json` manifest path matching new default from `webpack-assets-manifest` plugin
|
38
|
+
- Only support single manifest source file and error if not found (#9)
|
39
|
+
- Use `config.assets_manifest` as the config base to avoid conflicts in apps without sprockets (#9)
|
40
|
+
- Drop support for Ruby <2.7
|
19
41
|
|
20
42
|
## 2.1.2 - (2021-09-05)
|
43
|
+
|
21
44
|
---
|
22
45
|
|
23
46
|
### Fixes
|
24
|
-
* Return correct fully qualified URLs from manifest when relative URL host or asset host is configured
|
25
47
|
|
48
|
+
- Return correct fully qualified URLs from manifest when relative URL host or asset host is configured
|
26
49
|
|
27
50
|
## 2.1.1 - (2021-06-20)
|
51
|
+
|
28
52
|
---
|
29
53
|
|
30
54
|
### Fixes
|
31
|
-
* Super method signature for keyword arguments
|
32
55
|
|
56
|
+
- Super method signature for keyword arguments
|
33
57
|
|
34
58
|
## 2.1.0 - (2019-09-11)
|
59
|
+
|
35
60
|
---
|
36
61
|
|
37
62
|
### New
|
38
|
-
|
39
|
-
|
63
|
+
|
64
|
+
- Automatically add `crossorigin="anonymous"` for SRI resources
|
65
|
+
- Separate manifest caching and eager loading
|
40
66
|
|
41
67
|
### Changes
|
42
|
-
* Remove defunct onboot manifest validation (f3fe8f57)
|
43
68
|
|
69
|
+
- Remove defunct onboot manifest validation (f3fe8f57)
|
44
70
|
|
45
71
|
## 2.0.1 - (2019-08-09)
|
72
|
+
|
46
73
|
---
|
47
74
|
|
48
75
|
### Fixes
|
49
|
-
* Fix check if assets option node already exists
|
50
76
|
|
77
|
+
- Fix check if assets option node already exists
|
51
78
|
|
52
79
|
## 2.0.0 - (2019-08-08)
|
80
|
+
|
53
81
|
---
|
54
82
|
|
55
83
|
### New
|
56
|
-
* Accept glob patterns for `manifests` option
|
57
84
|
|
85
|
+
- Accept glob patterns for `manifests` option
|
58
86
|
|
59
87
|
### Breaks
|
60
|
-
* Change `manifest` configuration option into `manifests` to support multiple files
|
61
88
|
|
89
|
+
- Change `manifest` configuration option into `manifests` to support multiple files
|
62
90
|
|
63
91
|
## 1.1.0 - (2019-08-08)
|
92
|
+
|
64
93
|
---
|
65
94
|
|
66
95
|
### New
|
67
|
-
|
96
|
+
|
97
|
+
- Add passthrough option to load assets from other plugins (e.g. sprockets)
|
68
98
|
|
69
99
|
### Changes
|
70
|
-
* Only default to add available integrity if asset is from the manifest
|
71
100
|
|
101
|
+
- Only default to add available integrity if asset is from the manifest
|
72
102
|
|
73
103
|
## 1.0.0 - (2019-08-07)
|
104
|
+
|
74
105
|
---
|
75
106
|
|
76
107
|
### New
|
77
|
-
* Initial release
|
78
|
-
|
79
108
|
|
109
|
+
- Initial release
|
data/Gemfile
CHANGED
@@ -5,14 +5,17 @@ source 'https://rubygems.org'
|
|
5
5
|
# Load gem's dependencies
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem '
|
8
|
+
gem 'net-smtp', require: false # not bundled in Ruby 3.1+
|
9
|
+
gem 'rails', require: false
|
10
|
+
gem 'sprockets-rails', require: false # not included by default in Rails 7+
|
11
|
+
gem 'sqlite3', require: false
|
9
12
|
|
10
13
|
gem 'rake', '~> 13.0'
|
11
14
|
gem 'rspec', '~> 3.0'
|
12
|
-
gem 'rspec-rails', '~>
|
13
|
-
gem 'rubocop', '~> 1.14'
|
15
|
+
gem 'rspec-rails', '~> 6.0'
|
14
16
|
|
15
17
|
gem 'pry'
|
18
|
+
gem 'rubocop-config', github: 'jgraichen/rubocop-config', ref: 'v7', require: false
|
16
19
|
|
17
20
|
group :development do
|
18
21
|
gem 'appraisal'
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# Rails::Assets::Manifest
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/rails-assets-manifest?logo=ruby)](https://rubygems.org/gems/rails-assets-manifest)
|
4
|
+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jgraichen/rails-assets-manifest/test?logo=github)](https://github.com/jgraichen/rails-assets-manifest/actions)
|
4
5
|
|
5
|
-
|
6
|
+
Load all assets in your Rails application from a `manifest.json`, e.g. generated by [webpack-assets-manifest](https://github.com/webdeveric/webpack-assets-manifest).
|
7
|
+
|
8
|
+
This gem does not make any assumption on which tool to use to make your assets not how to configure or invoke it. It only requires a manifest JSON. The manifest must either be a simple string map or must map to objects having a `'src'` attribute. Sub-resource integrity is supported too:
|
6
9
|
|
7
10
|
```json
|
8
11
|
{
|
@@ -41,22 +44,39 @@ gem 'rails-assets-manifest'
|
|
41
44
|
|
42
45
|
## Usage
|
43
46
|
|
44
|
-
The manifest path can be configured e.g. in an
|
47
|
+
The manifest path can be configured e.g. in an `environments/*.rb` file:
|
45
48
|
|
46
49
|
```ruby
|
47
|
-
config.
|
50
|
+
config.assets_manifest.path = "public/.asset-manifest.json"
|
48
51
|
```
|
49
52
|
|
50
|
-
If `config.cache_classes` is set to `true` the manifest file be loaded once on boot.
|
53
|
+
If `config.cache_classes` is set to `true` the manifest file be loaded once on boot. Assets included with `integrity: true` will raise an error if the integrity option is missing in the manifest.
|
51
54
|
|
52
|
-
|
55
|
+
## Webpack Assets Manifest Example
|
53
56
|
|
54
|
-
|
57
|
+
The following snippet provides an example configuration for the[webpack-assets-manifest](https://github.com/webdeveric/webpack-assets-manifest) plugin to generating a compatible assets manifest file.
|
55
58
|
|
56
|
-
```
|
57
|
-
|
59
|
+
```ts
|
60
|
+
new WebpackAssetsManifest({
|
61
|
+
integrity: true,
|
62
|
+
integrityHashes: ["sha384"],
|
63
|
+
writeToDisk: true,
|
64
|
+
entrypoints: false,
|
65
|
+
entrypointsUseAssets: true,
|
66
|
+
publicPath,
|
67
|
+
// Ignore a source maps and compressed files.
|
68
|
+
customize(e) {
|
69
|
+
if (e.key.endsWith(".map") || e.key.endsWith(".gz")) {
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
|
73
|
+
return e;
|
74
|
+
},
|
75
|
+
})
|
58
76
|
```
|
59
77
|
|
78
|
+
Specifying `writeToDisk: true` allows running the `webpack-dev-server` as proxy to the Rails application, and still generate correct assets links in Rails code. `rails-assets-manifest` defaults to using `public/assets/assets-manifest.json` as the manifest path.
|
79
|
+
|
60
80
|
## TODO
|
61
81
|
|
62
82
|
* Override/Join with `asset_host` URL?
|
@@ -72,7 +92,7 @@ Multiple manifests can be loaded by specifying multiple files. Glob patterns are
|
|
72
92
|
|
73
93
|
## MIT License
|
74
94
|
|
75
|
-
Copyright (c) 2018 Jan Graichen
|
95
|
+
Copyright (c) 2018-2022 Jan Graichen
|
76
96
|
|
77
97
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
78
98
|
of this software and associated documentation files (the "Software"), to deal
|
data/gemfiles/rails_5.2.gemfile
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rails", "~> 5.2.0"
|
6
|
-
gem "
|
6
|
+
gem "sprockets-rails", require: false
|
7
|
+
gem "net-smtp", require: false
|
8
|
+
gem "sqlite3", require: false
|
9
|
+
gem "rake", "~> 13.0"
|
7
10
|
gem "rspec", "~> 3.0"
|
8
11
|
gem "rspec-rails", "~> 5.0"
|
9
12
|
gem "rubocop", "~> 1.14"
|
data/gemfiles/rails_6.0.gemfile
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rails", "~> 6.0.0"
|
6
|
-
gem "
|
6
|
+
gem "sprockets-rails", require: false
|
7
|
+
gem "net-smtp", require: false
|
8
|
+
gem "sqlite3", require: false
|
9
|
+
gem "rake", "~> 13.0"
|
7
10
|
gem "rspec", "~> 3.0"
|
8
11
|
gem "rspec-rails", "~> 5.0"
|
9
12
|
gem "rubocop", "~> 1.14"
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "rails", "~> 6.1.0"
|
6
|
-
gem "
|
6
|
+
gem "sprockets-rails", require: false
|
7
|
+
gem "net-smtp", require: false
|
8
|
+
gem "sqlite3", require: false
|
9
|
+
gem "rake", "~> 13.0"
|
7
10
|
gem "rspec", "~> 3.0"
|
8
11
|
gem "rspec-rails", "~> 5.0"
|
9
12
|
gem "rubocop", "~> 1.14"
|
@@ -2,8 +2,11 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "rails",
|
6
|
-
gem "
|
5
|
+
gem "rails", "~> 7.0.0"
|
6
|
+
gem "sprockets-rails", require: false
|
7
|
+
gem "net-smtp", require: false
|
8
|
+
gem "sqlite3", require: false
|
9
|
+
gem "rake", "~> 13.0"
|
7
10
|
gem "rspec", "~> 3.0"
|
8
11
|
gem "rspec-rails", "~> 5.0"
|
9
12
|
gem "rubocop", "~> 1.14"
|
@@ -67,17 +67,13 @@ module Rails::Assets::Manifest
|
|
67
67
|
respond_to?(:request) && request && (request.local? || request.ssl?)
|
68
68
|
end
|
69
69
|
|
70
|
-
# rubocop:disable Metrics/AbcSize
|
71
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
72
|
-
# rubocop:disable Metrics/MethodLength
|
73
|
-
# rubocop:disable Style/IfUnlessModifier
|
74
70
|
def with_integrity(sources, required, type, **kwargs)
|
75
71
|
sources.map do |source|
|
76
72
|
path = path_with_extname(source, type: type, **kwargs)
|
77
73
|
|
78
74
|
# integrity hash passed directly
|
79
75
|
if required.is_a?(String)
|
80
|
-
next yield(source, integrity: required, crossorigin: 'anonymous', **kwargs)
|
76
|
+
next yield(source, {integrity: required, crossorigin: 'anonymous', **kwargs})
|
81
77
|
end
|
82
78
|
|
83
79
|
# Explicit passed `true` option
|
@@ -86,7 +82,7 @@ module Rails::Assets::Manifest
|
|
86
82
|
|
87
83
|
raise IntegrityMissing.new "SRI missing for #{path}" unless integrity
|
88
84
|
|
89
|
-
next yield(source, integrity: integrity, crossorigin: 'anonymous', **kwargs)
|
85
|
+
next yield(source, {integrity: integrity, crossorigin: 'anonymous', **kwargs})
|
90
86
|
end
|
91
87
|
|
92
88
|
# No integrity option passed or `nil` default from above
|
@@ -96,17 +92,13 @@ module Rails::Assets::Manifest
|
|
96
92
|
# Only if it is an asset from our manifest and there is an integrity
|
97
93
|
# we default to adding one
|
98
94
|
if entry && entry.integrity
|
99
|
-
next yield(source, integrity: entry.integrity, crossorigin: 'anonymous', **kwargs)
|
95
|
+
next yield(source, {integrity: entry.integrity, crossorigin: 'anonymous', **kwargs})
|
100
96
|
end
|
101
97
|
end
|
102
98
|
|
103
|
-
yield(source,
|
99
|
+
yield(source, kwargs)
|
104
100
|
end.join.html_safe
|
105
101
|
end
|
106
|
-
# rubocop:enable Style/IfUnlessModifier
|
107
|
-
# rubocop:enable Metrics/MethodLength
|
108
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
109
|
-
# rubocop:enable Metrics/AbcSize
|
110
102
|
|
111
103
|
def path_with_extname(path, options)
|
112
104
|
path = path.to_s
|
@@ -4,8 +4,8 @@ module Rails::Assets::Manifest
|
|
4
4
|
class Manifest
|
5
5
|
attr_reader :path
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(path, cache: true)
|
8
|
+
@path = Rails.root.join(path).to_s.freeze
|
9
9
|
@cache = cache
|
10
10
|
end
|
11
11
|
|
@@ -20,7 +20,7 @@ module Rails::Assets::Manifest
|
|
20
20
|
def lookup!(name)
|
21
21
|
lookup(name) || begin
|
22
22
|
raise EntryMissing.new <<~ERROR
|
23
|
-
Can't find #{name} in #{path}. Your
|
23
|
+
Can't find #{name} in #{path}. Your manifest contain:
|
24
24
|
#{JSON.pretty_generate(data.keys)}
|
25
25
|
ERROR
|
26
26
|
end
|
@@ -50,13 +50,9 @@ module Rails::Assets::Manifest
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def files
|
54
|
-
@files.map {|path| Dir.glob(path) }.flatten
|
55
|
-
end
|
56
|
-
|
57
53
|
def load
|
58
|
-
|
59
|
-
JSON.parse(File.read(
|
54
|
+
{}.tap do |entries|
|
55
|
+
JSON.parse(File.read(path)).each_pair do |key, entry|
|
60
56
|
if entry.is_a?(String)
|
61
57
|
entries[key] = Entry.new(entry, nil)
|
62
58
|
elsif entry.is_a?(Hash) && entry.key?('src')
|
@@ -4,19 +4,14 @@ module Rails
|
|
4
4
|
module Assets
|
5
5
|
module Manifest
|
6
6
|
class Railtie < ::Rails::Railtie
|
7
|
-
|
8
|
-
# already exists and must not be overridden. Otherwise
|
9
|
-
# all sprockets default options are removed breaking
|
10
|
-
# sprockets.
|
11
|
-
config.assets = ::ActiveSupport::OrderedOptions.new unless config.respond_to?(:assets)
|
7
|
+
config.assets_manifest = ::ActiveSupport::OrderedOptions.new
|
12
8
|
|
13
|
-
# Path where the manifest
|
14
|
-
config.
|
9
|
+
# Path where the manifest file is loaded from.
|
10
|
+
config.assets_manifest.path = 'public/assets/assets-manifest.json'
|
15
11
|
|
16
|
-
# If set to true missing assets will not raise an
|
17
|
-
#
|
18
|
-
|
19
|
-
config.assets.passthrough = false
|
12
|
+
# If set to true missing assets will not raise an exception but are
|
13
|
+
# passed through to sprockets or rails own asset methods.
|
14
|
+
config.assets_manifest.passthrough = false
|
20
15
|
|
21
16
|
config.after_initialize do |_|
|
22
17
|
ActiveSupport.on_load(:action_view) do
|
@@ -4,12 +4,12 @@ module Rails
|
|
4
4
|
module Assets
|
5
5
|
module Manifest
|
6
6
|
module VERSION
|
7
|
-
MAJOR =
|
8
|
-
MINOR =
|
9
|
-
PATCH =
|
7
|
+
MAJOR = 3
|
8
|
+
MINOR = 0
|
9
|
+
PATCH = 1
|
10
10
|
STAGE = nil
|
11
11
|
|
12
|
-
STRING = [MAJOR, MINOR, PATCH, STAGE].
|
12
|
+
STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.')
|
13
13
|
|
14
14
|
def self.to_s
|
15
15
|
STRING
|
@@ -29,9 +29,10 @@ module Rails
|
|
29
29
|
@instance = begin
|
30
30
|
config = Rails.application.config
|
31
31
|
|
32
|
-
Manifest.new
|
33
|
-
|
34
|
-
cache: config.cache_classes
|
32
|
+
Manifest.new(
|
33
|
+
config.assets_manifest.path,
|
34
|
+
cache: config.cache_classes,
|
35
|
+
)
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -42,7 +43,7 @@ module Rails
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def passthrough?
|
45
|
-
Rails.application.config.
|
46
|
+
Rails.application.config.assets_manifest.passthrough
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
@@ -14,9 +14,10 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.description = 'Load all rails assets from an external manifest.'
|
15
15
|
spec.homepage = 'https://github.com/jgraichen/rails-assets-manifest'
|
16
16
|
|
17
|
-
spec.metadata['homepage_uri']
|
18
|
-
spec.metadata['source_code_uri']
|
19
|
-
spec.metadata['changelog_uri']
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/jgraichen/rails-assets-manifest'
|
19
|
+
spec.metadata['changelog_uri'] = 'https://github.com/jgraichen/rails-assets-manifest/blob/master/CHANGELOG.md'
|
20
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
20
21
|
|
21
22
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
23
|
`git ls-files -z`.split("\x0").reject do |f|
|
@@ -28,6 +29,8 @@ Gem::Specification.new do |spec|
|
|
28
29
|
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
|
29
30
|
spec.require_paths = ['lib']
|
30
31
|
|
32
|
+
spec.required_ruby_version = '>= 2.7.0'
|
33
|
+
|
31
34
|
spec.add_dependency 'activesupport', '> 4.2'
|
32
35
|
spec.add_dependency 'railties', '> 4.2'
|
33
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-assets-manifest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".editorconfig"
|
63
63
|
- ".github/workflows/test.yml"
|
64
64
|
- ".gitignore"
|
65
|
+
- ".markdownlint.yaml"
|
65
66
|
- ".rspec"
|
66
67
|
- ".rubocop.yml"
|
67
68
|
- Appraisals
|
@@ -75,7 +76,7 @@ files:
|
|
75
76
|
- gemfiles/rails_5.2.gemfile
|
76
77
|
- gemfiles/rails_6.0.gemfile
|
77
78
|
- gemfiles/rails_6.1.gemfile
|
78
|
-
- gemfiles/
|
79
|
+
- gemfiles/rails_7.0.gemfile
|
79
80
|
- lib/rails/assets/manifest.rb
|
80
81
|
- lib/rails/assets/manifest/helper.rb
|
81
82
|
- lib/rails/assets/manifest/manifest.rb
|
@@ -89,6 +90,7 @@ metadata:
|
|
89
90
|
homepage_uri: https://github.com/jgraichen/rails-assets-manifest
|
90
91
|
source_code_uri: https://github.com/jgraichen/rails-assets-manifest
|
91
92
|
changelog_uri: https://github.com/jgraichen/rails-assets-manifest/blob/master/CHANGELOG.md
|
93
|
+
rubygems_mfa_required: 'true'
|
92
94
|
post_install_message:
|
93
95
|
rdoc_options: []
|
94
96
|
require_paths:
|
@@ -97,14 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
99
|
requirements:
|
98
100
|
- - ">="
|
99
101
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
102
|
+
version: 2.7.0
|
101
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
104
|
requirements:
|
103
105
|
- - ">="
|
104
106
|
- !ruby/object:Gem::Version
|
105
107
|
version: '0'
|
106
108
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.4.18
|
108
110
|
signing_key:
|
109
111
|
specification_version: 4
|
110
112
|
summary: Load all rails assets from an external manifest.
|