rails-assets-manifest 2.1.2 → 3.0.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 +4 -4
- data/.github/workflows/test.yml +22 -17
- data/.rubocop.yml +5 -46
- data/Appraisals +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +5 -2
- 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 +0 -8
- 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 +6 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 36c667b7c457d214df43ac5f4c9e54f5baac237c0f9a61ac3eeedc6d1d458ab9
         | 
| 4 | 
            +
              data.tar.gz: 1a7c777200e2087c05be7759091007857861261a5d00912256f35f5ff98d2a6c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6117f1e88a27ba3dd5ce5edc85a21952e91de97abd3d72bc9b37a1527aa8352a7170371acf2bec29a268a8aced6b3519af4d9e4409848f041c9d950090ca38cb
         | 
| 7 | 
            +
              data.tar.gz: 2f38b29bf90d82cd5a4a8e039a2fef2bd536326d1fe81eb3ee9e04d5b2637f4f3114a5deeb75ce6a6aec332cdf7874056033d4dde53d8bea7bc5d053774dbc6a
         | 
    
        data/.github/workflows/test.yml
    CHANGED
    
    | @@ -3,32 +3,40 @@ name: test | |
| 3 3 | 
             
            on: push
         | 
| 4 4 | 
             
            jobs:
         | 
| 5 5 | 
             
              rspec:
         | 
| 6 | 
            -
                name: " | 
| 6 | 
            +
                name: "ruby:${{ matrix.ruby }} rails:${{ matrix.rails }} ${{ matrix.variant }}"
         | 
| 7 7 | 
             
                runs-on: ubuntu-20.04
         | 
| 8 8 |  | 
| 9 9 | 
             
                strategy:
         | 
| 10 10 | 
             
                  fail-fast: false
         | 
| 11 11 | 
             
                  matrix:
         | 
| 12 12 | 
             
                    ruby:
         | 
| 13 | 
            +
                      - "3.1"
         | 
| 13 14 | 
             
                      - "3.0"
         | 
| 14 15 | 
             
                      - "2.7"
         | 
| 15 | 
            -
                      - "2.6"
         | 
| 16 | 
            -
                      - "2.5"
         | 
| 17 16 | 
             
                    rails:
         | 
| 17 | 
            +
                      - "7.0"
         | 
| 18 18 | 
             
                      - "6.1"
         | 
| 19 19 | 
             
                      - "6.0"
         | 
| 20 20 | 
             
                      - "5.2"
         | 
| 21 | 
            -
             | 
| 21 | 
            +
                    variant:
         | 
| 22 | 
            +
                      - ""
         | 
| 23 | 
            +
                      - "no-sprockets"
         | 
| 22 24 | 
             
                    exclude:
         | 
| 25 | 
            +
                      - ruby: "3.1"
         | 
| 26 | 
            +
                        rails: "6.1"
         | 
| 27 | 
            +
                      - ruby: "3.1"
         | 
| 28 | 
            +
                        rails: "6.0"
         | 
| 29 | 
            +
                      - ruby: "3.1"
         | 
| 30 | 
            +
                        rails: "5.2"
         | 
| 23 31 | 
             
                      - ruby: "3.0"
         | 
| 24 32 | 
             
                        rails: "5.2"
         | 
| 25 | 
            -
                      - ruby: "2.6"
         | 
| 26 | 
            -
                        rails: master
         | 
| 27 | 
            -
                      - ruby: "2.5"
         | 
| 28 | 
            -
                        rails: master
         | 
| 29 33 |  | 
| 30 34 | 
             
                env:
         | 
| 31 35 | 
             
                  BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
         | 
| 36 | 
            +
                  BUNDLE_WITHOUT: development
         | 
| 37 | 
            +
                  BUNDLE_JOBS: 4
         | 
| 38 | 
            +
                  BUNDLE_RETRY: 3
         | 
| 39 | 
            +
                  VARIANT: ${{ matrix.variant }}
         | 
| 32 40 |  | 
| 33 41 | 
             
                steps:
         | 
| 34 42 | 
             
                  - uses: actions/checkout@master
         | 
| @@ -36,10 +44,6 @@ jobs: | |
| 36 44 | 
             
                    with:
         | 
| 37 45 | 
             
                      ruby-version: ${{ matrix.ruby }}
         | 
| 38 46 | 
             
                      bundler-cache: true
         | 
| 39 | 
            -
                    env:
         | 
| 40 | 
            -
                      BUNDLE_WITHOUT: development
         | 
| 41 | 
            -
                      BUNDLE_JOBS: 4
         | 
| 42 | 
            -
                      BUNDLE_RETRY: 3
         | 
| 43 47 |  | 
| 44 48 | 
             
                  - run: bundle exec rspec --color
         | 
| 45 49 |  | 
| @@ -47,15 +51,16 @@ jobs: | |
| 47 51 | 
             
                name: rubocop
         | 
| 48 52 | 
             
                runs-on: ubuntu-20.04
         | 
| 49 53 |  | 
| 54 | 
            +
                env:
         | 
| 55 | 
            +
                  BUNDLE_WITHOUT: development
         | 
| 56 | 
            +
                  BUNDLE_JOBS: 4
         | 
