From 573680f2f2563c8461e1c8f42a08db9fe50d54a9 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Mon, 30 Dec 2019 16:20:52 +0800 Subject: [PATCH 01/14] WIP - updated version and readme --- README.md | 4 +++- lib/apartment/version.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6713baaa..65f85886 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![Code Climate](https://codeclimate.com/github/influitive/apartment/badges/gpa.svg)](https://codeclimate.com/github/influitive/apartment) [![Build Status](https://travis-ci.org/influitive/apartment.svg?branch=development)](https://travis-ci.org/influitive/apartment) +# NOT ACTIVELY MAINTAINED YET. SOLELY FOR TESTING PURPOSES ATM + *Multitenancy for Rails and ActiveRecord* Apartment provides tools to help you deal with multiple tenants in your Rails @@ -484,7 +486,7 @@ Note that you can disable the default migrating of all tenants with `db:migrate` Apartment supports parallelizing migrations into multiple threads when you have a large number of tenants. By default, parallel migrations is -turned off. You can enable this by setting `parallel_migration_threads` to +turned off. You can enable this by setting `parallel_migration_threads` to the number of threads you want to use in your initializer. Keep in mind that because migrations are going to access the database, diff --git a/lib/apartment/version.rb b/lib/apartment/version.rb index 40b2f751..6e77c0db 100644 --- a/lib/apartment/version.rb +++ b/lib/apartment/version.rb @@ -1,3 +1,3 @@ module Apartment - VERSION = "2.2.1" + VERSION = "2.3.0.alpha" end From bcecb0d40a3fb16ab6a2a24daab39210c5eec820 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Mon, 30 Dec 2019 16:30:14 +0800 Subject: [PATCH 02/14] WIP - renamed gem to avoid conflict --- apartment.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apartment.gemspec b/apartment.gemspec index eb59070f..ea5692ea 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -3,7 +3,7 @@ $: << File.expand_path("../lib", __FILE__) require "apartment/version" Gem::Specification.new do |s| - s.name = %q{apartment} + s.name = %q{perx-apartment} s.version = Apartment::VERSION s.authors = ["Ryan Brunner", "Brad Robertson"] From c324e004a690a7dc8aec12a0cfbf513a46708155 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Mon, 30 Dec 2019 16:50:18 +0800 Subject: [PATCH 03/14] WIP - updated source --- apartment.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apartment.gemspec b/apartment.gemspec index ea5692ea..3884af3c 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = ["lib"] - s.homepage = %q{https://github.com/influitive/apartment} + s.homepage = %q{https://github.com/rails-on-services/apartment} s.licenses = ["MIT"] # must be >= 3.1.2 due to bug in prepared_statements From 349493daa763694d1f273263510f635b425ba96a Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Mon, 30 Dec 2019 16:52:22 +0800 Subject: [PATCH 04/14] WIP - updated version --- lib/apartment/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apartment/version.rb b/lib/apartment/version.rb index 6e77c0db..469c4614 100644 --- a/lib/apartment/version.rb +++ b/lib/apartment/version.rb @@ -1,3 +1,3 @@ module Apartment - VERSION = "2.3.0.alpha" + VERSION = "2.3.0.alpha1" end From ce5dca5f4d8054f18849f6899a98c8dc4a068388 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 10:25:46 +0800 Subject: [PATCH 05/14] [Hotfix] small change to trigger build --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6c13b34a..bdbf6fe1 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'http://rubygems.org' gemspec -gem 'rails', '>= 3.1.2' +gem 'rails', '>= 3.1.2' group :local do gem 'pry' From 7f0f07acef05f8c57b7f0098783a32acca2b611c Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 10:40:22 +0800 Subject: [PATCH 06/14] [Hotfix] Fixed travis ci config --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78067b58..0f7f9deb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,8 @@ gemfile: - gemfiles/rails_master.gemfile bundler_args: --without local before_install: - - sudo /etc/init.d/mysql stop - - sudo /etc/init.d/postgresql stop + - /etc/init.d/mysql stop + - /etc/init.d/postgresql stop - docker-compose up -d - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - gem uninstall bundler -v '>= 2' -x || true @@ -29,7 +29,7 @@ before_install: env: RUBY_GC_MALLOC_LIMIT: 90000000 RUBY_GC_HEAP_FREE_SLOTS: 200000 -matrix: +jobs: allow_failures: - rvm: ruby-head - gemfile: gemfiles/rails_master.gemfile @@ -46,7 +46,7 @@ matrix: gemfile: gemfiles/rails_6_0.gemfile - rvm: 2.1.9 gemfile: gemfiles/rails_master.gemfile - - rvm: 2.2.9 + - rvm: 2.2.9 gemfile: gemfiles/rails_6_0.gemfile - rvm: 2.3.6 gemfile: gemfiles/rails_6_0.gemfile From df526ec9d7c0bbb5c9323bd5890a23aa9064fe25 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 10:46:00 +0800 Subject: [PATCH 07/14] WIP - fixed travis ci config --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f7f9deb..a99d3608 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ -sudo: required +os: linux + language: ruby services: - docker @@ -20,8 +21,8 @@ gemfile: - gemfiles/rails_master.gemfile bundler_args: --without local before_install: - - /etc/init.d/mysql stop - - /etc/init.d/postgresql stop + - sudo /etc/init.d/mysql stop + - sudo /etc/init.d/postgresql stop - docker-compose up -d - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - gem uninstall bundler -v '>= 2' -x || true From 00083424e94f9cade8c584ee13e4781b4470985a Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 11:15:39 +0800 Subject: [PATCH 08/14] WIP - update travis config to use jruby 2.3 support on their latest release --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a99d3608..cefc8560 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: ruby services: - docker rvm: - - jruby-9.1.15.0 + - jruby-9.1.17.0 - 2.1.9 - 2.2.9 - 2.3.6 @@ -34,7 +34,7 @@ jobs: allow_failures: - rvm: ruby-head - gemfile: gemfiles/rails_master.gemfile - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.1.17.0 gemfile: gemfiles/rails_5_0.gemfile exclude: - rvm: 2.1.9 @@ -53,13 +53,13 @@ jobs: gemfile: gemfiles/rails_6_0.gemfile - rvm: 2.4.3 gemfile: gemfiles/rails_6_0.gemfile - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.1.17.0 gemfile: gemfiles/rails_5_1.gemfile - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.1.17.0 gemfile: gemfiles/rails_5_2.gemfile - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.1.17.0 gemfile: gemfiles/rails_6_0.gemfile - - rvm: jruby-9.1.15.0 + - rvm: jruby-9.1.17.0 gemfile: gemfiles/rails_master.gemfile fast_finish: true cache: bundler From 10f5c7b259b46697df3dcb025b774377544e3e03 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 11:28:52 +0800 Subject: [PATCH 09/14] WIP - updated gem name and version to match the possible future maintainer --- apartment.gemspec | 2 +- lib/apartment/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apartment.gemspec b/apartment.gemspec index 3884af3c..f9938de3 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -3,7 +3,7 @@ $: << File.expand_path("../lib", __FILE__) require "apartment/version" Gem::Specification.new do |s| - s.name = %q{perx-apartment} + s.name = %q{ros-apartment} s.version = Apartment::VERSION s.authors = ["Ryan Brunner", "Brad Robertson"] diff --git a/lib/apartment/version.rb b/lib/apartment/version.rb index 469c4614..5e87051d 100644 --- a/lib/apartment/version.rb +++ b/lib/apartment/version.rb @@ -1,3 +1,3 @@ module Apartment - VERSION = "2.3.0.alpha1" + VERSION = "2.3.0.alpha2" end From 40d035ebda23eb1428d757f26b45e52d2771c6b4 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 12:23:34 +0800 Subject: [PATCH 10/14] WIP - passing activerecord schema migration to migration context --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index df67edc6..2929ecb4 100644 --- a/Rakefile +++ b/Rakefile @@ -123,6 +123,8 @@ def migrate if activerecord_below_5_2? ActiveRecord::Migrator.migrate('spec/dummy/db/migrate') else - ActiveRecord::MigrationContext.new('spec/dummy/db/migrate').migrate + # TODO: Figure out if there is any other possibility that can/should be + # passed here as the second argument for the migration context + ActiveRecord::MigrationContext.new('spec/dummy/db/migrate', ActiveRecord::SchemaMigration).migrate end end From aaa49cade19ef1a8e0a22e9dabbf81ba6e8243bc Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Thu, 2 Jan 2020 13:23:07 +0800 Subject: [PATCH 11/14] WIP - added check for rails 6 --- Rakefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Rakefile b/Rakefile index 2929ecb4..8eaec6d0 100644 --- a/Rakefile +++ b/Rakefile @@ -119,9 +119,15 @@ def activerecord_below_5_2? ActiveRecord.version.release < Gem::Version.new('5.2.0') end +def activerecord_below_6_0? + ActiveRecord.version.release < Gem::Version.new('6.0.0') +end + def migrate if activerecord_below_5_2? ActiveRecord::Migrator.migrate('spec/dummy/db/migrate') + elsif activerecord_below_6_0? + ActiveRecord::MigrationContext.new('spec/dummy/db/migrate').migrate else # TODO: Figure out if there is any other possibility that can/should be # passed here as the second argument for the migration context From d1a8387be97c497d1f0e32c190a0e38e73abdb63 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Fri, 3 Jan 2020 14:55:26 +0800 Subject: [PATCH 12/14] WIP - cleanup rubocop --- apartment.gemspec | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/apartment.gemspec b/apartment.gemspec index f9938de3..cea75a95 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -1,42 +1,44 @@ -# -*- encoding: utf-8 -*- -$: << File.expand_path("../lib", __FILE__) -require "apartment/version" +# frozen_string_literal: true + +$LOAD_PATH << File.expand_path('lib', __dir__) +require 'apartment/version' Gem::Specification.new do |s| - s.name = %q{ros-apartment} + s.name = 'ros-apartment' s.version = Apartment::VERSION - s.authors = ["Ryan Brunner", "Brad Robertson"] - s.summary = %q{A Ruby gem for managing database multitenancy} - s.description = %q{Apartment allows Rack applications to deal with database multitenancy through ActiveRecord} - s.email = ["ryan@influitive.com", "brad@influitive.com"] + s.authors = ['Ryan Brunner', 'Brad Robertson', 'Rui Baltazar'] + s.summary = 'A Ruby gem for managing database multitenancy. Apartment Gem drop in replacement' + s.description = 'Apartment allows Rack applications to deal with database multitenancy through ActiveRecord' + s.email = ['ryan@influitive.com', 'brad@influitive.com', 'rui.p.baltazar@gmail.com'] s.files = `git ls-files`.split($/) - s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) - s.require_paths = ["lib"] + s.require_paths = ['lib'] - s.homepage = %q{https://github.com/rails-on-services/apartment} - s.licenses = ["MIT"] + s.homepage = 'https://github.com/rails-on-services/apartment' + s.licenses = ['MIT'] # must be >= 3.1.2 due to bug in prepared_statements s.add_dependency 'activerecord', '>= 3.1.2', '< 6.1' - s.add_dependency 'rack', '>= 1.3.6' - s.add_dependency 'public_suffix', '>= 2' s.add_dependency 'parallel', '>= 0.7.1' + s.add_dependency 'public_suffix', '>= 2' + s.add_dependency 'rack', '>= 1.3.6' s.add_development_dependency 'appraisal' + s.add_development_dependency 'bundler', '>= 1.3', '< 2.0' + s.add_development_dependency 'capybara', '~> 2.0' + s.add_development_dependency 'perx-rubocop', '~> 0.0' s.add_development_dependency 'rake', '~> 0.9' s.add_development_dependency 'rspec', '~> 3.4' s.add_development_dependency 'rspec-rails', '~> 3.4' - s.add_development_dependency 'capybara', '~> 2.0' - s.add_development_dependency 'bundler', '>= 1.3', '< 2.0' if defined?(JRUBY_VERSION) s.add_development_dependency 'activerecord-jdbc-adapter' - s.add_development_dependency 'activerecord-jdbcpostgresql-adapter' s.add_development_dependency 'activerecord-jdbcmysql-adapter' - s.add_development_dependency 'jdbc-postgres' + s.add_development_dependency 'activerecord-jdbcpostgresql-adapter' s.add_development_dependency 'jdbc-mysql' + s.add_development_dependency 'jdbc-postgres' s.add_development_dependency 'jruby-openssl' else s.add_development_dependency 'mysql2' From 750166b772a31f971804a252f6bd583a91f0111e Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Fri, 3 Jan 2020 15:30:46 +0800 Subject: [PATCH 13/14] WIP - updated gemspec --- apartment.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apartment.gemspec b/apartment.gemspec index cea75a95..0b51d8a7 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |s| s.add_dependency 'rack', '>= 1.3.6' s.add_development_dependency 'appraisal' - s.add_development_dependency 'bundler', '>= 1.3', '< 2.0' + s.add_development_dependency 'bundler', '~> 2.0' s.add_development_dependency 'capybara', '~> 2.0' s.add_development_dependency 'perx-rubocop', '~> 0.0' s.add_development_dependency 'rake', '~> 0.9' From 78678183733caae79ab9a58f77d2a632cfdf4572 Mon Sep 17 00:00:00 2001 From: Rui Baltazar Date: Fri, 3 Jan 2020 15:43:15 +0800 Subject: [PATCH 14/14] WIP - revert back unecessary changes --- README.md | 2 -- apartment.gemspec | 38 ++++++++++++++++++-------------------- lib/apartment/version.rb | 2 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 65f85886..bcb4734d 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ [![Code Climate](https://codeclimate.com/github/influitive/apartment/badges/gpa.svg)](https://codeclimate.com/github/influitive/apartment) [![Build Status](https://travis-ci.org/influitive/apartment.svg?branch=development)](https://travis-ci.org/influitive/apartment) -# NOT ACTIVELY MAINTAINED YET. SOLELY FOR TESTING PURPOSES ATM - *Multitenancy for Rails and ActiveRecord* Apartment provides tools to help you deal with multiple tenants in your Rails diff --git a/apartment.gemspec b/apartment.gemspec index 0b51d8a7..eb59070f 100644 --- a/apartment.gemspec +++ b/apartment.gemspec @@ -1,44 +1,42 @@ -# frozen_string_literal: true - -$LOAD_PATH << File.expand_path('lib', __dir__) -require 'apartment/version' +# -*- encoding: utf-8 -*- +$: << File.expand_path("../lib", __FILE__) +require "apartment/version" Gem::Specification.new do |s| - s.name = 'ros-apartment' + s.name = %q{apartment} s.version = Apartment::VERSION - s.authors = ['Ryan Brunner', 'Brad Robertson', 'Rui Baltazar'] - s.summary = 'A Ruby gem for managing database multitenancy. Apartment Gem drop in replacement' - s.description = 'Apartment allows Rack applications to deal with database multitenancy through ActiveRecord' - s.email = ['ryan@influitive.com', 'brad@influitive.com', 'rui.p.baltazar@gmail.com'] + s.authors = ["Ryan Brunner", "Brad Robertson"] + s.summary = %q{A Ruby gem for managing database multitenancy} + s.description = %q{Apartment allows Rack applications to deal with database multitenancy through ActiveRecord} + s.email = ["ryan@influitive.com", "brad@influitive.com"] s.files = `git ls-files`.split($/) - s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) } + s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) - s.require_paths = ['lib'] + s.require_paths = ["lib"] - s.homepage = 'https://github.com/rails-on-services/apartment' - s.licenses = ['MIT'] + s.homepage = %q{https://github.com/influitive/apartment} + s.licenses = ["MIT"] # must be >= 3.1.2 due to bug in prepared_statements s.add_dependency 'activerecord', '>= 3.1.2', '< 6.1' - s.add_dependency 'parallel', '>= 0.7.1' - s.add_dependency 'public_suffix', '>= 2' s.add_dependency 'rack', '>= 1.3.6' + s.add_dependency 'public_suffix', '>= 2' + s.add_dependency 'parallel', '>= 0.7.1' s.add_development_dependency 'appraisal' - s.add_development_dependency 'bundler', '~> 2.0' - s.add_development_dependency 'capybara', '~> 2.0' - s.add_development_dependency 'perx-rubocop', '~> 0.0' s.add_development_dependency 'rake', '~> 0.9' s.add_development_dependency 'rspec', '~> 3.4' s.add_development_dependency 'rspec-rails', '~> 3.4' + s.add_development_dependency 'capybara', '~> 2.0' + s.add_development_dependency 'bundler', '>= 1.3', '< 2.0' if defined?(JRUBY_VERSION) s.add_development_dependency 'activerecord-jdbc-adapter' - s.add_development_dependency 'activerecord-jdbcmysql-adapter' s.add_development_dependency 'activerecord-jdbcpostgresql-adapter' - s.add_development_dependency 'jdbc-mysql' + s.add_development_dependency 'activerecord-jdbcmysql-adapter' s.add_development_dependency 'jdbc-postgres' + s.add_development_dependency 'jdbc-mysql' s.add_development_dependency 'jruby-openssl' else s.add_development_dependency 'mysql2' diff --git a/lib/apartment/version.rb b/lib/apartment/version.rb index 5e87051d..40b2f751 100644 --- a/lib/apartment/version.rb +++ b/lib/apartment/version.rb @@ -1,3 +1,3 @@ module Apartment - VERSION = "2.3.0.alpha2" + VERSION = "2.2.1" end