diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-06-26 05:46:12 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-07-16 08:38:47 +0900 |
commit | 5803640261a324bd7d7665a2bad5b5dc6da29255 (patch) | |
tree | 725eb7e0f1eba0cf2f00b28df0bf80795f595824 /railties/lib/rails/tasks | |
parent | 5153c0c21daa2f19b01e8ed2738e9f154bd948f7 (diff) | |
download | rails-5803640261a324bd7d7665a2bad5b5dc6da29255.tar.gz rails-5803640261a324bd7d7665a2bad5b5dc6da29255.tar.bz2 rails-5803640261a324bd7d7665a2bad5b5dc6da29255.zip |
Do not generate unused components contents in `app:update` task
Currently, `app:update` generates all contents regardless of the
component using in application.
For example, even if not using Action Cable, `app:update` will generate
a contents related to Action Cable. This is a little inconvenient.
This PR checks the existence of the component and does not generate
unnecessary contents.
Can not check all options in this way. However, it will be able to
prevent the generation of unnecessary files.
Diffstat (limited to 'railties/lib/rails/tasks')
-rw-r--r-- | railties/lib/rails/tasks/framework.rake | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index f7e8f4f340..6c6e86d78d 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -36,38 +36,21 @@ namespace :app do end namespace :update do - class RailsUpdate - def self.invoke_from_app_generator(method) - app_generator.send(method) - end - - def self.app_generator - @app_generator ||= begin - require_relative "../generators" - require_relative "../generators/rails/app/app_generator" - gen = Rails::Generators::AppGenerator.new ["rails"], - { api: !!Rails.application.config.api_only, update: true }, - destination_root: Rails.root - File.exist?(Rails.root.join("config", "application.rb")) ? - gen.send(:app_const) : gen.send(:valid_const?) - gen - end - end - end + require_relative "../app_updater" # desc "Update config/boot.rb from your current rails install" task :configs do - RailsUpdate.invoke_from_app_generator :create_boot_file - RailsUpdate.invoke_from_app_generator :update_config_files + Rails::AppUpdater.invoke_from_app_generator :create_boot_file + Rails::AppUpdater.invoke_from_app_generator :update_config_files end # desc "Adds new executables to the application bin/ directory" task :bin do - RailsUpdate.invoke_from_app_generator :update_bin_files + Rails::AppUpdater.invoke_from_app_generator :update_bin_files end task :upgrade_guide_info do - RailsUpdate.invoke_from_app_generator :display_upgrade_guide_info + Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info end end end |