apartment 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,3 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
+ bundler_args: --verbose
data/Gemfile CHANGED
@@ -1,3 +1,15 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'pry'
6
+ gem 'rails', '>= 3.1.2'
7
+ gem 'rake', '~> 0.9.2'
8
+ gem 'sqlite3'
9
+ gem 'rspec', '~> 2.11'
10
+ gem 'rspec-rails', '~> 2.11'
11
+ gem 'capybara', '~> 1.0'
12
+ gem 'pg', '>= 0.11.0'
13
+ gem 'mysql2', '~> 0.3.10'
14
+ gem 'delayed_job', '~> 3.0'
15
+ gem 'delayed_job_active_record'
data/HISTORY.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 0.20.0
2
+ * Feb 6, 2013
3
+
4
+ - Mysql now has a 'schema like' option to perform like Postgresql (default)
5
+ - This should be significantly more performant than using connections
6
+ - Psych is now supported for Delayed::Job yaml parsing
7
+
8
+ # 0.19.2
9
+ * Jan 30, 2013
10
+
11
+ - Database schema file can now be set manually or skipped altogether
12
+
13
+ # 0.19.1
14
+ * Jan 30, 2013
15
+
16
+ - Allow schema.rb import file to be specified in config or skip schema.rb import altogether
17
+
1
18
  # 0.19.0
2
19
  * Dec 29, 2012
3
20
 
data/README.md CHANGED
@@ -187,7 +187,10 @@ and test environments. If you wish to turn this option off in production, you c
187
187
  ## Delayed::Job
188
188
 
189
189
  If using Rails ~> 3.2, you *must* use `delayed_job ~> 3.0`. It has better Rails 3 support plus has some major changes that affect the serialization of models.
190
- I haven't been able to get `psych` working whatsoever as the YAML parser, so to get things to work properly, you must explicitly set the parser to `syck` *before* requiring `delayed_job`
190
+
191
+ ### If using Ruby 1.9.3-p362 you MUST use psych as your parser. YAML seems to fall down using syck
192
+
193
+ ### If you're using syck on an earlier version of ruby, here's what you must do (in a rails app for instance)
191
194
  This can be done in the `boot.rb` of your rails config *just above* where Bundler requires the gems from the Gemfile. It will look something like:
192
195
 
193
196
  require 'rubygems'
data/apartment.gemspec CHANGED
@@ -6,30 +6,18 @@ Gem::Specification.new do |s|
6
6
  s.name = %q{apartment}
7
7
  s.version = Apartment::VERSION
8
8
 
9
- s.authors = ["Ryan Brunner", "Brad Robertson"]
10
- s.summary = %q{A Ruby gem for managing database multitenancy}
11
- s.description = %q{Apartment allows Rack applications to deal with database multitenancy through ActiveRecord}
12
- s.email = %w{ryan@influitive.com brad@influitive.com}
13
- s.files = `git ls-files`.split("\n")
14
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
9
+ s.authors = ["Ryan Brunner", "Brad Robertson"]
10
+ s.summary = %q{A Ruby gem for managing database multitenancy}
11
+ s.description = %q{Apartment allows Rack applications to deal with database multitenancy through ActiveRecord}
12
+ s.email = ["ryan@influitive.com", "brad@influitive.com"]
13
+ s.files = `git ls-files`.split($/)
14
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+ s.require_paths = ["lib"]
15
17
 
