mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add installer
This commit is contained in:
parent
2746449085
commit
2c17861470
3 changed files with 17 additions and 9 deletions
|
@ -5,15 +5,16 @@ namespace :action_mailbox do
|
||||||
Rake::Task["install:migrations"].clear_comments
|
Rake::Task["install:migrations"].clear_comments
|
||||||
|
|
||||||
desc "Copy over the migration"
|
desc "Copy over the migration"
|
||||||
task install: %w[ environment install:copy_migration active_storage:install ]
|
task install: %w[ environment run_installer copy_migrations ]
|
||||||
|
|
||||||
namespace :install do
|
task :run_installer do
|
||||||
task :copy_migration do
|
installer_template = File.expand_path("../templates/installer.rb", __dir__)
|
||||||
if Rake::Task.task_defined?("action_mailbox:install:migrations")
|
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{installer_template}"
|
||||||
Rake::Task["action_mailbox:install:migrations"].invoke
|
end
|
||||||
else
|
|
||||||
Rake::Task["app:action_mailbox:install:migrations"].invoke
|
task :copy_migrations do
|
||||||
end
|
Rake::Task["active_storage:install:migrations"].invoke
|
||||||
end
|
Rake::Task["railties:install:migrations"].reenable # Otherwise you can't run 2 migration copy tasks in one invocation
|
||||||
|
Rake::Task["action_mailbox:install:migrations"].invoke
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
4
lib/templates/installer.rb
Normal file
4
lib/templates/installer.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
say "Copying application_mailbox.rb to app/mailboxes"
|
||||||
|
copy_file "#{__dir__}/mailboxes/application_mailbox.rb", "app/mailboxes/application_mailbox.rb"
|
||||||
|
|
||||||
|
environment "# Prepare the ingress controller used to receive mail\nconfig.action_mailbox.ingress = :amazon\n\n", env: 'production'
|
3
lib/templates/mailboxes/application_mailbox.rb
Normal file
3
lib/templates/mailboxes/application_mailbox.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationMailbox < ActionMailbox::Base
|
||||||
|
# route /something/i => :somewhere
|
||||||
|
end
|
Loading…
Reference in a new issue