| 57 | 
            +
                  BUNDLE_RETRY: 3
         | 
| 58 | 
            +
             | 
| 50 59 | 
             
                steps:
         | 
| 51 60 | 
             
                  - uses: actions/checkout@master
         | 
| 52 61 | 
             
                  - uses: ruby/setup-ruby@v1
         | 
| 53 62 | 
             
                    with:
         | 
| 54 | 
            -
                      ruby-version: 3. | 
| 63 | 
            +
                      ruby-version: 3.1
         | 
| 55 64 | 
             
                      bundler-cache: true
         | 
| 56 | 
            -
                    env:
         | 
| 57 | 
            -
                      BUNDLE_WITHOUT: development
         | 
| 58 | 
            -
                      BUNDLE_JOBS: 4
         | 
| 59 | 
            -
                      BUNDLE_RETRY: 3
         | 
| 60 65 |  | 
| 61 66 | 
             
                  - run: bundle exec rubocop --parallel --fail-level E
         | 
    
        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
    
    | @@ -17,6 +17,21 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch | |
| 17 17 | 
             
            ### Breaks
         | 
| 18 18 |  | 
| 19 19 |  | 
| 20 | 
            +
            ## 3.0.0 - (2022-02-08)
         | 
| 21 | 
            +
            ---
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ### New
         | 
| 24 | 
            +
            * Test integration with a Rails application without sprockets
         | 
| 25 | 
            +
            * Add support for Rails 7.0 and Ruby 3.1
         | 
| 26 | 
            +
             | 
| 27 | 
            +
             | 
| 28 | 
            +
            ### Breaks
         | 
| 29 | 
            +
            * Default to `public/assets/assets-manifest.json` manifest path matching new default from `webpack-assets-manifest` plugin
         | 
| 30 | 
            +
            * Only support single manifest source file and error if not found (#9)
         | 
| 31 | 
            +
            * Use `config.assets_manifest` as the config base to avoid conflicts in apps without sprockets (#9)
         | 
| 32 | 
            +
            * Drop support for Ruby <2.7
         | 
| 33 | 
            +
             | 
| 34 | 
            +
             | 
| 20 35 | 
             
            ## 2.1.2 - (2021-09-05)
         | 
| 21 36 | 
             
            ---
         | 
| 22 37 |  | 
    
        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 15 | 
             
            gem 'rspec-rails', '~> 5.0'
         | 
| 13 | 
            -
            gem 'rubocop', '~> 1.14'
         | 
| 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 | 
            +
            [](https://rubygems.org/gems/rails-assets-manifest)
         | 
| 4 | 
            +
            [](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,10 +67,6 @@ 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)
         | 
| @@ -103,10 +99,6 @@ module Rails::Assets::Manifest | |
| 103 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 = 0
         | 
| 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.0
         | 
| 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: 2022-02-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -75,7 +75,7 @@ files: | |
| 75 75 | 
             
            - gemfiles/rails_5.2.gemfile
         | 
| 76 76 | 
             
            - gemfiles/rails_6.0.gemfile
         | 
| 77 77 | 
             
            - gemfiles/rails_6.1.gemfile
         | 
| 78 | 
            -
            - gemfiles/ | 
| 78 | 
            +
            - gemfiles/rails_7.0.gemfile
         | 
| 79 79 | 
             
            - lib/rails/assets/manifest.rb
         | 
| 80 80 | 
             
            - lib/rails/assets/manifest/helper.rb
         | 
| 81 81 | 
             
            - lib/rails/assets/manifest/manifest.rb
         | 
| @@ -89,6 +89,7 @@ metadata: | |
| 89 89 | 
             
              homepage_uri: https://github.com/jgraichen/rails-assets-manifest
         | 
| 90 90 | 
             
              source_code_uri: https://github.com/jgraichen/rails-assets-manifest
         | 
| 91 91 | 
             
              changelog_uri: https://github.com/jgraichen/rails-assets-manifest/blob/master/CHANGELOG.md
         | 
| 92 | 
            +
              rubygems_mfa_required: 'true'
         | 
| 92 93 | 
             
            post_install_message: 
         | 
| 93 94 | 
             
            rdoc_options: []
         | 
| 94 95 | 
             
            require_paths:
         | 
| @@ -97,14 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 97 98 | 
             
              requirements:
         | 
| 98 99 | 
             
              - - ">="
         | 
| 99 100 | 
             
                - !ruby/object:Gem::Version
         | 
| 100 | 
            -
                  version:  | 
| 101 | 
            +
                  version: 2.7.0
         | 
| 101 102 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 102 103 | 
             
              requirements:
         | 
| 103 104 | 
             
              - - ">="
         | 
| 104 105 | 
             
                - !ruby/object:Gem::Version
         | 
| 105 106 | 
             
                  version: '0'
         | 
| 106 107 | 
             
            requirements: []
         | 
| 107 | 
            -
            rubygems_version: 3. | 
| 108 | 
            +
            rubygems_version: 3.3.3
         | 
| 108 109 | 
             
            signing_key: 
         | 
| 109 110 | 
             
            specification_version: 4
         | 
| 110 111 | 
             
            summary: Load all rails assets from an external manifest.
         |