Skip to content

Commit

Permalink
require propshaft
Browse files Browse the repository at this point in the history
  • Loading branch information
zzak committed Sep 12, 2024
1 parent 7840863 commit 5617c99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 1 addition & 8 deletions railties/lib/rails/commands/app/update_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,7 @@ def generator_options
end

def asset_pipeline
case
when defined?(Sprockets::Railtie)
"sprockets"
when defined?(Propshaft::Railtie)
"propshaft"
else
nil
end
"propshaft" if defined?(Propshaft::Railtie)
end

def skip_gem?(gem_name)
Expand Down
5 changes: 2 additions & 3 deletions railties/test/isolation/abstract_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def self.sh(cmd)
FileUtils.rm_rf(app_template_path)
FileUtils.mkdir_p(app_template_path)

sh "#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/exe/rails new #{app_template_path} --asset-pipeline=sprockets --skip-bundle --no-rc --quiet"
sh "#{Gem.ruby} #{RAILS_FRAMEWORK_ROOT}/railties/exe/rails new #{app_template_path} --skip-bundle --no-rc --quiet"
File.open("#{app_template_path}/config/boot.rb", "w") do |f|
f.puts 'require "bootsnap/setup" if ENV["BOOTSNAP_CACHE_DIR"]'
f.puts 'require "rails/all"'
Expand All @@ -623,7 +623,7 @@ def self.sh(cmd)
# Fake 'Bundler.require' -- we run using the repo's Gemfile, not an
# app-specific one: we don't want to require every gem that lists.
contents = File.read("#{app_template_path}/config/application.rb")
contents.sub!(/^Bundler\.require.*/, "%w(sprockets/railtie importmap-rails).each { |r| require r }")
contents.sub!(/^Bundler\.require.*/, "%w(propshaft propshaft/railtie importmap-rails).each { |r| require r }")
File.write("#{app_template_path}/config/application.rb", contents)

require "rails"
Expand All @@ -638,7 +638,6 @@ def self.sh(cmd)
require "action_cable"
require "action_mailbox"
require "action_text"
require "sprockets"

require "action_view/helpers"
require "action_dispatch/routing/route_set"
Expand Down

0 comments on commit 5617c99

Please sign in to comment.