if Rails.gem_version < Gem::Version.new('7.1')
  append_to_file("Gemfile", %(gem "bigdecimal"\n))
  append_to_file("Gemfile", %(gem "logger"\n))
  append_to_file("Gemfile", %(gem "mutex_m"\n))
  append_to_file("Gemfile", %(gem "drb"\n))
  append_to_file("Gemfile", %(gem "concurrent-ruby", "< 1.3.5"\n))
end

gsub_file "Gemfile", /^  gem 'spring'$/, ' gem "spring", "!= 2.1.1"'
gsub_file "Gemfile", /^  gem "debug".*/, ''

if Rails.gem_version >= Gem::Version.new('7.1')
  append_to_file File.join("config", "application.rb"), <<~RUBY
    class TestApp::Application
      config.autoload_lib(ignore: %w(some_railtie))
    end
  RUBY

  gsub_file "config/routes.rb",  /^  get/, '  # get'
end