16
18
  s.homepage = %q{https://github.com/influitive/apartment}
17
19
  s.licenses = ["MIT"]
18
- s.require_paths = ["lib"]
19
- s.rubygems_version = %q{1.3.7}
20
20
 
21
21
  s.add_dependency 'activerecord', '>= 3.1.2' # must be >= 3.1.2 due to bug in prepared_statements
22
22
  s.add_dependency 'rack', '>= 1.3.6'
23
-
24
- s.add_development_dependency 'pry', '~> 0.9.9'
25
- s.add_development_dependency 'rails', '>= 3.1.2'
26
- s.add_development_dependency 'rake', '~> 0.9.2'
27
- s.add_development_dependency 'sqlite3'
28
- s.add_development_dependency 'rspec', '~> 2.11'
29
- s.add_development_dependency 'rspec-rails', '~> 2.11'
30
- s.add_development_dependency 'capybara', '~> 1.0.0'
31
- s.add_development_dependency 'pg', '>= 0.11.0'
32
- s.add_development_dependency 'mysql2', '~> 0.3.10'
33
- s.add_development_dependency 'delayed_job', '~> 3.0'
34
- s.add_development_dependency 'delayed_job_active_record'
35
23
  end
data/lib/apartment.rb CHANGED
@@ -1,17 +1,20 @@
1
1
  require 'apartment/railtie' if defined?(Rails)
2
- require 'active_support/core_ext/module/delegation'
3
2
  require 'active_support/core_ext/object/blank'
3
+ require 'forwardable'
4
4
 
5
5
  module Apartment
6
6
 
7
7
  class << self
8
+
9
+ extend Forwardable
10
+
8
11
  ACCESSOR_METHODS = [:use_schemas, :seed_after_create, :prepend_environment, :append_environment]
9
- WRITER_METHODS = [:database_names, :excluded_models, :default_schema, :persistent_schemas, :connection_class]
12
+ WRITER_METHODS = [:database_names, :database_schema_file, :excluded_models, :default_schema, :persistent_schemas, :connection_class]
10
13
 
11
14
  attr_accessor(*ACCESSOR_METHODS)
12
15
  attr_writer(*WRITER_METHODS)
13
16
 
14
- delegate :connection, :establish_connection, to: :connection_class
17
+ def_delegators :connection_class, :connection, :establish_connection
15
18
 
16
19
  # configure apartment with available options
17
20
  def configure
@@ -40,9 +43,15 @@ module Apartment
40
43
  @connection_class || ActiveRecord::Base
41
44
  end
42
45
 
46
+ def database_schema_file
47
+ return @database_schema_file if defined?(@database_schema_file)
48
+
49
+ @database_schema_file = Rails.root.join('db', 'schema.rb')
50
+ end
51
+
43
52
  # Reset all the config for Apartment
44
53
  def reset
45
- (ACCESSOR_METHODS + WRITER_METHODS).each{|method| instance_variable_set(:"@#{method}", nil) }
54
+ (ACCESSOR_METHODS + WRITER_METHODS).each{|method| remove_instance_variable(:"@#{method}") if instance_variable_defined?(:"@#{method}") }
46
55
  end
47
56
 
48
57
  def use_postgres_schemas
@@ -157,7 +157,8 @@ module Apartment
157
157
  #
158
158
  def import_database_schema
159
159
  ActiveRecord::Schema.verbose = false # do not log schema load output.
160
- load_or_abort("#{Rails.root}/db/schema.rb")
160
+
161
+ load_or_abort(Apartment.database_schema_file) if Apartment.database_schema_file
161
162
  end
162
163
 
163
164
  # Return a new config that is multi-tenanted
@@ -3,7 +3,9 @@ module Apartment
3
3
  module Database
4
4
 
5
5
  def self.mysql2_adapter(config)
6
- Adapters::Mysql2Adapter.new config
6
+ Apartment.use_schemas ?
7
+ Adapters::Mysql2SchemaAdapter.new(config) :
8
+ Adapters::Mysql2Adapter.new(config)
7
9
  end
8
10
  end
9
11
 
@@ -19,12 +21,62 @@ module Apartment
19
21
  #
20
22
  # @param {String} database Database name
21
23
  #
22
- def connect_to_new(database)
24
+ def connect_to_new(database = nil)
23
25
  super
24
26
  rescue Mysql2::Error
25
27
  Apartment::Database.reset
26
28
  raise DatabaseNotFound, "Cannot find database #{environmentify(database)}"
27
29
  end
28
30
  end
31
+
32
+ class Mysql2SchemaAdapter < AbstractAdapter
33
+ attr_reader :default_database
34
+
35
+ def initialize(config)
36
+ @default_database = config[:database]
37
+
38
+ super
39
+ end
40
+
41
+ # Reset current_database to the default_database
42
+ #
43
+ def reset
44
+ connect_to_new(default_database)
45
+ end
46
+
47
+ # Set the table_name to always use the default database for excluded models
48
+ #
49
+ def process_excluded_models
50
+ Apartment.excluded_models.each{ |model| process_excluded_model(model) }
51
+ end
52
+
53
+ protected
54
+
55
+ # Set schema current_database to new db
56
+ #
57
+ def connect_to_new(database)
58
+ return reset if database.nil?
59
+
60
+ Apartment.connection.execute "use #{database}"
61
+
62
+ rescue ActiveRecord::StatementInvalid
63
+ Apartment::Database.reset
64
+ raise DatabaseNotFound, "Cannot find database #{environmentify(database)}"
65
+ end
66
+
67
+ def process_excluded_model(model)
68
+ model.constantize.tap do |klass|
69
+ # some models (such as delayed_job) seem to load and cache their column names before this,
70
+ # so would never get the default prefix, so reset first
71
+ klass.reset_column_information
72
+
73
+ # Ensure that if a schema *was* set, we override
74
+ table_name = klass.table_name.split('.', 2).last
75
+
76
+ # Not sure why, but Delayed::Job somehow ignores table_name_prefix... so we'll just manually set table name instead
77
+ klass.table_name = "#{default_database}.#{table_name}"
78
+ end
79
+ end
80
+ end
29
81
  end
30
82
  end
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/module/delegation'
1
+ require 'forwardable'
2
2
 
3
3
  module Apartment
4
4
 
@@ -7,8 +7,9 @@ module Apartment
7
7
  module Database
8
8
 
9
9
  extend self
10
+ extend Forwardable
10
11
 
11
- delegate :create, :current_database, :current, :drop, :process, :process_excluded_models, :reset, :seed, :switch, :to => :adapter
12
+ def_delegators :adapter, :create, :current_database, :current, :drop, :process, :process_excluded_models, :reset, :seed, :switch
12
13
 
13
14
  attr_writer :config
14
15
 
@@ -42,9 +43,9 @@ module Apartment
42
43
 
43
44
  # Reset config and adapter so they are regenerated
44
45
  #
45
- def reload!
46
+ def reload!(config = nil)
46
47
  Thread.current[:apartment_adapter] = nil
47
- @config = nil
48
+ @config = config
48
49
  end
49
50
 
50
51
  private
@@ -1,5 +1,11 @@
1
1
  require 'delayed_job'
2
- require 'apartment/delayed_job/active_record' # ensure that our AR hooks are loaded when queueing
2
+ require 'yaml'
3
+
4
+ if YAML.parser.class.name =~ /syck|yecht/i
5
+ require 'apartment/delayed_job/syck_ext'
6
+ else
7
+ require 'apartment/delayed_job/psych_ext'
8
+ end
3
9
 
4
10
  module Apartment
5
11
  module Delayed
@@ -0,0 +1,61 @@
1
+ if defined?(ActiveRecord)
2
+ class ActiveRecord::Base
3
+ # @override
4
+ # serialize to YAML
5
+ def encode_with(coder)
6
+ coder["attributes"] = @attributes
7
+ coder["database"] = @database unless @database.nil?
8
+ coder.tag = ['!ruby/ActiveRecord', self.class.name].join(':')
9
+ end
10
+ end
11
+ end
12
+
13
+ module Psych
14
+ module Visitors
15
+ class ToRuby
16
+ # @override
17
+ #
18
+ # NOTE I don't have a great idea what's going on here...
19
+ # The only change is the `Apartment::Database.process`
20
+ #
21
+ def visit_Psych_Nodes_Mapping_with_class_and_db(object)
22
+ return revive(Psych.load_tags[object.tag], object) if Psych.load_tags[object.tag]
23
+
24
+ case object.tag
25
+ when /^!ruby\/ActiveRecord:(.+)$/
26
+ klass = resolve_class($1)
27
+ payload = Hash[*object.children.map { |c| accept c }]
28
+ id = payload["attributes"][klass.primary_key]
29
+ begin
30
+ Apartment::Database.process(payload['database']) do
31
+ klass.unscoped.find(id)
32
+ end
33
+ rescue ActiveRecord::RecordNotFound
34
+ raise Delayed::DeserializationError
35
+ end
36
+ when /^!ruby\/Mongoid:(.+)$/
37
+ klass = resolve_class($1)
38
+ payload = Hash[*object.children.map { |c| accept c }]
39
+ begin
40
+ klass.find(payload["attributes"]["_id"])
41
+ rescue Mongoid::Errors::DocumentNotFound
42
+ raise Delayed::DeserializationError
43
+ end
44
+ when /^!ruby\/DataMapper:(.+)$/
45
+ klass = resolve_class($1)
46
+ payload = Hash[*object.children.map { |c| accept c }]
47
+ begin
48
+ primary_keys = klass.properties.select { |p| p.key? }
49
+ key_names = primary_keys.map { |p| p.name.to_s }
50
+ klass.get!(*key_names.map { |k| payload["attributes"][k] })
51
+ rescue DataMapper::ObjectNotFoundError
52
+ raise Delayed::DeserializationError
53
+ end
54
+ else
55
+ visit_Psych_Nodes_Mapping_without_class_and_db(object)
56
+ end
57
+ end
58
+ alias_method_chain :visit_Psych_Nodes_Mapping, :class_and_db
59
+ end
60
+ end
61
+ end
@@ -1,4 +1,4 @@
1
- require 'apartment/delayed_job/active_record' # ensure that our AR hooks are loaded when queueing
1
+ require 'apartment/delayed_job/enqueue'
2
2
 
3
3
  module Apartment
4
4
  module Delayed
@@ -1,3 +1,3 @@
1
1
  module Apartment
2
- VERSION = "0.19.0"
2
+ VERSION = "0.20.0"
3
3
  end
@@ -3,8 +3,8 @@ require 'apartment/adapters/mysql2_adapter'
3
3
 
4
4
  describe Apartment::Adapters::Mysql2Adapter do
5
5
 
6
- let(:config){ Apartment::Test.config['connections']['mysql'] }
7
- subject{ Apartment::Database.mysql2_adapter config.symbolize_keys }
6
+ let(:config){ Apartment::Test.config['connections']['mysql'].symbolize_keys }
7
+ subject(:adapter){ Apartment::Database.mysql2_adapter config }
8
8
 
9
9
  def database_names
10
10
  ActiveRecord::Base.connection.execute("SELECT schema_name FROM information_schema.schemata").collect{|row| row[0]}
@@ -12,6 +12,36 @@ describe Apartment::Adapters::Mysql2Adapter do
12
12
 
13
13
  let(:default_database){ subject.process{ ActiveRecord::Base.connection.current_database } }
14
14
 
15
- it_should_behave_like "a generic apartment adapter"
16
- it_should_behave_like "a db based apartment adapter"
17
- end
15
+ context "using - the equivalent of - schemas" do
16
+ before { Apartment.use_schemas = true }
17
+
18
+ it_should_behave_like "a generic apartment adapter"
19
+
20
+ describe "#default_database" do
21
+ its(:default_database){ should == config[:database] }
22
+ end
23
+
24
+ describe "#init" do
25
+ include Apartment::Spec::AdapterRequirements
26
+
27
+ before do
28
+ Apartment.configure do |config|
29
+ config.excluded_models = ["Company"]
30
+ end
31
+ end
32
+
33
+ it "should process model exclusions" do
34
+ Apartment::Database.init
35
+
36
+ Company.table_name.should == "#{default_database}.companies"
37
+ end
38
+ end
39
+ end
40
+
41
+ context "using connections" do
42
+ before { Apartment.use_schemas = false }
43
+
44
+ it_should_behave_like "a generic apartment adapter"
45
+ it_should_behave_like "a connection based apartment adapter"
46
+ end
47
+ end
@@ -3,8 +3,8 @@ require 'apartment/adapters/postgresql_adapter'
3
3
 
4
4
  describe Apartment::Adapters::PostgresqlAdapter do
5
5
 
6
- let(:config){ Apartment::Test.config['connections']['postgresql'] }
7
- subject{ Apartment::Database.postgresql_adapter config.symbolize_keys }
6
+ let(:config){ Apartment::Test.config['connections']['postgresql'].symbolize_keys }
7
+ subject{ Apartment::Database.postgresql_adapter config }
8
8
 
9
9
  context "using schemas" do
10
10
 
@@ -21,7 +21,7 @@ describe Apartment::Adapters::PostgresqlAdapter do
21
21
  it_should_behave_like "a schema based apartment adapter"
22
22
  end
23
23
 
24
- context "using databases" do
24
+ context "using connections" do
25
25
 
26
26
  before{ Apartment.use_schemas = false }
27
27
 
@@ -33,6 +33,6 @@ describe Apartment::Adapters::PostgresqlAdapter do
33
33
  let(:default_database){ subject.process{ ActiveRecord::Base.connection.current_database } }
34
34
 
35
35
  it_should_behave_like "a generic apartment adapter"
36
- it_should_behave_like "a db based apartment adapter"
36
+ it_should_behave_like "a connection based apartment adapter"
37
37
  end
38
38
  end
@@ -1,8 +1,5 @@
1
1
  require 'rubygems'
2
2
 
3
- require 'yaml'
4
- YAML::ENGINE.yamler = 'syck'
5
-
6
3
  gemfile = File.expand_path('../../../../Gemfile', __FILE__)
7
4
 
8
5
  if File.exist?(gemfile)
@@ -1,17 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
- shared_examples_for "a db based apartment adapter" do
3
+ shared_examples_for "a connection based apartment adapter" do
4
4
  include Apartment::Spec::AdapterRequirements
5
5
 
6
6
  let(:default_database){ subject.process{ ActiveRecord::Base.connection.current_database } }
7
7
 
8
8
  describe "#init" do
9
-
10
9
  it "should process model exclusions" do
11
10
  Apartment.configure do |config|
12
11
  config.excluded_models = ["Company"]
13
12
  end
14
-
15
13
  Apartment::Database.init
16
14
 
17
15
  Company.connection.object_id.should_not == ActiveRecord::Base.connection.object_id
@@ -89,6 +89,12 @@ shared_examples_for "a generic apartment adapter" do
89
89
  subject.switch
90
90
  subject.current_database.should == default_database
91
91
  end
92
+
93
+ it "should raise an error if database is invalid" do
94
+ expect {
95
+ subject.switch 'unknown_database'
96
+ }.to raise_error(Apartment::ApartmentError)
97
+ end
92
98
  end
93
99
 
94
100
  describe "#current_database" do
@@ -1,11 +1,10 @@
1
- module Apartment
1
+ require 'yaml'
2
2
 
3
+ module Apartment
3
4
  module Test
4
5
 
5
6
  def self.config
6
7
  @config ||= YAML.load_file('spec/config/database.yml')
7
8
  end
8
-
9
9
  end
10
-
11
10
  end
@@ -16,7 +16,9 @@ module Apartment
16
16
  let(:connection){ ActiveRecord::Base.connection }
17
17
 
18
18
  before do
19
+ Apartment::Database.reload!(config.symbolize_keys)
19
20
  ActiveRecord::Base.establish_connection config
21
+
20
22
  subject.create(db1)
21
23
  subject.create(db2)
22
24
  end
@@ -29,8 +31,15 @@ module Apartment
29
31
  subject.drop(db1) rescue true
30
32
  subject.drop(db2) rescue true
31
33
 
34
+ # This is annoying, but for each sublcass that establishes its own connection (ie Company for excluded models for connection based adapters)
35
+ # a separate connection is maintained (clear_all_connections! doesn't appear to deal with these)
36
+ # This causes problems because previous tests that established this connection could F up the next test, so we'll just remove them all for each test :(
37
+ Apartment.excluded_models.each do |m|
38
+ klass = m.constantize
39
+ Apartment.connection_class.remove_connection(klass)
40
+ klass.reset_table_name
41
+ end
32
42
  ActiveRecord::Base.clear_all_connections!
33
- Apartment::Database.reload!
34
43
  end
35
44
  end
36
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apartment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-30 00:00:00.000000000 Z
13
+ date: 2013-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -44,182 +44,6 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.3.6
47
- - !ruby/object:Gem::Dependency
48
- name: pry
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 0.9.9
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: 0.9.9
63
- - !ruby/object:Gem::Dependency
64
- name: rails
65
- requirement: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: 3.1.2
71
- type: :development
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: 3.1.2
79
- - !ruby/object:Gem::Dependency
80
- name: rake
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ~>
85
- - !ruby/object:Gem::Version
86
- version: 0.9.2
87
- type: :development
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ~>
93
- - !ruby/object:Gem::Version
94
- version: 0.9.2
95
- - !ruby/object:Gem::Dependency
96
- name: sqlite3
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ! '>='
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
118
- version: '2.11'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ~>
125
- - !ruby/object:Gem::Version
126
- version: '2.11'
127
- - !ruby/object:Gem::Dependency
128
- name: rspec-rails
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ~>
133
- - !ruby/object:Gem::Version
134
- version: '2.11'
135
- type: :development
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ~>
141
- - !ruby/object:Gem::Version
142
- version: '2.11'
143
- - !ruby/object:Gem::Dependency
144
- name: capybara
145
- requirement: !ruby/object:Gem::Requirement
146
- none: false
147
- requirements:
148
- - - ~>
149
- - !ruby/object:Gem::Version
150
- version: 1.0.0
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ~>
157
- - !ruby/object:Gem::Version
158
- version: 1.0.0
159
- - !ruby/object:Gem::Dependency
160
- name: pg
161
- requirement: !ruby/object:Gem::Requirement
162
- none: false
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
166
- version: 0.11.0
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
- requirements:
172
- - - ! '>='
173
- - !ruby/object:Gem::Version
174
- version: 0.11.0
175
- - !ruby/object:Gem::Dependency
176
- name: mysql2
177
- requirement: !ruby/object:Gem::Requirement
178
- none: false
179
- requirements:
180
- - - ~>
181
- - !ruby/object:Gem::Version
182
- version: 0.3.10
183
- type: :development
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
- requirements:
188
- - - ~>
189
- - !ruby/object:Gem::Version
190
- version: 0.3.10
191
- - !ruby/object:Gem::Dependency
192
- name: delayed_job
193
- requirement: !ruby/object:Gem::Requirement
194
- none: false
195
- requirements:
196
- - - ~>
197
- - !ruby/object:Gem::Version
198
- version: '3.0'
199
- type: :development
200
- prerelease: false
201
- version_requirements: !ruby/object:Gem::Requirement
202
- none: false
203
- requirements:
204
- - - ~>
205
- - !ruby/object:Gem::Version
206
- version: '3.0'
207
- - !ruby/object:Gem::Dependency
208
- name: delayed_job_active_record
209
- requirement: !ruby/object:Gem::Requirement
210
- none: false
211
- requirements:
212
- - - ! '>='
213
- - !ruby/object:Gem::Version
214
- version: '0'
215
- type: :development
216
- prerelease: false
217
- version_requirements: !ruby/object:Gem::Requirement
218
- none: false
219
- requirements:
220
- - - ! '>='
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
47
  description: Apartment allows Rack applications to deal with database multitenancy
224
48
  through ActiveRecord
225
49
  email:
@@ -229,7 +53,6 @@ executables: []
229
53
  extensions: []
230
54
  extra_rdoc_files: []
231
55
  files:
232
- - .DS_Store
233
56
  - .gitignore
234
57
  - .pryrc
235
58
  - .rspec
@@ -248,10 +71,11 @@ files:
248
71
  - lib/apartment/adapters/postgresql_adapter.rb
249
72
  - lib/apartment/console.rb
250
73
  - lib/apartment/database.rb
251
- - lib/apartment/delayed_job/active_record.rb
252
74
  - lib/apartment/delayed_job/enqueue.rb
253
75
  - lib/apartment/delayed_job/hooks.rb
76
+ - lib/apartment/delayed_job/psych_ext.rb
254
77
  - lib/apartment/delayed_job/requirements.rb
78
+ - lib/apartment/delayed_job/syck_ext.rb
255
79
  - lib/apartment/elevators/domain.rb
256
80
  - lib/apartment/elevators/first_subdomain.rb
257
81
  - lib/apartment/elevators/generic.rb
@@ -306,7 +130,7 @@ files:
306
130
  - spec/dummy/public/favicon.ico
307
131
  - spec/dummy/public/stylesheets/.gitkeep
308
132
  - spec/dummy/script/rails
309
- - spec/examples/db_adapter_examples.rb
133
+ - spec/examples/connection_adapter_examples.rb
310
134
  - spec/examples/elevator_examples.rb
311
135
  - spec/examples/generic_adapter_examples.rb
312
136
  - spec/examples/schema_adapter_examples.rb
@@ -343,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
343
167
  version: '0'
344
168
  segments:
345
169
  - 0
346
- hash: -3842088920209676639
170
+ hash: 1986473667684990578
347
171
  required_rubygems_version: !ruby/object:Gem::Requirement
348
172
  none: false
349
173
  requirements:
@@ -352,11 +176,73 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
176
  version: '0'
353
177
  segments:
354
178
  - 0
355
- hash: -3842088920209676639
179
+ hash: 1986473667684990578
356
180
  requirements: []
357
181
  rubyforge_project:
358
182
  rubygems_version: 1.8.24
359
183
  signing_key:
360
184
  specification_version: 3
361
185
  summary: A Ruby gem for managing database multitenancy
362
- test_files: []
186
+ test_files:
187
+ - spec/adapters/mysql2_adapter_spec.rb
188
+ - spec/adapters/postgresql_adapter_spec.rb
189
+ - spec/apartment_spec.rb
190
+ - spec/config/database.yml.sample
191
+ - spec/database_spec.rb
192
+ - spec/dummy/Rakefile
193
+ - spec/dummy/app/controllers/application_controller.rb
194
+ - spec/dummy/app/helpers/application_helper.rb
195
+ - spec/dummy/app/models/company.rb
196
+ - spec/dummy/app/models/user.rb
197
+ - spec/dummy/app/views/application/index.html.erb
198
+ - spec/dummy/app/views/layouts/application.html.erb
199
+ - spec/dummy/config.ru
200
+ - spec/dummy/config/application.rb
201
+ - spec/dummy/config/boot.rb
202
+ - spec/dummy/config/database.yml.sample
203
+ - spec/dummy/config/environment.rb
204
+ - spec/dummy/config/environments/development.rb
205
+ - spec/dummy/config/environments/production.rb
206
+ - spec/dummy/config/environments/test.rb
207
+ - spec/dummy/config/initializers/apartment.rb
208
+ - spec/dummy/config/initializers/backtrace_silencers.rb
209
+ - spec/dummy/config/initializers/inflections.rb
210
+ - spec/dummy/config/initializers/mime_types.rb
211
+ - spec/dummy/config/initializers/secret_token.rb
212
+ - spec/dummy/config/initializers/session_store.rb
213
+ - spec/dummy/config/locales/en.yml
214
+ - spec/dummy/config/routes.rb
215
+ - spec/dummy/db/migrate/20110613152810_create_dummy_models.rb
216
+ - spec/dummy/db/migrate/20111202022214_create_table_books.rb
217
+ - spec/dummy/db/schema.rb
218
+ - spec/dummy/db/seeds.rb
219
+ - spec/dummy/db/test.sqlite3
220
+ - spec/dummy/lib/fake_dj_class.rb
221
+ - spec/dummy/public/404.html
222
+ - spec/dummy/public/422.html
223
+ - spec/dummy/public/500.html
224
+ - spec/dummy/public/favicon.ico
225
+ - spec/dummy/public/stylesheets/.gitkeep
226
+ - spec/dummy/script/rails
227
+ - spec/examples/connection_adapter_examples.rb
228
+ - spec/examples/elevator_examples.rb
229
+ - spec/examples/generic_adapter_examples.rb
230
+ - spec/examples/schema_adapter_examples.rb
231
+ - spec/integration/apartment_rake_integration_spec.rb
232
+ - spec/integration/delayed_job_integration_spec.rb
233
+ - spec/integration/middleware/domain_elevator_spec.rb
234
+ - spec/integration/middleware/first_subdomain_elevator_spec.rb
235
+ - spec/integration/middleware/generic_elevator_spec.rb
236
+ - spec/integration/middleware/subdomain_elevator_spec.rb
237
+ - spec/spec_helper.rb
238
+ - spec/support/apartment_helpers.rb
239
+ - spec/support/capybara_sessions.rb
240
+ - spec/support/config.rb
241
+ - spec/support/contexts.rb
242
+ - spec/support/requirements.rb
243
+ - spec/tasks/apartment_rake_spec.rb
244
+ - spec/unit/config_spec.rb
245
+ - spec/unit/middleware/domain_elevator_spec.rb
246
+ - spec/unit/middleware/subdomain_elevator_spec.rb
247
+ - spec/unit/migrator_spec.rb
248
+ - spec/unit/reloader_spec.rb
data/.DS_Store DELETED
Binary file