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
|
||||
|
||||
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 :copy_migration do
|
||||
if Rake::Task.task_defined?("action_mailbox:install:migrations")
|
||||
Rake::Task["action_mailbox:install:migrations"].invoke
|
||||
else
|
||||
Rake::Task["app:action_mailbox:install:migrations"].invoke
|
||||
end
|
||||
end
|
||||
task :run_installer do
|
||||
installer_template = File.expand_path("../templates/installer.rb", __dir__)
|
||||
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{installer_template}"
|
||||
end
|
||||
|
||||
task :copy_migrations do
|
||||
Rake::Task["active_storage:install:migrations"].invoke
|
||||
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
|
||||
|
|
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