Skip to content

Commit 11ad535

Browse files
committed
Turn app:update Rake tasks into a Command
1 parent 7d5c1c7 commit 11ad535

File tree

2 files changed

+38
-26
lines changed

2 files changed

+38
-26
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# frozen_string_literal: true
2+
3+
require "rails/app_updater"
4+
5+
module Rails
6+
module Command
7+
module App
8+
class UpdateCommand < Base # :nodoc:
9+
desc "update", "Update configs and some other initially generated files (or use just update:configs or update:bin)"
10+
def perform
11+
configs
12+
bin
13+
active_storage
14+
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
15+
end
16+
17+
desc "configs", "Update configuration files in the application config/ directory", hide: true
18+
def configs
19+
require_application!
20+
Rails::AppUpdater.invoke_from_app_generator :create_boot_file
21+
Rails::AppUpdater.invoke_from_app_generator :update_config_files
22+
end
23+
24+
desc "bin", "Update executables in the application bin/ directory", hide: true
25+
def bin
26+
require_application!
27+
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
28+
end
29+
30+
desc "active_storage", "Run the active_storage:update command", hide: true
31+
def active_storage
32+
require_application!
33+
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
34+
end
35+
end
36+
end
37+
end
38+
end
Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# frozen_string_literal: true
22

33
namespace :app do
4-
desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
5-
task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
6-
74
desc "Apply the template supplied by LOCATION=(/path/to/template) or URL"
85
task template: :environment do
96
template = ENV["LOCATION"]
@@ -34,27 +31,4 @@ namespace :app do
3431
end
3532
end
3633
end
37-
38-
namespace :update do
39-
require "rails/app_updater"
40-
41-
# desc "Update config files from your current rails install"
42-
task :configs do
43-
Rails::AppUpdater.invoke_from_app_generator :create_boot_file
44-
Rails::AppUpdater.invoke_from_app_generator :update_config_files
45-
end
46-
47-
# desc "Add new executables to the application bin/ directory"
48-
task :bin do
49-
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
50-
end
51-
52-
task :active_storage do
53-
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
54-
end
55-
56-
task :upgrade_guide_info do
57-
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
58-
end
59-
end
6034
end

0 commit comments

Comments
 (0)