railties 7.0.0 → 7.0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/MIT-LICENSE +1 -1
- data/lib/rails/application/configuration.rb +4 -1
- data/lib/rails/application/finisher.rb +0 -1
- data/lib/rails/application.rb +4 -1
- data/lib/rails/autoloaders/inflector.rb +1 -1
- data/lib/rails/autoloaders.rb +40 -36
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +10 -7
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions.rb +30 -13
- data/lib/rails/generators/app_base.rb +29 -36
- data/lib/rails/generators/generated_attribute.rb +2 -2
- data/lib/rails/generators/rails/app/app_generator.rb +13 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +31 -0
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +7 -20
- data/lib/rails/tasks/framework.rake +5 -1
- data/lib/rails/templates/rails/welcome/index.html.erb +2 -1
- data/lib/rails.rb +1 -2
- metadata +15 -15
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9b404b6ddf82ab811262c885d71c088c6e150688039b36deef74e5a2cf3a2d2d
         | 
| 4 | 
            +
              data.tar.gz: 585488b7d32ec75180b0f7da9cf164f8687b934361cdbbab9a97b486b92bfa4d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aa73bd1c301d365a1ad7ed7ce7fe3435f04c5c68390dc5ce88a713de7d4771506326573af95b8a04c8a38daeff6b4e5cf05b781c49d877d53b7f06eb5d566f1f
         | 
| 7 | 
            +
              data.tar.gz: 576e80f6e59392e2c70ef11ac2c966d5d2fdc2280ae63eee3c9aa7974efe98c3120eca1508448c6c1b242558ea85580fe8956a5383288fd1d7770e1f6f3e2cab
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,45 @@ | |
| 1 | 
            +
            ## Rails 7.0.2.2 (February 11, 2022) ##
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            *   No changes.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
            ## Rails 7.0.2.1 (February 11, 2022) ##
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            *   No changes.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## Rails 7.0.2 (February 08, 2022) ##
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            *   No changes.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
             | 
| 16 | 
            +
            ## Rails 7.0.1 (January 06, 2022) ##
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            *   Prevent duplicate entries in plugin Gemfile.
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                *Jonathan Hefner*
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            *   Fix asset pipeline errors for plugin dummy apps.
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                *Jonathan Hefner*
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            *   Fix generated route revocation.
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                *Jonathan Hefner*
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            *   Addresses an issue in which Sidekiq jobs could not reload certain
         | 
