Project

General

Profile

Feature #36320 » 0001-Upgrade-to-Rails-7.patch

Takashi Kato, 2022-04-10 15:35

View differences:

Gemfile
1 1
source 'https://rubygems.org'
2 2

  
3
ruby '>= 2.5.0', '< 3.2.0'
3
ruby '>= 2.7.0', '< 3.2.0'
4 4
gem 'bundler', '>= 1.12.0'
5 5

  
6
gem 'rails', '6.1.5'
7
gem 'globalid', '~> 0.4.2' if Gem.ruby_version < Gem::Version.new('2.6.0')
6
gem 'rails', '7.0.2.3'
8 7
gem 'rouge', '~> 3.28.0'
9 8
gem 'request_store', '~> 1.5.0'
10 9
gem 'mini_mime', '~> 1.1.0'
11
gem "actionpack-xml_parser"
12
gem 'roadie-rails', (Gem.ruby_version < Gem::Version.new('2.6.0') ? '~> 2.2.0' : '~> 3.0.0')
10
gem "actionpack-xml_parser", '2.0.1'
11
gem 'roadie-rails', '~> 3.0.0'
13 12
gem 'marcel'
14 13
gem "mail", "~> 2.7.1"
15 14
gem 'csv', '~> 3.2.0'
16
gem 'nokogiri', (Gem.ruby_version < Gem::Version.new('2.6.0') ? '~> 1.12.2' : '~> 1.13.0')
15
gem 'nokogiri', '~> 1.13.0'
17 16
gem 'i18n', '~> 1.10.0'
18 17
gem "rbpdf", "~> 1.20.0"
19 18
gem 'addressable'
......
47 46
# Optional CommonMark support, not for JRuby
48 47
group :common_mark do
49 48
  gem "html-pipeline", "~> 2.13.2"
50
  gem "commonmarker", (Gem.ruby_version < Gem::Version.new('2.6.0') ? '0.21.0' : '0.23.1')
49
  gem "commonmarker", '0.23.1'
51 50
  gem "sanitize", "~> 6.0"
52 51
  gem 'deckar01-task_list', '2.3.2'
53 52
end
......
96 95
  gem "ffi", platforms: [:mingw, :x64_mingw, :mswin]
97 96
  # For running system tests
98 97
  gem 'puma'
99
  gem 'capybara', (Gem.ruby_version < Gem::Version.new('2.6.0') ? '~> 3.35.3' : '~> 3.36.0')
100
  gem "selenium-webdriver", "~> 3.142.7"
101
  gem 'webdrivers', '4.6.1', require: false
98
  gem 'capybara', '~> 3.36.0'
99
  gem "selenium-webdriver", "~> 4.1.0"
100
  gem 'webdrivers', '~> 5.0.0', require: false
102 101
  # RuboCop
103 102
  gem 'rubocop', '~> 1.27.0'
104 103
  gem 'rubocop-performance', '~> 1.13.0'
config/application.rb
23 23
    # Application configuration should go into files in config/initializers
24 24
    # -- all .rb files in that directory are automatically loaded.
25 25

  
26
    # Custom directories with classes and modules you want to be autoloadable.
27
    config.autoloader = :zeitwerk
28

  
29 26
    # Only load the plugins named here, in the order given (default is alphabetical).
30 27
    # :all can be used as a placeholder for all plugins not explicitly named.
31 28
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config/initializers/10-patches.rb
47 47
      end
48 48
    end
49 49
  end
50

  
51
  class Resolver
52
    def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
53
      locals = locals.map(&:to_s).sort!.freeze
54

  
55
      cached(key, [name, prefix, partial], details, locals) do
56
        if (details[:formats] & [:xml, :json]).any?
57
          details = details.dup
58
          details[:formats] = details[:formats].dup + [:api]
59
        end
60
        _find_all(name, prefix, partial, details, key, locals)
61
      end
62
    end
63
  end
64 50
end
65 51

  
66 52
ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| html_tag || ''.html_safe }
......
144 130
  end
145 131
end
146 132

  
133
module ActionView
134
  LookupContext.prepend(Module.new do
135
    def formats=(values)
136
      if (Array(values) & [:xml, :json]).any?
137
        values << :api
138
      end
139
      super values
140
    end
141
  end)
142

  
143
  Rendering.prepend(Module.new do
144
    def rendered_format
145
      if lookup_context.formats.first == :api
146
        return request.format
147
      end
148

  
149
      super
150
    end
151
  end)
152

  
153
  class Template
154
    Types.singleton_class.prepend(Module.new do
155
      def symbols
156
        super + [:api]
157
      end
158
    end)
159
  end
160
end
161

  
147 162
# Adds asset_id parameters to assets like Rails 3 to invalidate caches in browser
148 163
module ActionView
149 164
  module Helpers
test/application_system_test_case.rb
34 34
  options = {}
35 35
  # Allow running tests using a remote Selenium hub
36 36
  options[:url] = ENV['SELENIUM_REMOTE_URL'] if ENV['SELENIUM_REMOTE_URL']
37
  options[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome(
37
  options[:capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome(
38 38
                  'goog:chromeOptions' => {
39 39
                    'args' => GOOGLE_CHROME_OPTS_ARGS,
40 40
                    'prefs' => {
(1-1/8)