Sha256: f582eeace2bba39d1697238c77a63286a538f93ed8e1e469be0e14c5b7b5510e

Contents?: true

Size: 1.6 KB

Versions: 19

Compression:

Stored size: 1.6 KB

Contents

# 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_active_job]     = !defined?(ActiveJob::Railtie)
          options[:skip_active_record]  = !defined?(ActiveRecord::Railtie)
          options[:skip_active_storage] = !defined?(ActiveStorage::Engine)
          options[:skip_action_mailer]  = !defined?(ActionMailer::Railtie)
          options[:skip_action_mailbox] = !defined?(ActionMailbox::Engine)
          options[:skip_action_text]    = !defined?(ActionText::Engine)
          options[:skip_action_cable]   = !defined?(ActionCable::Engine)
          options[:skip_test]           = !defined?(Rails::TestUnitRailtie)
          options[:skip_system_test]    = Rails.application.config.generators.system_tests.nil?
          options[:skip_asset_pipeline] = !defined?(Sprockets::Railtie) && !defined?(Propshaft::Railtie)
          options[:skip_bootsnap]       = !defined?(Bootsnap)
          options[:updating]            = true
          options
        end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
railties-7.0.8.6 lib/rails/app_updater.rb
railties-7.0.8.5 lib/rails/app_updater.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.4/lib/rails/app_updater.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/app_updater.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/app_updater.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/app_updater.rb
railties-7.0.8.4 lib/rails/app_updater.rb
railties-7.0.8.1 lib/rails/app_updater.rb
railties-7.0.8 lib/rails/app_updater.rb
railties-7.0.7.2 lib/rails/app_updater.rb
railties-7.0.7.1 lib/rails/app_updater.rb
railties-7.0.7 lib/rails/app_updater.rb
railties-7.0.6 lib/rails/app_updater.rb
railties-7.0.5.1 lib/rails/app_updater.rb
railties-7.0.5 lib/rails/app_updater.rb
railties-7.0.4.3 lib/rails/app_updater.rb
railties-7.0.4.2 lib/rails/app_updater.rb
railties-7.0.4.1 lib/rails/app_updater.rb
railties-7.0.4 lib/rails/app_updater.rb