Merge pull request #39708 from jonathanhefner/finish_template-goes-last

Ensure principle tasks go before finish_template
This commit is contained in:
Eugene Kenny 2020-07-18 23:49:24 +01:00 committed by GitHub
commit c418fb9fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -491,6 +491,12 @@ module Rails
end
end
def delete_active_job_folder_if_skipping_active_job
if options[:skip_active_job]
remove_dir "app/jobs"
end
end
def delete_action_mailer_files_skipping_action_mailer
if options[:skip_action_mailer]
remove_file "app/views/layouts/mailer.html.erb"
@ -536,12 +542,6 @@ module Rails
build(:leftovers)
end
def delete_active_job_folder_if_skipping_active_job
if options[:skip_active_job]
remove_dir "app/jobs"
end
end
public_task :apply_rails_template, :run_bundle
public_task :generate_bundler_binstub, :generate_spring_binstub
public_task :run_webpack

View File

@ -1078,6 +1078,12 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
def test_principle_tasks_go_before_finish_template
tasks = generator.class.tasks.keys
assert_equal tasks.index("apply_rails_template") - 1, tasks.index("finish_template")
end
def test_after_bundle_callback
path = "http://example.org/rails_template"
template = +%{ after_bundle { run 'echo ran after_bundle' } }