Skip to content
Snippets Groups Projects
Commit 01c45f19 authored by Praveen Arimbrathodiyil's avatar Praveen Arimbrathodiyil
Browse files

Replace rails 5.2 patch with rails 5.1 patch from upstream

parent 31dc6eda
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
From d2b436376c92a86859c19d66eb395c2ef2ac977b Mon Sep 17 00:00:00 2001
From: Jan Provaznik <jprovaznik@gitlab.com>
Date: Mon, 17 Dec 2018 11:31:36 +0100
Subject: [PATCH 1/6] Upgrade to rails 5.2
---
Gemfile | 6 +-
Gemfile.lock | 111 +++++++++---------
.../active_record_verbose_query_logs.rb | 56 ---------
3 files changed, 61 insertions(+), 112 deletions(-)
delete mode 100644 config/initializers/active_record_verbose_query_logs.rb
--- a/Gemfile
+++ b/Gemfile
@@ -20,7 +20,7 @@
gem 'pg', '~> 1.1' if ENV["DB"] == "all" || ENV["DB"] == "postgres"
gem 'rugged', '~> 0.27'
-gem 'grape-path-helpers', '~> 1.0'
+gem 'grape-path-helpers', '~> 1.1'
gem 'faraday', '~> 0.12'
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -52,7 +52,7 @@
public_suffix (>= 2.0.2, < 4.0)
aes_key_wrap (1.0.1)
akismet (2.0.0)
- arel (7.1.4)
+ arel (9.0.0)
asana (0.8.1)
faraday (~> 0.9)
faraday_middleware (~> 0.9)
@@ -184,7 +184,6 @@
encryptor (3.0.0)
equalizer (0.0.11)
erubi (1.7.1)
- erubis (2.7.0)
escape_utils (1.2.1)
et-orbi (1.1.7)
tzinfo
@@ -254,8 +253,8 @@
fog-xml (0.1.3)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
- font-awesome-rails (4.7.0.1)
- railties (>= 3.2, < 5.1)
+ font-awesome-rails (4.7.0.4)
+ railties (>= 3.2, < 6.0)
foreman (0.84.0)
thor (~> 0.19.1)
formatador (0.2.5)
@@ -330,8 +329,8 @@
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
- grape-path-helpers (1.0.6)
- activesupport (>= 4, < 5.1)
+ grape-path-helpers (1.1.0)
+ activesupport
grape (~> 1.0)
rake (~> 12)
grape_logging (1.7.0)
@@ -934,7 +933,7 @@
hashdiff
webpack-rails (0.9.11)
railties (>= 3.2.0)
- websocket-driver (0.6.5)
+ websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
wikicloth (0.8.1)
@@ -1033,7 +1032,7 @@
gpgme (~> 2.0.18)
grape (~> 1.1.0)
grape-entity (~> 0.7.1)
- grape-path-helpers (~> 1.0)
+ grape-path-helpers (~> 1.1)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.8.0)
--- a/config/initializers/active_record_verbose_query_logs.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# frozen_string_literal: true
-
-# This is backport of https://github.com/rails/rails/pull/26815/files
-# Enabled by default for every non-production environment
-
-module ActiveRecord
- class LogSubscriber
- module VerboseQueryLogs
- def debug(progname = nil, &block)
- return unless super
-
- log_query_source
- end
-
- def log_query_source
- source_line, line_number = extract_callstack(caller_locations)
-
- if source_line
- if defined?(::Rails.root)
- app_root = "#{::Rails.root}/".freeze
- source_line = source_line.sub(app_root, "")
- end
-
- logger.debug(" ↳ #{source_line}:#{line_number}")
- end
- end
-
- def extract_callstack(callstack)
- line = callstack.find do |frame|
- frame.absolute_path && !ignored_callstack(frame.absolute_path)
- end
-
- offending_line = line || callstack.first
- [
- offending_line.path,
- offending_line.lineno,
- offending_line.label
- ]
- end
-
- LOG_SUBSCRIBER_FILE = ActiveRecord::LogSubscriber.method(:logger).source_location.first
- RAILS_GEM_ROOT = File.expand_path("../../../..", LOG_SUBSCRIBER_FILE) + "/"
- APP_CONFIG_ROOT = File.expand_path("..", __dir__) + "/"
-
- def ignored_callstack(path)
- path.start_with?(APP_CONFIG_ROOT, RAILS_GEM_ROOT, RbConfig::CONFIG["rubylibdir"])
- end
- end
-
- if Rails.version.start_with?("5.2")
- raise "Remove this monkey patch: #{__FILE__}"
- else
- prepend(VerboseQueryLogs) unless Rails.env.production?
- end
- end
-end
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -25,7 +25,7 @@
}.freeze
TYPE_AND_FORMAT_PAIRS = {
- archive: :zip,
+ archive: :zip_file,
metadata: :gzip,
trace: :raw,
junit: :gzip,
@@ -93,7 +93,7 @@
enum file_format: {
raw: 1,
- zip: 2,
+ zip_file: 2, # FIXME
gzip: 3
}
--- a/config/initializers/active_record_data_types.rb
+++ b/config/initializers/active_record_data_types.rb
@@ -22,7 +22,7 @@
#
# When schema dumping, `timestamptz` columns will be output as
# `t.datetime_with_timezone`.
- def initialize_type_map(mapping)
+ def initialize_type_map(mapping = type_map)
super mapping
mapping.register_type 'timestamptz' do |_, _, sql_type|
--- a/config/initializers/ar_speed_up_migration_checking.rb
+++ b/config/initializers/ar_speed_up_migration_checking.rb
@@ -1,18 +1,18 @@
-if Rails.env.test?
- require 'active_record/migration'
-
- module ActiveRecord
- class Migrator
- class << self
- alias_method :migrations_unmemoized, :migrations
-
- # This method is called a large number of times per rspec example, and
- # it reads + parses `db/migrate/*` each time. Memoizing it can save 0.5
- # seconds per spec.
- def migrations(paths)
- (@migrations ||= migrations_unmemoized(paths)).dup
- end
- end
- end
- end
-end
+#if Rails.env.test?
+# require 'active_record/migration'
+#
+# module ActiveRecord
+# class Migrator
+# class << self
+# alias_method :migrations_unmemoized, :migrations
+#
+# # This method is called a large number of times per rspec example, and
+# # it reads + parses `db/migrate/*` each time. Memoizing it can save 0.5
+# # seconds per spec.
+# def migrations(paths)
+# (@migrations ||= migrations_unmemoized(paths)).dup
+# end
+# end
+# end
+# end
+#end
--- a/config/initializers/postgresql_cte.rb
+++ b/config/initializers/postgresql_cte.rb
@@ -94,8 +94,8 @@
end
end
- def build_arel
- arel = super()
+ def build_arel(aliases)
+ arel = super(aliases)
build_with(arel) if @values[:with]
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -243,7 +243,7 @@
optional :artifact_type, type: String, desc: %q(The type of artifact),
default: 'archive', values: Ci::JobArtifact.file_types.keys
optional :artifact_format, type: String, desc: %q(The format of artifact),
- default: 'zip', values: Ci::JobArtifact.file_formats.keys
+ default: 'zip_file', values: Ci::JobArtifact.file_formats.keys
optional 'file.path', type: String, desc: %q(path to locally stored body (generated by Workhorse))
optional 'file.name', type: String, desc: %q(real filename as send in Content-Disposition (generated by Workhorse))
optional 'file.type', type: String, desc: %q(real content type as send in Content-Type (generated by Workhorse))
--- a/config/initializers/active_record_preloader.rb
+++ b/config/initializers/active_record_preloader.rb
@@ -1,15 +1,15 @@
-module ActiveRecord
- module Associations
- class Preloader
- module NoCommitPreloader
- def preloader_for(reflection, owners, rhs_klass)
- return NullPreloader if rhs_klass == ::Commit
-
- super
- end
- end
-
- prepend NoCommitPreloader
- end
- end
-end
+#module ActiveRecord
+# module Associations
+# class Preloader
+# module NoCommitPreloader
+# def preloader_for(reflection, owners, rhs_klass)
+# return NullPreloader if rhs_klass == ::Commit
+#
+# super
+# end
+# end
+#
+# prepend NoCommitPreloader
+# end
+# end
+#end
......@@ -21,7 +21,7 @@
0640-relax-ruby-version.patch
0660-fix-gitlab-yml-path.patch
0670-allow-doorkeepr-4_3.patch
0680-rails-5_2.patch
0680-rails-5_1.patch
0685-bump-fog.patch
0690-debian-usage-ping.patch
0700-add-salsa-link-to-help.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment