Sha256: d26fbff77ceeb0fde2d7d0e15ff8ee35a1828c630f96a6ef4654eb810d91dbef

Contents?: true

Size: 1.66 KB

Versions: 13

Compression:

Stored size: 1.66 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[:name]                = Rails.application.class.name.chomp("::Application").underscore
          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
        end
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/app_updater.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/app_updater.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/app_updater.rb
railties-7.1.3.4 lib/rails/app_updater.rb
railties-7.1.3.2 lib/rails/app_updater.rb
railties-7.1.3.1 lib/rails/app_updater.rb
railties-7.1.3 lib/rails/app_updater.rb
railties-7.1.2 lib/rails/app_updater.rb
railties-7.1.1 lib/rails/app_updater.rb
railties-7.1.0 lib/rails/app_updater.rb
railties-7.1.0.rc2 lib/rails/app_updater.rb
railties-7.1.0.rc1 lib/rails/app_updater.rb
railties-7.1.0.beta1 lib/rails/app_updater.rb