apartment 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/HISTORY.md +5 -0
- data/apartment.gemspec +6 -6
- data/lib/apartment/database.rb +15 -15
- data/lib/apartment/delayed_job/active_record.rb +13 -4
- data/lib/apartment/delayed_job/hooks.rb +5 -5
- data/lib/apartment/delayed_job/requirements.rb +6 -6
- data/lib/apartment/version.rb +1 -1
- data/spec/dummy/db/migrate/20110613152810_create_dummy_models.rb +4 -3
- data/spec/dummy/db/schema.rb +2 -7
- data/spec/integration/apartment_rake_integration_spec.rb +13 -13
- data/spec/integration/delayed_job_integration_spec.rb +20 -20
- data/spec/spec_helper.rb +3 -3
- data/spec/support/apartment_helpers.rb +1 -1
- data/spec/tasks/apartment_rake_spec.rb +26 -26
- metadata +82 -91
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm --create ruby-1.9.
|
1
|
+
rvm --create ruby-1.9.3@apartment
|
data/HISTORY.md
CHANGED
data/apartment.gemspec
CHANGED
@@ -12,17 +12,17 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = %w{ryan@ryanbrunner.com bradleyrobertson@gmail.com}
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
15
|
-
|
15
|
+
|
16
16
|
s.homepage = %q{http://github.com/bradrobertson/apartment}
|
17
17
|
s.licenses = ["MIT"]
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.rubygems_version = %q{1.3.7}
|
20
|
-
|
21
|
-
s.add_dependency 'rails', '
|
22
|
-
s.add_development_dependency 'rake', '~> 0.
|
20
|
+
|
21
|
+
s.add_dependency 'rails', '>= 3.1.2'
|
22
|
+
s.add_development_dependency 'rake', '~> 0.9.2'
|
23
23
|
s.add_development_dependency 'sqlite3'
|
24
|
-
s.add_development_dependency 'rspec', '~> 2.
|
25
|
-
s.add_development_dependency 'rspec-rails', '~> 2.
|
24
|
+
s.add_development_dependency 'rspec', '~> 2.8.0'
|
25
|
+
s.add_development_dependency 'rspec-rails', '~> 2.8.0'
|
26
26
|
s.add_development_dependency 'capybara', '1.0.0'
|
27
27
|
s.add_development_dependency 'pg', '~> 0.11.0'
|
28
28
|
s.add_development_dependency 'mysql2', '~> 0.3.7'
|
data/lib/apartment/database.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
require 'active_support/core_ext/module/delegation'
|
2
2
|
|
3
3
|
module Apartment
|
4
|
-
|
4
|
+
|
5
5
|
# The main entry point to Apartment functions
|
6
6
|
module Database
|
7
|
-
|
7
|
+
|
8
8
|
extend self
|
9
9
|
|
10
10
|
delegate :create, :current_database, :drop, :process, :process_excluded_models, :reset, :seed, :switch, :to => :adapter
|
11
11
|
|
12
12
|
# Initialize Apartment config options such as excluded_models
|
13
|
-
#
|
13
|
+
#
|
14
14
|
def init
|
15
15
|
process_excluded_models
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
# Fetch the proper multi-tenant adapter based on Rails config
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# @return {subclass of Apartment::AbstractAdapter}
|
21
|
-
#
|
21
|
+
#
|
22
22
|
def adapter
|
23
23
|
@adapter ||= begin
|
24
24
|
adapter_method = "#{config[:adapter]}_adapter"
|
25
25
|
|
26
26
|
begin
|
27
27
|
require "apartment/adapters/#{adapter_method}"
|
28
|
-
rescue LoadError
|
28
|
+
rescue LoadError
|
29
29
|
raise "The adapter `#{config[:adapter]}` is not yet supported"
|
30
30
|
end
|
31
31
|
|
32
32
|
unless respond_to?(adapter_method)
|
33
33
|
raise AdapterNotFound, "database configuration specifies nonexistent #{config[:adapter]} adapter"
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
send(adapter_method, config)
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
# Reset config and adapter so they are regenerated
|
41
|
-
#
|
41
|
+
#
|
42
42
|
def reload!
|
43
43
|
@adapter = nil
|
44
44
|
@config = nil
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
private
|
48
|
-
|
48
|
+
|
49
49
|
# Fetch the rails database configuration
|
50
|
-
#
|
50
|
+
#
|
51
51
|
def config
|
52
52
|
@config ||= Rails.configuration.database_configuration[Rails.env].symbolize_keys
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
class Base
|
3
|
-
|
3
|
+
|
4
4
|
# Overriding Delayed Job's monkey_patch of ActiveRecord so that it works with Apartment
|
5
5
|
yaml_as "tag:ruby.yaml.org,2002:ActiveRecord"
|
6
|
-
|
6
|
+
|
7
7
|
def self.yaml_new(klass, tag, val)
|
8
8
|
Apartment::Database.process(val['database']) do
|
9
9
|
klass.find(val['attributes']['id'])
|
@@ -11,10 +11,19 @@ module ActiveRecord
|
|
11
11
|
rescue ActiveRecord::RecordNotFound
|
12
12
|
raise Delayed::DeserializationError
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
|
+
# Rails > 3.0 now uses encode_with to determine what to encode with yaml
|
16
|
+
# @override to include database attribute
|
17
|
+
def encode_with_with_database(coder)
|
18
|
+
coder['database'] = database
|
19
|
+
encode_with_without_database(coder)
|
20
|
+
end
|
21
|
+
alias_method_chain :encode_with, :database
|
22
|
+
|
23
|
+
# Remain backwards compatible with old yaml serialization
|
15
24
|
def to_yaml_properties
|
16
25
|
['@attributes', '@database'] # add in database attribute for serialization
|
17
26
|
end
|
18
|
-
|
27
|
+
|
19
28
|
end
|
20
29
|
end
|
@@ -3,22 +3,22 @@ require 'apartment/delayed_job/enqueue'
|
|
3
3
|
module Apartment
|
4
4
|
module Delayed
|
5
5
|
module Job
|
6
|
-
|
6
|
+
|
7
7
|
# Before and after hooks for performing Delayed Jobs within a particular apartment database
|
8
8
|
# Include these in your delayed jobs models and make sure provide a @database attr that will be serialized by DJ
|
9
9
|
# Note also that any models that are being serialized need the Apartment::Delayed::Requirements module mixed in to it
|
10
10
|
module Hooks
|
11
|
-
|
11
|
+
|
12
12
|
attr_accessor :database
|
13
|
-
|
13
|
+
|
14
14
|
def before(job)
|
15
15
|
Apartment::Database.switch(job.payload_object.database) if job.payload_object.database
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def after
|
19
19
|
Apartment::Database.reset
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -2,22 +2,22 @@ require 'apartment/delayed_job/enqueue'
|
|
2
2
|
|
3
3
|
module Apartment
|
4
4
|
module Delayed
|
5
|
-
|
5
|
+
|
6
6
|
# Mix this module into any ActiveRecord model that gets serialized by DJ
|
7
7
|
module Requirements
|
8
8
|
attr_accessor :database
|
9
|
-
|
9
|
+
|
10
10
|
def self.included(klass)
|
11
11
|
klass.after_find :set_database # set db when records are pulled so they deserialize properly
|
12
|
-
klass.before_save :set_database # set db before records are saved so that they also get deserialized properly
|
12
|
+
klass.before_save :set_database # set db before records are saved so that they also get deserialized properly
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
private
|
16
|
-
|
16
|
+
|
17
17
|
def set_database
|
18
18
|
@database = Apartment::Database.current_database
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/apartment/version.rb
CHANGED
@@ -4,13 +4,13 @@ class CreateDummyModels < ActiveRecord::Migration
|
|
4
4
|
t.boolean :dummy
|
5
5
|
t.string :database
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
create_table :users do |t|
|
9
9
|
t.string :name
|
10
10
|
t.datetime :birthdate
|
11
11
|
t.string :sex
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
create_table :delayed_jobs do |t|
|
15
15
|
t.integer :priority, :default => 0
|
16
16
|
t.integer :attempts, :default => 0
|
@@ -22,10 +22,11 @@ class CreateDummyModels < ActiveRecord::Migration
|
|
22
22
|
t.string :locked_by
|
23
23
|
t.datetime :created_at
|
24
24
|
t.datetime :updated_at
|
25
|
+
t.string :queue
|
25
26
|
end
|
26
27
|
|
27
28
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
28
|
-
|
29
|
+
|
29
30
|
end
|
30
31
|
|
31
32
|
def self.down
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,13 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
15
|
-
|
16
|
-
create_table "books", :force => true do |t|
|
17
|
-
t.string "name"
|
18
|
-
t.integer "pages"
|
19
|
-
t.datetime "published"
|
20
|
-
end
|
14
|
+
ActiveRecord::Schema.define(:version => 20110613152810) do
|
21
15
|
|
22
16
|
create_table "companies", :force => true do |t|
|
23
17
|
t.boolean "dummy"
|
@@ -35,6 +29,7 @@ ActiveRecord::Schema.define(:version => 20111202022214) do
|
|
35
29
|
t.string "locked_by"
|
36
30
|
t.datetime "created_at"
|
37
31
|
t.datetime "updated_at"
|
32
|
+
t.string "queue"
|
38
33
|
end
|
39
34
|
|
40
35
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
describe "apartment rake tasks" do
|
5
|
-
|
5
|
+
|
6
6
|
before do
|
7
7
|
@rake = Rake::Application.new
|
8
8
|
Rake.application = @rake
|
@@ -12,13 +12,13 @@ describe "apartment rake tasks" do
|
|
12
12
|
# it defines a `rails_env` task that our db:migrate depends on
|
13
13
|
# No idea why, but during the tests, we somehow lose this tasks, so we get an error when testing migrations
|
14
14
|
# This is STUPID!
|
15
|
-
load "rails/tasks/misc.rake"
|
15
|
+
load "rails/tasks/misc.rake"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
after do
|
19
19
|
Rake.application = nil
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
before do
|
23
23
|
Apartment.configure do |config|
|
24
24
|
config.excluded_models = ["Company"]
|
@@ -27,7 +27,7 @@ describe "apartment rake tasks" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context "with x number of databases" do
|
30
|
-
|
30
|
+
|
31
31
|
let(:x){ 1 + rand(5) } # random number of dbs to create
|
32
32
|
let(:db_names){ x.times.map{|y| "database_#{y}" } }
|
33
33
|
|
@@ -37,38 +37,38 @@ describe "apartment rake tasks" do
|
|
37
37
|
Company.create :database => db_name
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
after do
|
42
42
|
db_names.each{ |db| Apartment::Database.drop(db) }
|
43
43
|
Company.delete_all
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
describe "#migrate" do
|
47
47
|
it "should migrate all databases" do
|
48
48
|
Apartment::Migrator.should_receive(:migrate).exactly(db_names.length).times
|
49
|
-
|
49
|
+
|
50
50
|
@rake['apartment:migrate'].invoke
|
51
51
|
end
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
describe "#rollback" do
|
55
55
|
it "should rollback all dbs" do
|
56
56
|
db_names.each do |name|
|
57
57
|
Apartment::Migrator.should_receive(:rollback).with(name, anything)
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
@rake['apartment:rollback'].invoke
|
61
61
|
@rake['apartment:migrate'].invoke # migrate again so that our next test 'seed' can run (requires migrations to be complete)
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
describe "apartment:seed" do
|
66
66
|
it "should seed all databases" do
|
67
67
|
Apartment::Database.should_receive(:seed).exactly(db_names.length).times
|
68
|
-
|
68
|
+
|
69
69
|
@rake['apartment:seed'].invoke
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
end
|
74
74
|
end
|
@@ -3,49 +3,49 @@ require 'delayed_job'
|
|
3
3
|
Delayed::Worker.guess_backend
|
4
4
|
|
5
5
|
describe Apartment::Delayed do
|
6
|
-
|
6
|
+
|
7
7
|
# See apartment.yml file in dummy app config
|
8
|
-
|
8
|
+
|
9
9
|
let(:config){ Apartment::Test.config['connections']['postgresql'].symbolize_keys }
|
10
10
|
let(:database){ "some_new_database" }
|
11
11
|
let(:database2){ "another_db" }
|
12
|
-
|
12
|
+
|
13
13
|
before do
|
14
14
|
ActiveRecord::Base.establish_connection config
|
15
15
|
Apartment::Test.load_schema # load the Rails schema in the public db schema
|
16
16
|
Apartment::Database.stub(:config).and_return config # Use postgresql database config for this test
|
17
17
|
@schema_search_path = ActiveRecord::Base.connection.schema_search_path
|
18
|
-
|
18
|
+
|
19
19
|
Apartment.configure do |config|
|
20
20
|
config.use_postgres_schemas = true
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
Apartment::Database.create database
|
24
24
|
Apartment::Database.create database2
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
after do
|
28
28
|
Apartment::Test.drop_schema database
|
29
29
|
Apartment::Test.drop_schema database2
|
30
30
|
Apartment::Test.reset
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
describe Apartment::Delayed::Job do
|
34
34
|
context "#enqueue" do
|
35
|
-
|
35
|
+
|
36
36
|
before do
|
37
37
|
Apartment::Database.reset
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should queue up jobs in the public schema" do
|
41
41
|
dj_count = Delayed::Job.count
|
42
42
|
Apartment::Database.switch database
|
43
43
|
Apartment::Delayed::Job.enqueue FakeDjClass.new
|
44
44
|
Apartment::Database.reset
|
45
|
-
|
45
|
+
|
46
46
|
Delayed::Job.count.should == dj_count + 1
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
it "should not queue jobs in the current schema" do
|
50
50
|
Apartment::Database.switch database
|
51
51
|
expect {
|
@@ -54,39 +54,39 @@ describe Apartment::Delayed do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
describe Apartment::Delayed::Requirements do
|
59
|
-
|
59
|
+
|
60
60
|
before do
|
61
61
|
Apartment::Database.switch database
|
62
62
|
User.send(:include, Apartment::Delayed::Requirements)
|
63
63
|
User.create
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it "should initialize a database attribute on a class" do
|
67
67
|
user = User.first
|
68
68
|
user.database.should == database
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
it "should not overwrite any previous after_initialize declarations" do
|
72
72
|
User.class_eval do
|
73
73
|
after_find :set_name
|
74
|
-
|
74
|
+
|
75
75
|
def set_name
|
76
76
|
self.name = "Some Name"
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
user = User.first
|
81
81
|
user.database.should == database
|
82
82
|
user.name.should == "Some Name"
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
it "should set the db on a new record before it saves" do
|
86
86
|
user = User.create
|
87
87
|
user.database.should == database
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
context "serialization" do
|
91
91
|
it "should serialize the proper database attribute" do
|
92
92
|
user_yaml = User.first.to_yaml
|
@@ -96,5 +96,5 @@ describe Apartment::Delayed do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -19,13 +19,13 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
19
19
|
|
20
20
|
|
21
21
|
RSpec.configure do |config|
|
22
|
-
|
22
|
+
|
23
23
|
config.include RSpec::Integration::CapybaraSessions, :type => :request
|
24
|
-
|
24
|
+
|
25
25
|
config.before(:all) do
|
26
26
|
# Ensure that each test starts with a clean connection
|
27
27
|
# Necessary as some tests will leak things like current_schema into the next test
|
28
28
|
ActiveRecord::Base.clear_all_connections!
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
end
|
@@ -9,7 +9,7 @@ module Apartment
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def drop_schema(schema)
|
12
|
-
ActiveRecord::Base.
|
12
|
+
ActiveRecord::Base.connection.execute("DROP SCHEMA IF EXISTS #{schema} CASCADE") rescue true
|
13
13
|
end
|
14
14
|
|
15
15
|
def create_schema(schema)
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
describe "apartment rake tasks" do
|
5
|
-
|
5
|
+
|
6
6
|
before do
|
7
7
|
@rake = Rake::Application.new
|
8
8
|
Rake.application = @rake
|
@@ -15,104 +15,104 @@ describe "apartment rake tasks" do
|
|
15
15
|
Rake::Task.define_task('db:migrate:down')
|
16
16
|
Rake::Task.define_task('db:migrate:redo')
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
after do
|
20
20
|
Rake.application = nil
|
21
21
|
ENV['VERSION'] = nil # linux users reported env variable carrying on between tests
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
let(:version){ '1234' }
|
25
|
-
|
25
|
+
|
26
26
|
context 'database migration' do
|
27
|
-
|
27
|
+
|
28
28
|
let(:database_names){ ['company1', 'company2', 'company3'] }
|
29
29
|
let(:db_count){ database_names.length }
|
30
|
-
|
30
|
+
|
31
31
|
before do
|
32
32
|
Apartment.stub(:database_names).and_return database_names
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
describe "apartment:migrate" do
|
36
36
|
before do
|
37
37
|
ActiveRecord::Migrator.stub(:migrate) # don't care about this
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should migrate public and all multi-tenant dbs" do
|
41
41
|
Apartment::Migrator.should_receive(:migrate).exactly(db_count).times
|
42
42
|
@rake['apartment:migrate'].invoke
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
describe "apartment:migrate:up" do
|
47
|
-
|
47
|
+
|
48
48
|
context "without a version" do
|
49
49
|
before do
|
50
50
|
ENV['VERSION'] = nil
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "requires a version to migrate to" do
|
54
54
|
lambda{
|
55
55
|
@rake['apartment:migrate:up'].invoke
|
56
56
|
}.should raise_error("VERSION is required")
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
context "with version" do
|
61
|
-
|
61
|
+
|
62
62
|
before do
|
63
63
|
ENV['VERSION'] = version
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it "migrates up to a specific version" do
|
67
67
|
Apartment::Migrator.should_receive(:run).with(:up, anything, version.to_i).exactly(db_count).times
|
68
68
|
@rake['apartment:migrate:up'].invoke
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
describe "apartment:migrate:down" do
|
74
|
-
|
74
|
+
|
75
75
|
context "without a version" do
|
76
76
|
before do
|
77
77
|
ENV['VERSION'] = nil
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
it "requires a version to migrate to" do
|
81
81
|
lambda{
|
82
82
|
@rake['apartment:migrate:down'].invoke
|
83
83
|
}.should raise_error("VERSION is required")
|
84
84
|
end
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
context "with version" do
|
88
|
-
|
88
|
+
|
89
89
|
before do
|
90
90
|
ENV['VERSION'] = version
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
it "migrates up to a specific version" do
|
94
94
|
Apartment::Migrator.should_receive(:run).with(:down, anything, version.to_i).exactly(db_count).times
|
95
95
|
@rake['apartment:migrate:down'].invoke
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
describe "apartment:rollback" do
|
101
|
-
|
101
|
+
|
102
102
|
let(:step){ '3' }
|
103
|
-
|
103
|
+
|
104
104
|
it "should rollback dbs" do
|
105
105
|
Apartment::Migrator.should_receive(:rollback).exactly(db_count).times
|
106
106
|
@rake['apartment:rollback'].invoke
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
it "should rollback dbs STEP amt" do
|
110
110
|
Apartment::Migrator.should_receive(:rollback).with(anything, step.to_i).exactly(db_count).times
|
111
111
|
ENV['STEP'] = step
|
112
112
|
@rake['apartment:rollback'].invoke
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
end
|
metadata
CHANGED
@@ -1,140 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: apartment
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.14.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.14.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ryan Brunner
|
9
9
|
- Brad Robertson
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-02-21 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
18
16
|
name: rails
|
19
|
-
requirement: &
|
17
|
+
requirement: &2155984060 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
24
22
|
version: 3.1.2
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
|
-
version_requirements: *
|
28
|
-
- !ruby/object:Gem::Dependency
|
25
|
+
version_requirements: *2155984060
|
26
|
+
- !ruby/object:Gem::Dependency
|
29
27
|
name: rake
|
30
|
-
requirement: &
|
28
|
+
requirement: &2155981900 !ruby/object:Gem::Requirement
|
31
29
|
none: false
|
32
|
-
requirements:
|
30
|
+
requirements:
|
33
31
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
36
34
|
type: :development
|
37
35
|
prerelease: false
|
38
|
-
version_requirements: *
|
39
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *2155981900
|
37
|
+
- !ruby/object:Gem::Dependency
|
40
38
|
name: sqlite3
|
41
|
-
requirement: &
|
39
|
+
requirement: &2155980140 !ruby/object:Gem::Requirement
|
42
40
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
47
45
|
type: :development
|
48
46
|
prerelease: false
|
49
|
-
version_requirements: *
|
50
|
-
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: *2155980140
|
48
|
+
- !ruby/object:Gem::Dependency
|
51
49
|
name: rspec
|
52
|
-
requirement: &
|
50
|
+
requirement: &2155978440 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
|
-
requirements:
|
52
|
+
requirements:
|
55
53
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: 2.
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.8.0
|
58
56
|
type: :development
|
59
57
|
prerelease: false
|
60
|
-
version_requirements: *
|
61
|
-
- !ruby/object:Gem::Dependency
|
58
|
+
version_requirements: *2155978440
|
59
|
+
- !ruby/object:Gem::Dependency
|
62
60
|
name: rspec-rails
|
63
|
-
requirement: &
|
61
|
+
requirement: &2155928900 !ruby/object:Gem::Requirement
|
64
62
|
none: false
|
65
|
-
requirements:
|
63
|
+
requirements:
|
66
64
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 2.
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.8.0
|
69
67
|
type: :development
|
70
68
|
prerelease: false
|
71
|
-
version_requirements: *
|
72
|
-
- !ruby/object:Gem::Dependency
|
69
|
+
version_requirements: *2155928900
|
70
|
+
- !ruby/object:Gem::Dependency
|
73
71
|
name: capybara
|
74
|
-
requirement: &
|
72
|
+
requirement: &2155927460 !ruby/object:Gem::Requirement
|
75
73
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
74
|
+
requirements:
|
75
|
+
- - =
|
76
|
+
- !ruby/object:Gem::Version
|
79
77
|
version: 1.0.0
|
80
78
|
type: :development
|
81
79
|
prerelease: false
|
82
|
-
version_requirements: *
|
83
|
-
- !ruby/object:Gem::Dependency
|
80
|
+
version_requirements: *2155927460
|
81
|
+
- !ruby/object:Gem::Dependency
|
84
82
|
name: pg
|
85
|
-
requirement: &
|
83
|
+
requirement: &2155925380 !ruby/object:Gem::Requirement
|
86
84
|
none: false
|
87
|
-
requirements:
|
85
|
+
requirements:
|
88
86
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
87
|
+
- !ruby/object:Gem::Version
|
90
88
|
version: 0.11.0
|
91
89
|
type: :development
|
92
90
|
prerelease: false
|
93
|
-
version_requirements: *
|
94
|
-
- !ruby/object:Gem::Dependency
|
91
|
+
version_requirements: *2155925380
|
92
|
+
- !ruby/object:Gem::Dependency
|
95
93
|
name: mysql2
|
96
|
-
requirement: &
|
94
|
+
requirement: &2155923980 !ruby/object:Gem::Requirement
|
97
95
|
none: false
|
98
|
-
requirements:
|
96
|
+
requirements:
|
99
97
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
98
|
+
- !ruby/object:Gem::Version
|
101
99
|
version: 0.3.7
|
102
100
|
type: :development
|
103
101
|
prerelease: false
|
104
|
-
version_requirements: *
|
105
|
-
- !ruby/object:Gem::Dependency
|
102
|
+
version_requirements: *2155923980
|
103
|
+
- !ruby/object:Gem::Dependency
|
106
104
|
name: silent-postgres
|
107
|
-
requirement: &
|
105
|
+
requirement: &2155922040 !ruby/object:Gem::Requirement
|
108
106
|
none: false
|
109
|
-
requirements:
|
107
|
+
requirements:
|
110
108
|
- - ~>
|
111
|
-
- !ruby/object:Gem::Version
|
109
|
+
- !ruby/object:Gem::Version
|
112
110
|
version: 0.1.1
|
113
111
|
type: :development
|
114
112
|
prerelease: false
|
115
|
-
version_requirements: *
|
116
|
-
- !ruby/object:Gem::Dependency
|
113
|
+
version_requirements: *2155922040
|
114
|
+
- !ruby/object:Gem::Dependency
|
117
115
|
name: delayed_job
|
118
|
-
requirement: &
|
116
|
+
requirement: &2155918340 !ruby/object:Gem::Requirement
|
119
117
|
none: false
|
120
|
-
requirements:
|
118
|
+
requirements:
|
121
119
|
- - ~>
|
122
|
-
- !ruby/object:Gem::Version
|
120
|
+
- !ruby/object:Gem::Version
|
123
121
|
version: 2.1.4
|
124
122
|
type: :development
|
125
123
|
prerelease: false
|
126
|
-
version_requirements: *
|
124
|
+
version_requirements: *2155918340
|
127
125
|
description: Apartment allows Rails applications to deal with database multitenancy
|
128
|
-
email:
|
126
|
+
email:
|
129
127
|
- ryan@ryanbrunner.com
|
130
128
|
- bradleyrobertson@gmail.com
|
131
129
|
executables: []
|
132
|
-
|
133
130
|
extensions: []
|
134
|
-
|
135
131
|
extra_rdoc_files: []
|
136
|
-
|
137
|
-
files:
|
132
|
+
files:
|
138
133
|
- .gitignore
|
139
134
|
- .rspec
|
140
135
|
- .rvmrc
|
@@ -211,39 +206,35 @@ files:
|
|
211
206
|
- spec/unit/middleware/subdomain_elevator_spec.rb
|
212
207
|
- spec/unit/migrator_spec.rb
|
213
208
|
- spec/unit/reloader_spec.rb
|
214
|
-
has_rdoc: true
|
215
209
|
homepage: http://github.com/bradrobertson/apartment
|
216
|
-
licenses:
|
210
|
+
licenses:
|
217
211
|
- MIT
|
218
212
|
post_install_message:
|
219
213
|
rdoc_options: []
|
220
|
-
|
221
|
-
require_paths:
|
214
|
+
require_paths:
|
222
215
|
- lib
|
223
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
224
217
|
none: false
|
225
|
-
requirements:
|
226
|
-
- -
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
|
229
|
-
segments:
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
segments:
|
230
223
|
- 0
|
231
|
-
|
232
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
hash: -739145364198480753
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
226
|
none: false
|
234
|
-
requirements:
|
235
|
-
- -
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
|
238
|
-
segments:
|
227
|
+
requirements:
|
228
|
+
- - ! '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
231
|
+
segments:
|
239
232
|
- 0
|
240
|
-
|
233
|
+
hash: -739145364198480753
|
241
234
|
requirements: []
|
242
|
-
|
243
235
|
rubyforge_project:
|
244
|
-
rubygems_version: 1.
|
236
|
+
rubygems_version: 1.8.10
|
245
237
|
signing_key:
|
246
238
|
specification_version: 3
|
247
239
|
summary: A Ruby gem for managing database multitenancy in Rails applications
|
248
240
|
test_files: []
|
249
|
-
|