mongoid-multitenancy 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,46 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid-multitenancy (0.3.3)
4
+ mongoid-multitenancy (0.3.4)
5
5
  mongoid (~> 3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.13)
11
- activesupport (= 3.2.13)
10
+ activemodel (3.2.15)
11
+ activesupport (= 3.2.15)
12
12
  builder (~> 3.0.0)
13
- activesupport (3.2.13)
14
- i18n (= 0.6.1)
13
+ activesupport (3.2.15)
14
+ i18n (~> 0.6, >= 0.6.4)
15
15
  multi_json (~> 1.0)
16
16
  builder (3.0.4)
17
- database_cleaner (1.0.1)
17
+ database_cleaner (1.2.0)
18
18
  diff-lcs (1.2.4)
19
- i18n (0.6.1)
20
- mongoid (3.1.3)
19
+ i18n (0.6.5)
20
+ mongoid (3.1.5)
21
21
  activemodel (~> 3.2)
22
- moped (~> 1.4.2)
22
+ moped (~> 1.4)
23
23
  origin (~> 1.0)
24
- tzinfo (~> 0.3.22)
25
- mongoid-rspec (1.8.1)
24
+ tzinfo (~> 0.3.29)
25
+ mongoid-rspec (1.9.0)
26
26
  mongoid (>= 3.0.1)
27
27
  rake
28
- rspec (>= 2.9)
29
- moped (1.4.5)
30
- multi_json (1.7.3)
28
+ rspec (>= 2.14)
29
+ moped (1.5.1)
30
+ multi_json (1.8.2)
31
31
  origin (1.1.0)
32
- rake (10.0.4)
33
- redcarpet (2.2.2)
34
- rspec (2.13.0)
35
- rspec-core (~> 2.13.0)
36
- rspec-expectations (~> 2.13.0)
37
- rspec-mocks (~> 2.13.0)
38
- rspec-core (2.13.1)
39
- rspec-expectations (2.13.0)
32
+ rake (10.1.0)
33
+ redcarpet (2.3.0)
34
+ rspec (2.14.1)
35
+ rspec-core (~> 2.14.0)
36
+ rspec-expectations (~> 2.14.0)
37
+ rspec-mocks (~> 2.14.0)
38
+ rspec-core (2.14.6)
39
+ rspec-expectations (2.14.3)
40
40
  diff-lcs (>= 1.1.3, < 2.0)
41
- rspec-mocks (2.13.1)
42
- tzinfo (0.3.37)
43
- yard (0.8.6.1)
41
+ rspec-mocks (2.14.4)
42
+ tzinfo (0.3.38)
43
+ yard (0.8.7.2)
44
44
 
45
45
  PLATFORMS
46
46
  ruby
data/LICENSE.TXT CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2012 Perfect Memory
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2013 Perfect Memory
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -7,11 +7,11 @@ module Mongoid
7
7
  attr_accessor :tenant_field
8
8
 
9
9
  def tenant(association = :account, options={})
10
- original_options = options.clone
11
- tenant_options = { optional: options.delete(:optional), immutable: options.delete(:immutable) { true } }
10
+ active_model_options = options.clone
11
+ tenant_options = { optional: active_model_options.delete(:optional), immutable: active_model_options.delete(:immutable) { true } }
12
12
  # Setup the association between the class and the tenant class
13
13
  # TODO: should index this association if no other indexes are defined => , index: true
14
- belongs_to association, options
14
+ belongs_to association, active_model_options
15
15
 
16
16
  # Get the tenant model and its foreign key
17
17
  tenant_field = reflect_on_association(association).foreign_key
@@ -43,7 +43,7 @@ module Mongoid
43
43
  }
44
44
 
45
45
  self.define_singleton_method(:inherited) do |child|
46
- child.tenant association, original_options
46
+ child.tenant association, options
47
47
  super(child)
48
48
  end
49
49
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Multitenancy
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{MultiTenancy with Mongoid}
8
8
  gem.summary = %q{Support of a multi-tenant database with Mongoid}
9
9
  gem.homepage = "https://github.com/PerfectMemory/mongoid-multitenancy"
10
-
10
+ gem.license = 'MIT'
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
@@ -5,14 +5,13 @@ describe 'Inheritance' do
5
5
  let(:client) { Account.create!(:name => "client") }
6
6
 
7
7
  describe "class" do
8
- before do
9
- Mongoid::Multitenancy.current_tenant = client
10
- MutableChild.create :title => "title X", :slug => "page-x"
8
+ it 'should use inheritance pattern' do
9
+ MutableChild.create!(:title => "title X", :slug => "page-x")
10
+ expect(Mutable.last).to be_a MutableChild
11
11
  end
12
- after { Mongoid::Multitenancy.current_tenant = nil }
13
12
 
14
- it 'should be valid' do
15
- expect(Mutable.last).to be_a MutableChild
13
+ it 'should keep options' do
14
+ AnotherMutableChild.new(:title => "title X", :slug => "page-x").should be_valid
16
15
  end
17
16
  end
18
17
  end
@@ -2,7 +2,7 @@ class Mutable
2
2
  include Mongoid::Document
3
3
  include Mongoid::Multitenancy::Document
4
4
 
5
- tenant(:client, :class_name => 'Account', :immutable => false)
5
+ tenant :client, :class_name => 'Account', :immutable => false, :optional => true
6
6
 
7
7
  field :slug, :type => String
8
8
  field :title, :type => String
@@ -1,5 +1,9 @@
1
1
  require 'models/mutable'
2
2
 
3
3
  class MutableChild < Mutable
4
+ field :random, type: String
5
+ end
4
6
 
7
+ class AnotherMutableChild < Mutable
8
+ field :random, type: String
5
9
  end
