Sha256: 7f943945e4b51f693e810549a84214608ef394354242a33f100fb14f3f36b55a

Contents?: true

Size: 1.21 KB

Versions: 37

Compression:

Stored size: 1.21 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
          File.exist?(Rails.root.join("config", "application.rb")) ? gen.send(:app_const) : gen.send(:valid_const?)
          gen
        end
      end

      private
        def generator_options
          options = { api: !!Rails.application.config.api_only, update: true }
          options[:skip_active_record]  = !defined?(ActiveRecord::Railtie)
          options[:skip_active_storage] = !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_puma]           = !defined?(Puma)
          options[:skip_spring]         = !defined?(Spring)
          options
        end
    end
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
railties-5.2.8.1 lib/rails/app_updater.rb
railties-5.2.8 lib/rails/app_updater.rb
railties-5.2.7.1 lib/rails/app_updater.rb
railties-5.2.7 lib/rails/app_updater.rb
railties-5.2.6.3 lib/rails/app_updater.rb
railties-5.2.6.2 lib/rails/app_updater.rb
railties-5.2.6.1 lib/rails/app_updater.rb
railties-5.2.6 lib/rails/app_updater.rb
railties-5.2.4.6 lib/rails/app_updater.rb
railties-5.2.5 lib/rails/app_updater.rb
railties-5.2.4.5 lib/rails/app_updater.rb
railties-5.2.4.4 lib/rails/app_updater.rb
railties-5.2.4.3 lib/rails/app_updater.rb
railties-5.2.4.2 lib/rails/app_updater.rb
railties-5.2.4.1 lib/rails/app_updater.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/app_updater.rb
railties-5.2.4 lib/rails/app_updater.rb
railties-5.2.4.rc1 lib/rails/app_updater.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/app_updater.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/railties-5.2.3/lib/rails/app_updater.rb