Sha256: 33b9ba378bd5723d751d54112b90f7b4a62f7812dd9584a7f579e7acbe295ef8

Contents?: true

Size: 1.39 KB

Versions: 84

Compression:

Stored size: 1.39 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_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_puma]           = !defined?(Puma)
          options[:skip_bootsnap]       = !defined?(Bootsnap)
          options[:skip_spring]         = !defined?(Spring)
          options
        end
    end
  end
end

Version data entries

84 entries across 82 versions & 8 rubygems

Version Path
railties-6.0.4.8 lib/rails/app_updater.rb
railties-6.1.5 lib/rails/app_updater.rb
railties-6.1.4.7 lib/rails/app_updater.rb
railties-6.0.4.7 lib/rails/app_updater.rb
railties-6.1.4.6 lib/rails/app_updater.rb
railties-6.0.4.6 lib/rails/app_updater.rb
railties-6.0.4.5 lib/rails/app_updater.rb
railties-6.1.4.5 lib/rails/app_updater.rb
railties-6.1.4.4 lib/rails/app_updater.rb
railties-6.0.4.4 lib/rails/app_updater.rb
railties-6.1.4.3 lib/rails/app_updater.rb
railties-6.0.4.3 lib/rails/app_updater.rb
railties-6.0.4.2 lib/rails/app_updater.rb
railties-6.1.4.2 lib/rails/app_updater.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/app_updater.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/railties-6.1.4.1/lib/rails/app_updater.rb
railties-6.1.4.1 lib/rails/app_updater.rb
railties-6.0.4.1 lib/rails/app_updater.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/railties-6.1.4/lib/rails/app_updater.rb
railties-6.1.4 lib/rails/app_updater.rb