metadata CHANGED
@@ -2,127 +2,127 @@
2
2
  name: mongoid-multitenancy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.3
5
+ version: 0.3.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Aymeric Brisse
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-24 00:00:00.000000000 Z
12
+ date: 2013-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- prerelease: false
16
- name: mongoid
17
- type: :runtime
18
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
22
20
  version: '3'
21
+ name: mongoid
22
+ requirement: !ruby/object:Gem::Requirement
23
23
  none: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
24
  requirements:
26
25
  - - ~>
27
26
  - !ruby/object:Gem::Version
28
27
  version: '3'
29
- none: false
30
- - !ruby/object:Gem::Dependency
31
28
  prerelease: false
32
- name: rake
33
- type: :development
34
- requirement: !ruby/object:Gem::Requirement
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ none: false
35
33
  requirements:
36
34
  - - ~>
37
35
  - !ruby/object:Gem::Version
38
36
  version: '10.0'
37
+ name: rake
38
+ requirement: !ruby/object:Gem::Requirement
39
39
  none: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
40
  requirements:
42
41
  - - ~>
43
42
  - !ruby/object:Gem::Version
44
43
  version: '10.0'
45
- none: false
46
- - !ruby/object:Gem::Dependency
47
44
  prerelease: false
48
- name: rspec
49
45
  type: :development
50
- requirement: !ruby/object:Gem::Requirement
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ none: false
51
49
  requirements:
52
50
  - - ~>
53
51
  - !ruby/object:Gem::Version
54
52
  version: '2.12'
53
+ name: rspec
54
+ requirement: !ruby/object:Gem::Requirement
55
55
  none: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
56
  requirements:
58
57
  - - ~>
59
58
  - !ruby/object:Gem::Version
60
59
  version: '2.12'
61
- none: false
62
- - !ruby/object:Gem::Dependency
63
60
  prerelease: false
64
- name: yard
65
61
  type: :development
66
- requirement: !ruby/object:Gem::Requirement
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ none: false
67
65
  requirements:
68
66
  - - ~>
69
67
  - !ruby/object:Gem::Version
70
68
  version: '0.8'
69
+ name: yard
70
+ requirement: !ruby/object:Gem::Requirement
71
71
  none: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
72
  requirements:
74
73
  - - ~>
75
74
  - !ruby/object:Gem::Version
76
75
  version: '0.8'
77
- none: false
78
- - !ruby/object:Gem::Dependency
79
76
  prerelease: false
80
- name: mongoid-rspec
81
77
  type: :development
82
- requirement: !ruby/object:Gem::Requirement
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ none: false
83
81
  requirements:
84
82
  - - ~>
85
83
  - !ruby/object:Gem::Version
86
84
  version: '1.5'
85
+ name: mongoid-rspec
86
+ requirement: !ruby/object:Gem::Requirement
87
87
  none: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
88
  requirements:
90
89
  - - ~>
91
90
  - !ruby/object:Gem::Version
92
91
  version: '1.5'
93
- none: false
94
- - !ruby/object:Gem::Dependency
95
92
  prerelease: false
96
- name: database_cleaner
97
93
  type: :development
98
- requirement: !ruby/object:Gem::Requirement
94
+ - !ruby/object:Gem::Dependency
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ none: false
99
97
  requirements:
100
98
  - - ~>
101
99
  - !ruby/object:Gem::Version
102
100
  version: '1.0'
101
+ name: database_cleaner
102
+ requirement: !ruby/object:Gem::Requirement
103
103
  none: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
104
  requirements:
106
105
  - - ~>
107
106
  - !ruby/object:Gem::Version
108
107
  version: '1.0'
109
- none: false
110
- - !ruby/object:Gem::Dependency
111
108
  prerelease: false
112
- name: redcarpet
113
109
  type: :development
114
- requirement: !ruby/object:Gem::Requirement
110
+ - !ruby/object:Gem::Dependency
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ none: false
115
113
  requirements:
116
114
  - - ~>
117
115
  - !ruby/object:Gem::Version
118
116
  version: '2.2'
117
+ name: redcarpet
118
+ requirement: !ruby/object:Gem::Requirement
119
119
  none: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
120
  requirements:
122
121
  - - ~>
123
122
  - !ruby/object:Gem::Version
124
123
  version: '2.2'
125
- none: false
124
+ prerelease: false
125
+ type: :development
126
126
  description: MultiTenancy with Mongoid
127
127
  email:
128
128
  - aymeric.brisse@mperfect-memory.com
@@ -158,29 +158,30 @@ files:
158
158
  - spec/optional_spec.rb
159
159
  - spec/spec_helper.rb
160
160
  homepage: https://github.com/PerfectMemory/mongoid-multitenancy
161
- licenses: []
161
+ licenses:
162
+ - MIT
162
163
  post_install_message:
163
164
  rdoc_options: []
164
165
  require_paths:
165
166
  - lib
166
167
  required_ruby_version: !ruby/object:Gem::Requirement
168
+ none: false
167
169
  requirements:
168
170
  - - ! '>='
169
171
  - !ruby/object:Gem::Version
170
172
  segments:
171
173
  - 0
172
- hash: 3855106664827069335
174
+ hash: 1046556066794350660
173
175
  version: '0'
174
- none: false
175
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
+ none: false
176
178
  requirements:
177
179
  - - ! '>='
178
180
  - !ruby/object:Gem::Version
179
181
  segments:
180
182
  - 0
181
- hash: 3855106664827069335
183
+ hash: 1046556066794350660
182
184
  version: '0'
183
- none: false
184
185
  requirements: []
185
186
  rubyforge_project:
186
187
  rubygems_version: 1.8.25