Turn app:update Rake tasks into a Command
This commit is contained in:
parent
7d5c1c7ea8
commit
11ad535069
38
railties/lib/rails/commands/app/update_command.rb
Normal file
38
railties/lib/rails/commands/app/update_command.rb
Normal file
@ -0,0 +1,38 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails/app_updater"
|
||||
|
||||
module Rails
|
||||
module Command
|
||||
module App
|
||||
class UpdateCommand < Base # :nodoc:
|
||||
desc "update", "Update configs and some other initially generated files (or use just update:configs or update:bin)"
|
||||
def perform
|
||||
configs
|
||||
bin
|
||||
active_storage
|
||||
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
||||
end
|
||||
|
||||
desc "configs", "Update configuration files in the application config/ directory", hide: true
|
||||
def configs
|
||||
require_application!
|
||||
Rails::AppUpdater.invoke_from_app_generator :create_boot_file
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_config_files
|
||||
end
|
||||
|
||||
desc "bin", "Update executables in the application bin/ directory", hide: true
|
||||
def bin
|
||||
require_application!
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
|
||||
end
|
||||
|
||||
desc "active_storage", "Run the active_storage:update command", hide: true
|
||||
def active_storage
|
||||
require_application!
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,9 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
namespace :app do
|
||||
desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
|
||||
task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
|
||||
|
||||
desc "Apply the template supplied by LOCATION=(/path/to/template) or URL"
|
||||
task template: :environment do
|
||||
template = ENV["LOCATION"]
|
||||
@ -34,27 +31,4 @@ namespace :app do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :update do
|
||||
require "rails/app_updater"
|
||||
|
||||
# desc "Update config files from your current rails install"
|
||||
task :configs do
|
||||
Rails::AppUpdater.invoke_from_app_generator :create_boot_file
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_config_files
|
||||
end
|
||||
|
||||
# desc "Add new executables to the application bin/ directory"
|
||||
task :bin do
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
|
||||
end
|
||||
|
||||
task :active_storage do
|
||||
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
|
||||
end
|
||||
|
||||
task :upgrade_guide_info do
|
||||
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user