diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 325b400e..f741c256 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,35 +9,43 @@ jobs: include: - ruby: 2.5 gemfile: "gemfiles/Gemfile.rails-6.1-sprockets-3" + bundler: "2.3.0" - ruby: 2.5 gemfile: "gemfiles/Gemfile.rails-6.1-sprockets-4" - + bundler: "2.3.0" - ruby: 2.7 gemfile: "gemfiles/Gemfile.rails-7.0-sprockets-3" + bundler: "2.4.8" - ruby: 2.7 gemfile: "gemfiles/Gemfile.rails-7.0-sprockets-4" - + bundler: "2.4.8" - ruby: 2.7 gemfile: "gemfiles/Gemfile.rails-7.1-sprockets-3" + bundler: "2.4.8" - ruby: 2.7 gemfile: "gemfiles/Gemfile.rails-7.1-sprockets-4" - + bundler: "2.4.8" - ruby: 3.1 gemfile: "gemfiles/Gemfile.rails-7.2-sprockets-3" + bundler: default - ruby: 3.1 gemfile: "gemfiles/Gemfile.rails-7.2-sprockets-4" - + bundler: default - ruby: 3.2 gemfile: "gemfiles/Gemfile.rails-8.0-sprockets-3" + bundler: default - ruby: 3.2 gemfile: "gemfiles/Gemfile.rails-8.0-sprockets-4" - + bundler: default - ruby: 3.2 gemfile: Gemfile + bundler: default - ruby: 3.3 gemfile: Gemfile + bundler: default - ruby: head gemfile: Gemfile + bundler: default env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} @@ -49,6 +57,8 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + cache-version: ${{ matrix.ruby }}-${{ matrix.ruby }}-${{ matrix.gemfile }} + bundler: ${{ matrix.bundler }} - name: Run tests run: bundle exec rake continue-on-error: ${{ matrix.gemfile == 'Gemfile' }} diff --git a/gemfiles/Gemfile.rails-6.1-sprockets-3 b/gemfiles/Gemfile.rails-6.1-sprockets-3 index 3e31a785..0626d619 100644 --- a/gemfiles/Gemfile.rails-6.1-sprockets-3 +++ b/gemfiles/Gemfile.rails-6.1-sprockets-3 @@ -4,3 +4,5 @@ gemspec path: '..' gem 'actionpack', '~> 6.1.0' gem 'railties', '~> 6.1.0' gem 'sprockets', '~> 3.0' + +gem 'concurrent-ruby', '< 1.3.5' diff --git a/gemfiles/Gemfile.rails-6.1-sprockets-4 b/gemfiles/Gemfile.rails-6.1-sprockets-4 index af14533e..41a6c57a 100644 --- a/gemfiles/Gemfile.rails-6.1-sprockets-4 +++ b/gemfiles/Gemfile.rails-6.1-sprockets-4 @@ -4,3 +4,5 @@ gemspec path: '..' gem 'actionpack', '~> 6.1.0' gem 'railties', '~> 6.1.0' gem 'sprockets', '~> 4.0' + +gem 'concurrent-ruby', '< 1.3.5' diff --git a/gemfiles/Gemfile.rails-7.0-sprockets-3 b/gemfiles/Gemfile.rails-7.0-sprockets-3 index dd25e0ec..c5787efb 100644 --- a/gemfiles/Gemfile.rails-7.0-sprockets-3 +++ b/gemfiles/Gemfile.rails-7.0-sprockets-3 @@ -4,3 +4,5 @@ gemspec path: '..' gem 'actionpack', '~> 7.0.0' gem 'railties', '~> 7.0.0' gem 'sprockets', '~> 3.0' + +gem 'concurrent-ruby', '< 1.3.5' diff --git a/gemfiles/Gemfile.rails-7.0-sprockets-4 b/gemfiles/Gemfile.rails-7.0-sprockets-4 index 27b9dd95..0c73b078 100644 --- a/gemfiles/Gemfile.rails-7.0-sprockets-4 +++ b/gemfiles/Gemfile.rails-7.0-sprockets-4 @@ -4,3 +4,5 @@ gemspec path: '..' gem 'actionpack', '~> 7.0.0' gem 'railties', '~> 7.0.0' gem 'sprockets', '~> 4.0' + +gem 'concurrent-ruby', '< 1.3.5' diff --git a/lib/sprockets/railtie.rb b/lib/sprockets/railtie.rb index 5f579e9c..1a774269 100644 --- a/lib/sprockets/railtie.rb +++ b/lib/sprockets/railtie.rb @@ -60,21 +60,6 @@ module Sprockets class Railtie < ::Rails::Railtie include Sprockets::Rails::Utils - class ManifestNeededError < StandardError - def initialize - msg = "Expected to find a manifest file in `app/assets/config/manifest.js`\n" + - "But did not, please create this file and use it to link any assets that need\n" + - "to be rendered by your app:\n\n" + - "Example:\n" + - " //= link_tree ../images\n" + - " //= link_directory ../javascripts .js\n" + - " //= link_directory ../stylesheets .css\n" + - "and restart your server\n\n" + - "For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs" - super msg - end - end - LOOSE_APP_ASSETS = lambda do |logical_path, filename| filename.start_with?(::Rails.root.join("app/assets").to_s) && !['.js', '.css', ''].include?(File.extname(logical_path)) @@ -103,8 +88,20 @@ def configure(&block) initializer :set_default_precompile do |app| if using_sprockets4? - raise ManifestNeededError unless ::Rails.root.join("app/assets/config/manifest.js").exist? - app.config.assets.precompile += %w( manifest.js ) + if ::Rails.root.join("app/assets/config/manifest.js").exist? + app.config.assets.precompile += %w( manifest.js ) + else + msg = "Expected to find a manifest file in `app/assets/config/manifest.js`\n" + + "But did not, please create this file and use it to link any assets that need\n" + + "to be rendered by your app:\n\n" + + "Example:\n" + + " //= link_tree ../images\n" + + " //= link_directory ../javascripts .js\n" + + " //= link_directory ../stylesheets .css\n" + + "and restart your server\n\n" + + "For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs" + Sprockets::Rails.deprecator.warn msg + end else app.config.assets.precompile += [LOOSE_APP_ASSETS, /(?:\/|\\|\A)application\.(css|js)$/] end