Skip to content

Add default support for the Propshaft asset pipeline #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
- "3.0"
gemfile:
- Gemfile
- gemfiles/rails_7.gemfile
- gemfiles/rails_7_propshaft.gemfile
- gemfiles/rails_7_sprockets.gemfile
continue-on-error: [ false ]

name: ${{ format('Tests (Ruby {0}, {1})', matrix.ruby-version, matrix.gemfile) }}
Expand Down
7 changes: 6 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
appraise "rails_7" do
appraise "rails_7_sprockets" do
gem "rails", github: "rails/rails", ref: "main"
gem "sprockets-rails"
end

appraise "rails_7_propshaft" do
gem "rails", github: "rails/rails", ref: "main"
gem "propshaft"
end
23 changes: 23 additions & 0 deletions gemfiles/rails_7_propshaft.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", ref: "main", git: "https://github.com/rails/rails.git"
gem "sqlite3"
gem "propshaft"

group :development do
gem "appraisal"
end

group :test do
gem "turbo-rails"
gem "stimulus-rails"
gem "byebug"
gem "rexml"
gem "capybara"
gem "selenium-webdriver"
gem "webdrivers"
end

gemspec path: "../"
190 changes: 190 additions & 0 deletions gemfiles/rails_7_propshaft.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
GIT
remote: https://github.com/rails/rails.git
revision: 6e1694275007b94b8112455ac53e8a345938376e
ref: main
specs:
actioncable (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
mail (>= 2.7.1)
actionmailer (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
nokogiri (>= 1.8.5)
actionview (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
globalid (>= 0.3.6)
activemodel (7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
activerecord (7.0.0.alpha2)
activemodel (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
activestorage (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.0.alpha2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
rails (7.0.0.alpha2)
actioncable (= 7.0.0.alpha2)
actionmailbox (= 7.0.0.alpha2)
actionmailer (= 7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
actiontext (= 7.0.0.alpha2)
actionview (= 7.0.0.alpha2)
activejob (= 7.0.0.alpha2)
activemodel (= 7.0.0.alpha2)
activerecord (= 7.0.0.alpha2)
activestorage (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
bundler (>= 1.15.0)
railties (= 7.0.0.alpha2)
railties (7.0.0.alpha2)
actionpack (= 7.0.0.alpha2)
activesupport (= 7.0.0.alpha2)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)

PATH
remote: ..
specs:
importmap-rails (0.8.2)
rails (>= 6.0.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
appraisal (2.4.1)
bundler
rake
thor (>= 0.14.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.36.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (4.1.0)
concurrent-ruby (1.1.9)
crass (1.0.6)
erubi (1.10.0)
globalid (0.5.2)
activesupport (>= 5.0)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
loofah (2.12.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.14.4)
nio4r (2.5.8)
nokogiri (1.12.5-x86_64-linux)
racc (~> 1.4)
propshaft (0.3.1)
rails (>= 7.0.0.alpha2)
public_suffix (4.0.6)
racc (1.6.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
rubyzip (2.3.2)
selenium-webdriver (4.1.0)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2)
sqlite3 (1.4.2)
stimulus-rails (0.7.2)
rails (>= 6.0.0)
thor (1.1.0)
turbo-rails (0.8.3)
rails (>= 6.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
webdrivers (5.0.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.1)

PLATFORMS
x86_64-linux

DEPENDENCIES
appraisal
byebug
capybara
importmap-rails!
propshaft
rails!
rexml
selenium-webdriver
sqlite3
stimulus-rails
turbo-rails
webdrivers

BUNDLED WITH
2.2.30
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions lib/importmap/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class Engine < ::Rails::Engine
end

initializer 'importmap.rescuable_asset_errors' do |app|
if defined?(Propshaft)
app.config.importmap.rescuable_asset_errors << Propshaft::MissingAssetError
end
if defined?(Sprockets::Rails)
app.config.importmap.rescuable_asset_errors << Sprockets::Rails::Helper::AssetNotFound
end
Expand Down
8 changes: 7 additions & 1 deletion test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
require "active_record/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "sprockets/railtie"
begin
require "sprockets/railtie"
rescue LoadError
# This is safe to ignore: it's expected that sprockets-rails won't be
# available when we're testing against an application that uses rails 7 with
# an alternative asset pipeline (e.g. propshaft).
end
require "active_storage/engine"

# Require the gems listed in Gemfile, including any gems
Expand Down