mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
21c9732fae
* Remove spring as a default installation option Faster computers have meant that most apps won't see a big benefit from Spring on small to moderate size apps. Thus the pain of dealing with the occasional spring issue is no longer warranted by default. * Errant end * No longer an option * Additional spring removals * Pointer to docs is enough
36 lines
1.3 KiB
Ruby
36 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails/generators"
|
|
require "rails/generators/rails/app/app_generator"
|
|
|
|
module Rails
|
|
class AppUpdater # :nodoc:
|
|
class << self
|
|
def invoke_from_app_generator(method)
|
|
app_generator.send(method)
|
|
end
|
|
|
|
def app_generator
|
|
@app_generator ||= begin
|
|
gen = Rails::Generators::AppGenerator.new ["rails"], generator_options, destination_root: Rails.root
|
|
gen.send(:valid_const?) unless File.exist?(Rails.root.join("config", "application.rb"))
|
|
gen
|
|
end
|
|
end
|
|
|
|
private
|
|
def generator_options
|
|
options = { api: !!Rails.application.config.api_only, update: true }
|
|
options[:skip_javascript] = !File.exist?(Rails.root.join("bin", "yarn"))
|
|
options[:skip_active_record] = !defined?(ActiveRecord::Railtie)
|
|
options[:skip_active_storage] = !defined?(ActiveStorage::Engine) || !defined?(ActiveRecord::Railtie)
|
|
options[:skip_action_mailer] = !defined?(ActionMailer::Railtie)
|
|
options[:skip_action_cable] = !defined?(ActionCable::Engine)
|
|
options[:skip_sprockets] = !defined?(Sprockets::Railtie)
|
|
options[:skip_bootsnap] = !defined?(Bootsnap)
|
|
options[:updating] = true
|
|
options
|
|
end
|
|
end
|
|
end
|
|
end
|