| 31 | 
            +
                namespaces.
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                See [fxn/zeitwerk#198](https://github.com/fxn/zeitwerk/issues/198) for
         | 
| 34 | 
            +
                details.
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                *Xavier Noria*
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            *   Fix plugin generator to a plugin that pass all the tests.
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                *Rafael Mendonça França*
         | 
| 41 | 
            +
             | 
| 42 | 
            +
             | 
| 1 43 | 
             
            ## Rails 7.0.0 (December 15, 2021) ##
         | 
| 2 44 |  | 
| 3 45 | 
             
            *   No changes.
         | 
    
        data/MIT-LICENSE
    CHANGED
    
    
| @@ -81,7 +81,10 @@ module Rails | |
| 81 81 | 
             
                    @server_timing                           = false
         | 
| 82 82 | 
             
                  end
         | 
| 83 83 |  | 
| 84 | 
            -
                  # Loads default  | 
| 84 | 
            +
                  # Loads default configuration values for a target version. This includes
         | 
| 85 | 
            +
                  # defaults for versions prior to the target version. See the
         | 
| 86 | 
            +
                  # {configuration guide}[https://guides.rubyonrails.org/configuring.html]
         | 
| 87 | 
            +
                  # for the default values associated with a particular version.
         | 
| 85 88 | 
             
                  def load_defaults(target_version)
         | 
| 86 89 | 
             
                    case target_version.to_s
         | 
| 87 90 | 
             
                    when "5.0"
         | 
    
        data/lib/rails/application.rb
    CHANGED
    
    | @@ -10,6 +10,7 @@ require "active_support/hash_with_indifferent_access" | |
| 10 10 | 
             
            require "active_support/configuration_file"
         | 
| 11 11 | 
             
            require "rails/engine"
         | 
| 12 12 | 
             
            require "rails/secrets"
         | 
| 13 | 
            +
            require "rails/autoloaders"
         | 
| 13 14 |  | 
| 14 15 | 
             
            module Rails
         | 
| 15 16 | 
             
              # An Engine with the responsibility of coordinating the whole boot process.
         | 
| @@ -95,7 +96,7 @@ module Rails | |
| 95 96 |  | 
| 96 97 | 
             
                attr_accessor :assets, :sandbox
         | 
| 97 98 | 
             
                alias_method :sandbox?, :sandbox
         | 
| 98 | 
            -
                attr_reader :reloaders, :reloader, :executor
         | 
| 99 | 
            +
                attr_reader :reloaders, :reloader, :executor, :autoloaders
         | 
| 99 100 |  | 
| 100 101 | 
             
                delegate :default_url_options, :default_url_options=, to: :routes
         | 
| 101 102 |  | 
| @@ -117,6 +118,8 @@ module Rails | |
| 117 118 | 
             
                  @reloader          = Class.new(ActiveSupport::Reloader)
         | 
| 118 119 | 
             
                  @reloader.executor = @executor
         | 
| 119 120 |  | 
| 121 | 
            +
                  @autoloaders = Rails::Autoloaders.new
         | 
| 122 | 
            +
             | 
| 120 123 | 
             
                  # are these actually used?
         | 
| 121 124 | 
             
                  @initial_variable_values = initial_variable_values
         | 
| 122 125 | 
             
                  @block = block
         | 
    
        data/lib/rails/autoloaders.rb
    CHANGED
    
    | @@ -1,44 +1,48 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
            require "zeitwerk"
         | 
| 4 | 
            -
             | 
| 5 3 | 
             
            module Rails
         | 
| 6 | 
            -
               | 
| 4 | 
            +
              class Autoloaders # :nodoc:
         | 
| 7 5 | 
             
                require_relative "autoloaders/inflector"
         | 
| 8 6 |  | 
| 9 | 
            -
                 | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                   | 
| 18 | 
            -
             | 
| 19 | 
            -
                   | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                   | 
| 25 | 
            -
             | 
| 26 | 
            -
                   | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                   | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                   | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                   | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 7 | 
            +
                include Enumerable
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                attr_reader :main, :once
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def initialize
         | 
| 12 | 
            +
                  # This `require` delays loading the library on purpose.
         | 
| 13 | 
            +
                  #
         | 
| 14 | 
            +
                  # In Rails 7.0.0, railties/lib/rails.rb loaded Zeitwerk as a side-effect,
         | 
| 15 | 
            +
                  # but a couple of edge cases related to Bundler and Bootsnap showed up.
         | 
| 16 | 
            +
                  # They had to do with order of decoration of `Kernel#require`, something
         | 
| 17 | 
            +
                  # the three of them do.
         | 
| 18 | 
            +
                  #
         | 
| 19 | 
            +
                  # Delaying this `require` up to this point is a convenient trade-off.
         | 
| 20 | 
            +
                  require "zeitwerk"
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  @main = Zeitwerk::Loader.new
         | 
| 23 | 
            +
                  @main.tag = "rails.main"
         | 
| 24 | 
            +
                  @main.inflector = Inflector
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  @once = Zeitwerk::Loader.new
         | 
| 27 | 
            +
                  @once.tag = "rails.once"
         | 
| 28 | 
            +
                  @once.inflector = Inflector
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def each
         | 
| 32 | 
            +
                  yield main
         | 
| 33 | 
            +
                  yield once
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                def logger=(logger)
         | 
| 37 | 
            +
                  each { |loader| loader.logger = logger }
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                def log!
         | 
| 41 | 
            +
                  each(&:log!)
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                def zeitwerk_enabled?
         | 
| 45 | 
            +
                  true
         | 
| 42 46 | 
             
                end
         | 
| 43 47 | 
             
              end
         | 
| 44 48 | 
             
            end
         | 
| @@ -97,15 +97,18 @@ module Rails | |
| 97 97 | 
             
                def db_config
         | 
| 98 98 | 
             
                  return @db_config if defined?(@db_config)
         | 
| 99 99 |  | 
| 100 | 
            -
                  #  | 
| 101 | 
            -
                  # first  | 
| 102 | 
            -
                   | 
| 103 | 
            -
             | 
| 104 | 
            -
                   | 
| 100 | 
            +
                  # If the user provided a database, use that. Otherwise find
         | 
| 101 | 
            +
                  # the first config in the database.yml
         | 
| 102 | 
            +
                  if database
         | 
| 103 | 
            +
                    @db_config = configurations.configs_for(env_name: environment, name: database, include_hidden: true)
         | 
| 104 | 
            +
                  else
         | 
| 105 | 
            +
                    @db_config = configurations.find_db_config(environment)
         | 
| 106 | 
            +
                  end
         | 
| 105 107 |  | 
| 106 108 | 
             
                  unless @db_config
         | 
| 109 | 
            +
                    missing_db = database ? "'#{database}' database is not" : "No databases are"
         | 
| 107 110 | 
             
                    raise ActiveRecord::AdapterNotSpecified,
         | 
| 108 | 
            -
                      " | 
| 111 | 
            +
                      "#{missing_db} configured for '#{environment}'. Available configuration: #{configurations.inspect}"
         | 
| 109 112 | 
             
                  end
         | 
| 110 113 |  | 
| 111 114 | 
             
                  @db_config
         | 
| @@ -116,7 +119,7 @@ module Rails | |
| 116 119 | 
             
                end
         | 
| 117 120 |  | 
| 118 121 | 
             
                def database
         | 
| 119 | 
            -
                  @options | 
| 122 | 
            +
                  @options[:database]
         | 
| 120 123 | 
             
                end
         | 
| 121 124 |  | 
| 122 125 | 
             
                private
         | 
    
        data/lib/rails/gem_version.rb
    CHANGED
    
    
| @@ -279,26 +279,32 @@ module Rails | |
| 279 279 | 
             
                  #   route "root 'welcome#index'"
         | 
| 280 280 | 
             
                  #   route "root 'admin#index'", namespace: :admin
         | 
| 281 281 | 
             
                  def route(routing_code, namespace: nil)
         | 
| 282 | 
            -
                     | 
| 283 | 
            -
             | 
| 282 | 
            +
                    namespace = Array(namespace)
         | 
| 283 | 
            +
                    namespace_pattern = route_namespace_pattern(namespace)
         | 
| 284 | 
            +
                    routing_code = namespace.reverse.reduce(routing_code) do |code, name|
         | 
| 285 | 
            +
                      "namespace :#{name} do\n#{rebase_indentation(code, 2)}end"
         | 
| 284 286 | 
             
                    end
         | 
| 285 287 |  | 
| 286 288 | 
             
                    log :route, routing_code
         | 
| 287 289 |  | 
| 288 | 
            -
                    after_pattern = Array(namespace).each_with_index.reverse_each.reduce(nil) do |pattern, (ns, i)|
         | 
| 289 | 
            -
                      margin = "\\#{i + 1}[ ]{2}"
         | 
| 290 | 
            -
                      "(?:(?:^[ ]*\n|^#{margin}.*\n)*?^(#{margin})namespace :#{ns} do\n#{pattern})?"
         | 
| 291 | 
            -
                    end.then do |pattern|
         | 
| 292 | 
            -
                      /^([ ]*).+\.routes\.draw do[ ]*\n#{pattern}/
         | 
| 293 | 
            -
                    end
         | 
| 294 | 
            -
             | 
| 295 290 | 
             
                    in_root do
         | 
| 296 | 
            -
                      if  | 
| 297 | 
            -
                        base_indent, *,  | 
| 298 | 
            -
                         | 
| 291 | 
            +
                      if namespace_match = match_file("config/routes.rb", namespace_pattern)
         | 
| 292 | 
            +
                        base_indent, *, existing_block_indent = namespace_match.captures.compact.map(&:length)
         | 
| 293 | 
            +
                        existing_line_pattern = /^[ ]{,#{existing_block_indent}}\S.+\n?/
         | 
| 294 | 
            +
                        routing_code = rebase_indentation(routing_code, base_indent + 2).gsub(existing_line_pattern, "")
         | 
| 295 | 
            +
                        namespace_pattern = /#{Regexp.escape namespace_match.to_s}/
         | 
| 299 296 | 
             
                      end
         | 
| 300 297 |  | 
| 301 | 
            -
                      inject_into_file "config/routes.rb", routing_code, after:  | 
| 298 | 
            +
                      inject_into_file "config/routes.rb", routing_code, after: namespace_pattern, verbose: false, force: false
         | 
| 299 | 
            +
             | 
| 300 | 
            +
                      if behavior == :revoke && namespace.any? && namespace_match
         | 
| 301 | 
            +
                        empty_block_pattern = /(#{namespace_pattern})((?:\s*end\n){1,#{namespace.size}})/
         | 
| 302 | 
            +
                        gsub_file "config/routes.rb", empty_block_pattern, verbose: false, force: true do |matched|
         | 
| 303 | 
            +
                          beginning, ending = empty_block_pattern.match(matched).captures
         | 
| 304 | 
            +
                          ending.sub!(/\A\s*end\n/, "") while !ending.empty? && beginning.sub!(/^[ ]*namespace .+ do\n\s*\z/, "")
         | 
| 305 | 
            +
                          beginning + ending
         | 
| 306 | 
            +
                        end
         | 
| 307 | 
            +
                      end
         | 
| 302 308 | 
             
                    end
         | 
| 303 309 | 
             
                  end
         | 
| 304 310 |  | 
| @@ -363,6 +369,7 @@ module Rails | |
| 363 369 | 
             
                      return "#{value}\n" unless value.is_a?(String)
         | 
| 364 370 | 
             
                      "#{value.strip_heredoc.indent(amount).chomp}\n"
         | 
| 365 371 | 
             
                    end
         | 
| 372 | 
            +
                    alias rebase_indentation optimize_indentation
         | 
| 366 373 |  | 
| 367 374 | 
             
                    # Indent the +Gemfile+ to the depth of @indentation
         | 
| 368 375 | 
             
                    def indentation # :doc:
         | 
| @@ -387,6 +394,16 @@ module Rails | |
| 387 394 | 
             
                    def match_file(path, pattern)
         | 
| 388 395 | 
             
                      File.read(path).match(pattern) if File.exist?(path)
         | 
| 389 396 | 
             
                    end
         | 
| 397 | 
            +
             | 
| 398 | 
            +
                    def route_namespace_pattern(namespace)
         | 
| 399 | 
            +
                      namespace.each_with_index.reverse_each.reduce(nil) do |pattern, (name, i)|
         | 
| 400 | 
            +
                        cummulative_margin = "\\#{i + 1}[ ]{2}"
         | 
| 401 | 
            +
                        blank_or_indented_line = "^[ ]*\n|^#{cummulative_margin}.*\n"
         | 
| 402 | 
            +
                        "(?:(?:#{blank_or_indented_line})*?^(#{cummulative_margin})namespace :#{name} do\n#{pattern})?"
         | 
| 403 | 
            +
                      end.then do |pattern|
         | 
| 404 | 
            +
                        /^([ ]*).+\.routes\.draw do[ ]*\n#{pattern}/
         | 
| 405 | 
            +
                      end
         | 
| 406 | 
            +
                    end
         | 
| 390 407 | 
             
                end
         | 
| 391 408 | 
             
              end
         | 
| 392 409 | 
             
            end
         | 
| @@ -108,16 +108,18 @@ module Rails | |
| 108 108 |  | 
| 109 109 | 
             
                private
         | 
| 110 110 | 
             
                  def gemfile_entries # :doc:
         | 
| 111 | 
            -
                    [ | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 111 | 
            +
                    [
         | 
| 112 | 
            +
                      rails_gemfile_entry,
         | 
| 113 | 
            +
                      asset_pipeline_gemfile_entry,
         | 
| 114 | 
            +
                      database_gemfile_entry,
         | 
| 115 | 
            +
                      web_server_gemfile_entry,
         | 
| 116 | 
            +
                      javascript_gemfile_entry,
         | 
| 117 | 
            +
                      hotwire_gemfile_entry,
         | 
| 118 | 
            +
                      css_gemfile_entry,
         | 
| 119 | 
            +
                      jbuilder_gemfile_entry,
         | 
| 120 | 
            +
                      psych_gemfile_entry,
         | 
| 121 | 
            +
                      cable_gemfile_entry,
         | 
| 122 | 
            +
                    ].flatten.compact.select(&@gem_filter)
         | 
| 121 123 | 
             
                  end
         | 
| 122 124 |  | 
| 123 125 | 
             
                  def builder # :doc:
         | 
| @@ -159,7 +161,8 @@ module Rails | |
| 159 161 | 
             
                  end
         | 
| 160 162 |  | 
| 161 163 | 
             
                  def database_gemfile_entry # :doc:
         | 
| 162 | 
            -
                    return  | 
| 164 | 
            +
                    return if options[:skip_active_record]
         | 
| 165 | 
            +
             | 
| 163 166 | 
             
                    gem_name, gem_version = gem_for_database
         | 
| 164 167 | 
             
                    GemfileEntry.version gem_name, gem_version,
         | 
| 165 168 | 
             
                      "Use #{options[:database]} as the database for Active Record"
         | 
| @@ -170,15 +173,13 @@ module Rails | |
| 170 173 | 
             
                  end
         | 
| 171 174 |  | 
| 172 175 | 
             
                  def asset_pipeline_gemfile_entry
         | 
| 173 | 
            -
                    return  | 
| 176 | 
            +
                    return if options[:skip_asset_pipeline]
         | 
| 174 177 |  | 
| 175 178 | 
             
                    if options[:asset_pipeline] == "sprockets"
         | 
| 176 179 | 
             
                      GemfileEntry.floats "sprockets-rails",
         | 
| 177 180 | 
             
                        "The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]"
         | 
| 178 181 | 
             
                    elsif options[:asset_pipeline] == "propshaft"
         | 
| 179 182 | 
             
                      GemfileEntry.floats "propshaft", "The modern asset pipeline for Rails [https://github.com/rails/propshaft]"
         | 
| 180 | 
            -
                    else
         | 
| 181 | 
            -
                      []
         | 
| 182 183 | 
             
                    end
         | 
| 183 184 | 
             
                  end
         | 
| 184 185 |  | 
| @@ -264,20 +265,13 @@ module Rails | |
| 264 265 | 
             
                      new(name, nil, comment, path: path)
         | 
| 265 266 | 
             
                    end
         | 
| 266 267 |  | 
| 267 | 
            -
                    def version
         | 
| 268 | 
            -
                      version = super
         | 
| 269 | 
            -
             | 
| 270 | 
            -
                      if version.is_a?(Array)
         | 
| 271 | 
            -
                        version.join('", "')
         | 
| 272 | 
            -
                      else
         | 
| 273 | 
            -
                        version
         | 
| 274 | 
            -
                      end
         | 
| 275 | 
            -
                    end
         | 
| 276 | 
            -
             | 
| 277 268 | 
             
                    def to_s
         | 
| 278 | 
            -
                      [ | 
| 279 | 
            -
                        ("# " | 
| 280 | 
            -
                         | 
| 269 | 
            +
                      [
         | 
| 270 | 
            +
                        (comment.gsub(/^/, "# ").chomp + "\n" if comment),
         | 
| 271 | 
            +
                        ("# " if commented_out),
         | 
| 272 | 
            +
                        "gem \"#{name}\"",
         | 
| 273 | 
            +
                        *Array(version).map { |constraint| ", \"#{constraint}\"" },
         | 
| 274 | 
            +
                        *options.map { |key, value| ", #{key}: #{value.inspect}" },
         | 
| 281 275 | 
             
                      ].compact.join
         | 
| 282 276 | 
             
                    end
         | 
| 283 277 | 
             
                  end
         | 
| @@ -314,12 +308,12 @@ module Rails | |
| 314 308 | 
             
                  end
         | 
| 315 309 |  | 
| 316 310 | 
             
                  def jbuilder_gemfile_entry
         | 
| 317 | 
            -
                    return  | 
| 311 | 
            +
                    return if options[:skip_jbuilder]
         | 
| 318 312 | 
             
                    GemfileEntry.new "jbuilder", nil, "Build JSON APIs with ease [https://github.com/rails/jbuilder]", {}, options[:api]
         | 
| 319 313 | 
             
                  end
         | 
| 320 314 |  | 
| 321 315 | 
             
                  def javascript_gemfile_entry
         | 
| 322 | 
            -
                    return  | 
| 316 | 
            +
                    return if options[:skip_javascript]
         | 
| 323 317 |  | 
| 324 318 | 
             
                    if adjusted_javascript_option == "importmap"
         | 
| 325 319 | 
             
                      GemfileEntry.floats "importmap-rails", "Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]"
         | 
| @@ -329,7 +323,7 @@ module Rails | |
| 329 323 | 
             
                  end
         | 
| 330 324 |  | 
| 331 325 | 
             
                  def hotwire_gemfile_entry
         | 
| 332 | 
            -
                    return  | 
| 326 | 
            +
                    return if options[:skip_javascript] || options[:skip_hotwire]
         | 
| 333 327 |  | 
| 334 328 | 
             
                    turbo_rails_entry =
         | 
| 335 329 | 
             
                      GemfileEntry.floats "turbo-rails", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]"
         | 
| @@ -355,7 +349,7 @@ module Rails | |
| 355 349 | 
             
                  end
         | 
| 356 350 |  | 
| 357 351 | 
             
                  def css_gemfile_entry
         | 
| 358 | 
            -
                    return  | 
| 352 | 
            +
                    return unless options[:css]
         | 
| 359 353 |  | 
| 360 354 | 
             
                    if !using_node? && options[:css] == "tailwind"
         | 
| 361 355 | 
             
                      GemfileEntry.floats "tailwindcss-rails", "Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]"
         | 
| @@ -365,7 +359,7 @@ module Rails | |
| 365 359 | 
             
                  end
         | 
| 366 360 |  | 
| 367 361 | 
             
                  def psych_gemfile_entry
         | 
| 368 | 
            -
                    return  | 
| 362 | 
            +
                    return unless defined?(Rubinius)
         | 
| 369 363 |  | 
| 370 364 | 
             
                    comment = "Use Psych as the YAML engine, instead of Syck, so serialized " \
         | 
| 371 365 | 
             
                              "data can be read safely from different rubies (see http://git.io/uuLVag)"
         | 
| @@ -373,11 +367,10 @@ module Rails | |
| 373 367 | 
             
                  end
         | 
| 374 368 |  | 
| 375 369 | 
             
                  def cable_gemfile_entry
         | 
| 376 | 
            -
                    return  | 
| 370 | 
            +
                    return if options[:skip_action_cable]
         | 
| 371 | 
            +
             | 
| 377 372 | 
             
                    comment = "Use Redis adapter to run Action Cable in production"
         | 
| 378 | 
            -
                     | 
| 379 | 
            -
                    gems << GemfileEntry.new("redis", "~> 4.0", comment, {}, true)
         | 
| 380 | 
            -
                    gems
         | 
| 373 | 
            +
                    GemfileEntry.new("redis", "~> 4.0", comment, {}, true)
         | 
| 381 374 | 
             
                  end
         | 
| 382 375 |  | 
| 383 376 | 
             
                  def bundle_command(command, env = {})
         | 
| @@ -123,8 +123,8 @@ module Rails | |
| 123 123 | 
             
                                 when :integer                     then 1
         | 
| 124 124 | 
             
                                 when :float                       then 1.5
         | 
| 125 125 | 
             
                                 when :decimal                     then "9.99"
         | 
| 126 | 
            -
                                 when :datetime, :timestamp, :time then Time.now. | 
| 127 | 
            -
                                 when :date                        then Date.today. | 
| 126 | 
            +
                                 when :datetime, :timestamp, :time then Time.now.to_fs(:db)
         | 
| 127 | 
            +
                                 when :date                        then Date.today.to_fs(:db)
         | 
| 128 128 | 
             
                                 when :string                      then name == "type" ? "" : "MyString"
         | 
| 129 129 | 
             
                                 when :text                        then "MyText"
         | 
| 130 130 | 
             
                                 when :boolean                     then false
         | 
| @@ -193,6 +193,14 @@ module Rails | |
| 193 193 | 
             
                  directory "db"
         | 
| 194 194 | 
             
                end
         | 
| 195 195 |  | 
| 196 | 
            +
                def db_when_updating
         | 
| 197 | 
            +
                  path = File.expand_path("db/schema.rb", destination_root)
         | 
| 198 | 
            +
             | 
| 199 | 
            +
                  if File.exist?(path)
         | 
| 200 | 
            +
                    gsub_file("db/schema.rb", /ActiveRecord::Schema\.define/, "ActiveRecord::Schema[6.1].define")
         | 
| 201 | 
            +
                  end
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
             | 
| 196 204 | 
             
                def lib
         | 
| 197 205 | 
             
                  empty_directory "lib"
         | 
| 198 206 | 
             
                  empty_directory_with_keep_file "lib/tasks"
         | 
| @@ -333,6 +341,11 @@ module Rails | |
| 333 341 | 
             
                  end
         | 
| 334 342 | 
             
                  remove_task :update_bin_files
         | 
| 335 343 |  | 
| 344 | 
            +
                  def update_db_schema
         | 
| 345 | 
            +
                    build(:db_when_updating)
         | 
| 346 | 
            +
                  end
         | 
| 347 | 
            +
                  remove_task :update_db_schema
         | 
| 348 | 
            +
             | 
| 336 349 | 
             
                  def update_active_storage
         | 
| 337 350 | 
             
                    unless skip_active_storage?
         | 
| 338 351 | 
             
                      rails_command "active_storage:update", inline: true
         | 
| @@ -8,7 +8,7 @@ require "active_support/core_ext/integer/time" | |
| 8 8 | 
             
            Rails.application.configure do
         | 
| 9 9 | 
             
              # Settings specified here will take precedence over those in config/application.rb.
         | 
| 10 10 |  | 
| 11 | 
            -
              # Turn false under Spring and add config.action_view.cache_template_loading = true
         | 
| 11 | 
            +
              # Turn false under Spring and add config.action_view.cache_template_loading = true.
         | 
| 12 12 | 
             
              config.cache_classes = true
         | 
| 13 13 |  | 
| 14 14 | 
             
              # Eager loading loads your whole application. When running a single test locally,
         | 
    
        data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
    CHANGED
    
    | @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            # Be sure to restart your server when you modify this file.
         | 
| 2 2 |  | 
| 3 | 
            -
            # Configure  | 
| 3 | 
            +
            # Configure parameters to be filtered from the log file. Use this to limit dissemination of
         | 
| 4 | 
            +
            # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
         | 
| 5 | 
            +
            # notations and behaviors.
         | 
| 4 6 | 
             
            Rails.application.config.filter_parameters += [
         | 
| 5 7 | 
             
              :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
         | 
| 6 8 | 
             
            ]
         | 
| @@ -226,6 +226,10 @@ module Rails | |
| 226 226 | 
             
                  def initialize(*args)
         | 
| 227 227 | 
             
                    @dummy_path = nil
         | 
| 228 228 | 
             
                    super
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                    if !engine? || !with_dummy_app?
         | 
| 231 | 
            +
                      self.options = options.merge(skip_asset_pipeline: true).freeze
         | 
| 232 | 
            +
                    end
         | 
| 229 233 | 
             
                  end
         | 
| 230 234 |  | 
| 231 235 | 
             
                  public_task :set_default_accessors!
         | 
| @@ -309,6 +313,33 @@ module Rails | |
| 309 313 | 
             
                  end
         | 
| 310 314 |  | 
| 311 315 | 
             
                private
         | 
| 316 | 
            +
                  def gemfile_entries
         | 
| 317 | 
            +
                    [
         | 
| 318 | 
            +
                      rails_gemfile_entry,
         | 
| 319 | 
            +
                      simplify_gemfile_entries(
         | 
| 320 | 
            +
                        database_gemfile_entry,
         | 
| 321 | 
            +
                        asset_pipeline_gemfile_entry,
         | 
| 322 | 
            +
                      ),
         | 
| 323 | 
            +
                    ].flatten.compact
         | 
| 324 | 
            +
                  end
         | 
| 325 | 
            +
             | 
| 326 | 
            +
                  def rails_gemfile_entry
         | 
| 327 | 
            +
                    if options[:skip_gemspec]
         | 
| 328 | 
            +
                      super
         | 
| 329 | 
            +
                    elsif rails_prerelease?
         | 
| 330 | 
            +
                      super.dup.tap do |entry|
         | 
| 331 | 
            +
                        entry.comment = <<~COMMENT
         | 
| 332 | 
            +
                          Your gem is dependent on a prerelease version of Rails. Once you can lock this
         | 
| 333 | 
            +
                          dependency down to a specific version, move it to your gemspec.
         | 
| 334 | 
            +
                        COMMENT
         | 
| 335 | 
            +
                      end
         | 
| 336 | 
            +
                    end
         | 
| 337 | 
            +
                  end
         | 
| 338 | 
            +
             | 
| 339 | 
            +
                  def simplify_gemfile_entries(*gemfile_entries)
         | 
| 340 | 
            +
                    gemfile_entries.flatten.compact.map { |entry| GemfileEntry.floats(entry.name) }
         | 
| 341 | 
            +
                  end
         | 
| 342 | 
            +
             | 
| 312 343 | 
             
                  def create_dummy_app(path = nil)
         | 
| 313 344 | 
             
                    dummy_path(path) if path
         | 
| 314 345 |  | 
| @@ -1,32 +1,19 @@ | |
| 1 1 | 
             
            source "https://rubygems.org"
         | 
| 2 2 | 
             
            git_source(:github) { |repo| "https://github.com/#{repo}.git" }
         | 
| 3 | 
            +
            <% unless options[:skip_gemspec] -%>
         | 
| 3 4 |  | 
| 4 | 
            -
            <% if options[:skip_gemspec] -%>
         | 
| 5 | 
            -
            <%= "# " if rails_prerelease? -%>gem "rails", "<%= Array(rails_version_specifier).join("', '") %>"
         | 
| 6 | 
            -
            <% else -%>
         | 
| 7 5 | 
             
            # Specify your gem's dependencies in <%= name %>.gemspec.
         | 
| 8 6 | 
             
            gemspec
         | 
| 9 7 | 
             
            <% end -%>
         | 
| 10 | 
            -
            <%  | 
| 11 | 
            -
             | 
| 12 | 
            -
            group :development do
         | 
| 13 | 
            -
              gem "<%= gem_for_database[0] %>"
         | 
| 14 | 
            -
            end
         | 
| 15 | 
            -
            <% end -%>
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            <% if rails_prerelease? -%>
         | 
| 18 | 
            -
            # Your gem is dependent on a prerelease version of Rails. Once you can lock this
         | 
| 19 | 
            -
            # dependency down to a specific version, move it to your gemspec.
         | 
| 20 | 
            -
            <% gemfile_entries.each do |gemfile_entry| -%>
         | 
| 8 | 
            +
            <% gemfile_entries.each do |gemfile_entry| %>
         | 
| 21 9 | 
             
            <%= gemfile_entry %>
         | 
| 22 | 
            -
            <% end -%>
         | 
| 23 | 
            -
             | 
| 24 10 | 
             
            <% end -%>
         | 
| 25 11 | 
             
            <% if RUBY_ENGINE == "ruby" -%>
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            #  | 
| 12 | 
            +
             | 
| 13 | 
            +
            # Start debugger with binding.b [https://github.com/ruby/debug]
         | 
| 14 | 
            +
            # gem "debug", ">= 1.0.0"
         | 
| 28 15 | 
             
            <% end -%>
         | 
| 29 | 
            -
            <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%>
         | 
| 16 | 
            +
            <% if RUBY_PLATFORM.match?(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%>
         | 
| 30 17 |  | 
| 31 | 
            -
            gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby]
         | 
| 18 | 
            +
            gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
         | 
| 32 19 | 
             
            <% end -%>
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            namespace :app do
         | 
| 4 4 | 
             
              desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
         | 
| 5 | 
            -
              task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
         | 
| 5 | 
            +
              task update: [ "update:configs", "update:bin", "update:db", "update:active_storage", "update:upgrade_guide_info" ]
         | 
| 6 6 |  | 
| 7 7 | 
             
              desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
         | 
| 8 8 | 
             
              task template: :environment do
         | 
| @@ -51,6 +51,10 @@ namespace :app do | |
| 51 51 | 
             
                  Rails::AppUpdater.invoke_from_app_generator :update_bin_files
         | 
| 52 52 | 
             
                end
         | 
| 53 53 |  | 
| 54 | 
            +
                task :db do
         | 
| 55 | 
            +
                  Rails::AppUpdater.invoke_from_app_generator :update_db_schema
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 54 58 | 
             
                task :active_storage do
         | 
| 55 59 | 
             
                  Rails::AppUpdater.invoke_from_app_generator :update_active_storage
         | 
| 56 60 | 
             
                end
         | 
| @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            <!DOCTYPE html>
         | 
| 3 3 | 
             
            <html>
         | 
| 4 4 | 
             
            <head>
         | 
| 5 | 
            -
              <title>Ruby on Rails | 
| 5 | 
            +
              <title>Ruby on Rails <%= Rails.version %></title>
         | 
| 6 6 | 
             
              <meta charset="utf-8">
         | 
| 7 7 | 
             
              <meta name="viewport" content="width=device-width">
         | 
| 8 8 | 
             
              <link rel="icon" href="<%= ruby_on_rails_logo_favicon_data_uri %>" />
         | 
| @@ -60,6 +60,7 @@ | |
| 60 60 | 
             
                  height: auto;
         | 
| 61 61 | 
             
                  max-width: 100%;
         | 
| 62 62 | 
             
                  width: 100%;
         | 
| 63 | 
            +
                  cursor: pointer;
         | 
| 63 64 | 
             
                }
         | 
| 64 65 |  | 
| 65 66 | 
             
                ul {
         | 
    
        data/lib/rails.rb
    CHANGED
    
    | @@ -12,7 +12,6 @@ require "active_support/core_ext/object/blank" | |
| 12 12 |  | 
| 13 13 | 
             
            require "rails/application"
         | 
| 14 14 | 
             
            require "rails/version"
         | 
| 15 | 
            -
            require "rails/autoloaders"
         | 
| 16 15 |  | 
| 17 16 | 
             
            require "active_support/railtie"
         | 
| 18 17 | 
             
            require "action_dispatch/railtie"
         | 
| @@ -115,7 +114,7 @@ module Rails | |
| 115 114 | 
             
                end
         | 
| 116 115 |  | 
| 117 116 | 
             
                def autoloaders
         | 
| 118 | 
            -
                   | 
| 117 | 
            +
                  application.autoloaders
         | 
| 119 118 | 
             
                end
         | 
| 120 119 | 
             
              end
         | 
| 121 120 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: railties
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 7.0. | 
| 4 | 
            +
              version: 7.0.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Heinemeier Hansson
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-02-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -16,28 +16,28 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - '='
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 7.0. | 
| 19 | 
            +
                    version: 7.0.2.2
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - '='
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 7.0. | 
| 26 | 
            +
                    version: 7.0.2.2
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: actionpack
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - '='
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 7.0. | 
| 33 | 
            +
                    version: 7.0.2.2
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - '='
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 7.0. | 
| 40 | 
            +
                    version: 7.0.2.2
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: rake
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -100,14 +100,14 @@ dependencies: | |
| 100 100 | 
             
                requirements:
         | 
| 101 101 | 
             
                - - '='
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: 7.0. | 
| 103 | 
            +
                    version: 7.0.2.2
         | 
| 104 104 | 
             
              type: :development
         | 
| 105 105 | 
             
              prerelease: false
         | 
| 106 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 107 | 
             
                requirements:
         | 
| 108 108 | 
             
                - - '='
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: 7.0. | 
| 110 | 
            +
                    version: 7.0.2.2
         | 
| 111 111 | 
             
            description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
         | 
| 112 112 | 
             
            email: david@loudthinking.com
         | 
| 113 113 | 
             
            executables:
         | 
| @@ -422,12 +422,12 @@ licenses: | |
| 422 422 | 
             
            - MIT
         | 
| 423 423 | 
             
            metadata:
         | 
| 424 424 | 
             
              bug_tracker_uri: https://github.com/rails/rails/issues
         | 
| 425 | 
            -
              changelog_uri: https://github.com/rails/rails/blob/v7.0. | 
| 426 | 
            -
              documentation_uri: https://api.rubyonrails.org/v7.0. | 
| 425 | 
            +
              changelog_uri: https://github.com/rails/rails/blob/v7.0.2.2/railties/CHANGELOG.md
         | 
| 426 | 
            +
              documentation_uri: https://api.rubyonrails.org/v7.0.2.2/
         | 
| 427 427 | 
             
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         | 
| 428 | 
            -
              source_code_uri: https://github.com/rails/rails/tree/v7.0. | 
| 428 | 
            +
              source_code_uri: https://github.com/rails/rails/tree/v7.0.2.2/railties
         | 
| 429 429 | 
             
              rubygems_mfa_required: 'true'
         | 
| 430 | 
            -
            post_install_message: | 
| 430 | 
            +
            post_install_message:
         | 
| 431 431 | 
             
            rdoc_options:
         | 
| 432 432 | 
             
            - "--exclude"
         | 
| 433 433 | 
             
            - "."
         | 
| @@ -444,8 +444,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 444 444 | 
             
                - !ruby/object:Gem::Version
         | 
| 445 445 | 
             
                  version: '0'
         | 
| 446 446 | 
             
            requirements: []
         | 
| 447 | 
            -
            rubygems_version: 3.2. | 
| 448 | 
            -
            signing_key: | 
| 447 | 
            +
            rubygems_version: 3.2.22
         | 
| 448 | 
            +
            signing_key:
         | 
| 449 449 | 
             
            specification_version: 4
         | 
| 450 450 | 
             
            summary: Tools for creating, working with, and running Rails applications.
         | 
| 451 451 | 
             
            test_files: []
         |