From b9299f2248795fddbfaf4ff3f19542fd6bb784b1 Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Wed, 4 Jul 2018 18:53:24 +0200 Subject: [PATCH 1/3] Upgrade Mongoid to 5.4 to support MongoDB 3.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As mentioned in https://github.com/errbit/errbit/issues/1253#issuecomment-358295746, older versions of Mongoid do not support MongoDB 3.6 because they still use `$pushAll`. https://jira.mongodb.org/projects/MONGOID/issues/MONGOID-4499 mentions that this has been fixed for Mongoid 6.3 and 7.0. However, Mongoid 6+ depends on Rails 5+, so this is not a simple upgrade. Fortunately, the fixes also got backported to 5.4 a bit later, see https://jira.mongodb.org/browse/MONGOID-4538 So if I got this right, upgrading Mongoid to 5.4 should allow using MongoDB 3.6. Let’s see how it goes in CI. --- .travis.yml | 1 + Gemfile | 2 +- Gemfile.lock | 23 ++++++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c1b8ae0d..43e58ac84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: matrix: - MONGODB=3.2.18 - MONGODB=3.4.10 + - MONGODB=3.6.2 sudo: false diff --git a/Gemfile b/Gemfile index acb0928ce..de9eb9fb6 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'font-awesome-rails' gem 'haml' gem 'htmlentities' gem 'kaminari', '>= 0.16.3' -gem 'mongoid', '5.0.2' +gem 'mongoid', '~> 5.4' gem 'mongoid_rails_migrations' gem 'rack-ssl', require: 'rack/ssl' # force SSL gem 'rack-ssl-enforcer', require: false diff --git a/Gemfile.lock b/Gemfile.lock index b94ed0874..64df88317 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,8 +53,8 @@ GEM rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bson (4.2.2) - bson (4.2.2-java) + bson (4.3.0) + bson (4.3.0-java) builder (3.2.3) byebug (4.0.5) columnize (= 0.9.0) @@ -156,7 +156,8 @@ GEM httparty (0.13.5) json (~> 1.8) multi_xml (>= 0.5.2) - i18n (0.8.6) + i18n (0.9.5) + concurrent-ruby (~> 1.0) jquery-rails (2.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) @@ -184,13 +185,13 @@ GEM mime-types (2.99.3) mimemagic (0.3.0) mini_portile2 (2.3.0) - minitest (5.10.3) - mongo (2.4.3) - bson (>= 4.2.1, < 5.0.0) - mongoid (5.0.2) + minitest (5.11.3) + mongo (2.6.0) + bson (>= 4.3.0, < 5.0.0) + mongoid (5.4.0) activemodel (~> 4.0) - mongo (~> 2.1) - origin (~> 2.1) + mongo (>= 2.5.1, < 3.0.0) + origin (~> 2.3) tzinfo (>= 0.3.37) mongoid-rspec (3.0.0) mongoid (~> 5.0) @@ -401,7 +402,7 @@ GEM tilt (2.0.7) timecop (0.7.4) tins (1.6.0) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) uglifier (2.7.2) execjs (>= 0.3.0) @@ -465,7 +466,7 @@ DEPENDENCIES kaminari (>= 0.16.3) launchy meta_request - mongoid (= 5.0.2) + mongoid (~> 5.4) mongoid-rspec (~> 3.0.0) mongoid_rails_migrations omniauth-github From 68f290ec399abe598845df925ad2b3fe8afc7e23 Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Wed, 4 Jul 2018 23:37:15 +0200 Subject: [PATCH 2/3] Fix error with constant lookup of `Regexp` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes “undefined method `escape' for Mongoid::Matchable::Regexp:Class”. Explanation: In Mongoid 5.2, `Mongoid::Matchable::Regexp` was added (see https://github.com/mongodb/mongoid/commit/baf9357). This moduls is included in `Mongoid::Document` (via `Mongoid::Matchable`), with the result that in Mongoid document classes you can no longer simply write `Regexp` if you want to refer to Ruby’s regexp class (because this gets resolved as `Mongoid::Matchable::Regexp` instead). --- app/models/app.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/app.rb b/app/models/app.rb index bd269b5f7..426619d65 100644 --- a/app/models/app.rb +++ b/app/models/app.rb @@ -219,7 +219,7 @@ def check_issue_tracker def normalize_github_repo return if github_repo.blank? github_host = URI.parse(Errbit::Config.github_url).host - github_host = Regexp.escape(github_host) + github_host = ::Regexp.escape(github_host) github_repo.strip! github_repo.sub!(%r{(git@|https?://)#{github_host}(/|:)}, '') github_repo.sub!(/\.git$/, '') From 1c89cd64140c2dbf6aea75e6726c4225cd3329aa Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Thu, 5 Jul 2018 12:58:39 +0200 Subject: [PATCH 3/3] Update README regarding MongoDB version compatibility --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03bc5f7e8..ab8367ef2 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ updates and notifications. The list of requirements to install Errbit are: * Ruby 2.3.x-2.4.x (>= 2.5.x not yet supported) -* MongoDB 3.2.x-3.4.x (>= 3.6.x not yet supported) +* MongoDB 3.2.x-3.6.x (>= 4.0.x not yet supported) Installation ------------