multitenant 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +46 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/multitenant.rb +37 -0
- data/multitenant.gemspec +94 -0
- data/spec/database.yml +3 -0
- data/spec/multitenant_spec.rb +125 -0
- data/spec/spec_helper.rb +18 -0
- metadata +297 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.3.0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.5.2"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
gem 'sqlite3', '~> 1.3.3'
|
14
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Ryan Sonnek
|
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:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
= Multitenant
|
2
|
+
|
3
|
+
When building multitenant applications, never let an unscoped Model.all accidentally leak data to an unintended audience.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
class User < ActiveRecord::Base
|
8
|
+
belongs_to :company
|
9
|
+
belongs_to_tenant :company
|
10
|
+
end
|
11
|
+
|
12
|
+
Multitenant.with_tenant current_company do
|
13
|
+
# queries within this block are automatically
|
14
|
+
# scoped to the current company
|
15
|
+
User.all
|
16
|
+
|
17
|
+
# new objects created within this block are automatically
|
18
|
+
# assigned to the current company
|
19
|
+
User.create :name => 'Bob'
|
20
|
+
end
|
21
|
+
|
22
|
+
== Features
|
23
|
+
|
24
|
+
* Rails 3 compatible
|
25
|
+
* Restrict database queries to only lookup objects for the current tenant
|
26
|
+
* Auto assign newly created objects to the current tenant
|
27
|
+
|
28
|
+
== Contributing
|
29
|
+
|
30
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
31
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
32
|
+
* Fork the project
|
33
|
+
* Start a feature/bugfix branch
|
34
|
+
* Commit and push until you are happy with your contribution
|
35
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
36
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
37
|
+
|
38
|
+
== Credits
|
39
|
+
|
40
|
+
Lars Klevan for inspiring this project.
|
41
|
+
|
42
|
+
== Copyright
|
43
|
+
|
44
|
+
Copyright (c) 2011 Ryan Sonnek. See LICENSE.txt for
|
45
|
+
further details.
|
46
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "multitenant"
|
16
|
+
gem.homepage = "http://github.com/wireframe/multitenant"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{scope database queries to current tenant}
|
19
|
+
gem.description = %Q{never let an unscoped Model.all accidentally leak data to an unintended audience.}
|
20
|
+
gem.email = "ryan@codecrate.com"
|
21
|
+
gem.authors = ["Ryan Sonnek"]
|
22
|
+
gem.add_runtime_dependency "activerecord", "~> 3.0.3"
|
23
|
+
gem.add_runtime_dependency "activesupport", "~> 3.0.3"
|
24
|
+
gem.add_runtime_dependency 'dynamic_default_scoping', '~> 0.0.3'
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "multitenant #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
data/lib/multitenant.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'active_support/all'
|
3
|
+
require 'dynamic_default_scoping'
|
4
|
+
|
5
|
+
# Multitenant: making cross tenant data leaks a thing of the past...since 2011
|
6
|
+
module Multitenant
|
7
|
+
class << self
|
8
|
+
attr_accessor :current_tenant
|
9
|
+
|
10
|
+
# execute a block scoped to the current tenant
|
11
|
+
# unsets the current tenant after execution
|
12
|
+
def with_tenant(tenant, &block)
|
13
|
+
Multitenant.current_tenant = tenant
|
14
|
+
yield
|
15
|
+
ensure
|
16
|
+
Multitenant.current_tenant = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module ActiveRecordExtensions
|
21
|
+
# configure the current model to automatically query and populate objects based on the current tenant
|
22
|
+
# see Multitenant#current_tenant
|
23
|
+
def belongs_to_tenant(association = :tenant)
|
24
|
+
include DynamicDefaultScoping
|
25
|
+
reflection = reflect_on_association association
|
26
|
+
before_validation Proc.new {|m|
|
27
|
+
return unless Multitenant.current_tenant
|
28
|
+
m.send "#{association}=".to_sym, Multitenant.current_tenant
|
29
|
+
}, :on => :create
|
30
|
+
default_scope :scoped_to_tenant, lambda {
|
31
|
+
return {} unless Multitenant.current_tenant
|
32
|
+
where({reflection.primary_key_name => Multitenant.current_tenant.id})
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
ActiveRecord::Base.extend Multitenant::ActiveRecordExtensions
|
data/multitenant.gemspec
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{multitenant}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Ryan Sonnek"]
|
12
|
+
s.date = %q{2011-02-07}
|
13
|
+
s.description = %q{never let an unscoped Model.all accidentally leak data to an unintended audience.}
|
14
|
+
s.email = %q{ryan@codecrate.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/multitenant.rb",
|
28
|
+
"multitenant.gemspec",
|
29
|
+
"spec/database.yml",
|
30
|
+
"spec/multitenant_spec.rb",
|
31
|
+
"spec/spec_helper.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/wireframe/multitenant}
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.5.0}
|
37
|
+
s.summary = %q{scope database queries to current tenant}
|
38
|
+
s.test_files = [
|
39
|
+
"spec/multitenant_spec.rb",
|
40
|
+
"spec/spec_helper.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<multitenant>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
49
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
51
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
53
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
54
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
56
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
58
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.3"])
|
59
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.3"])
|
60
|
+
s.add_runtime_dependency(%q<dynamic_default_scoping>, ["~> 0.0.3"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<multitenant>, [">= 0"])
|
63
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
64
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
66
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
67
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
68
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
69
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
71
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
72
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
73
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.3"])
|
74
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.3"])
|
75
|
+
s.add_dependency(%q<dynamic_default_scoping>, ["~> 0.0.3"])
|
76
|
+
end
|
77
|
+
else
|
78
|
+
s.add_dependency(%q<multitenant>, [">= 0"])
|
79
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
80
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
81
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
82
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
83
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
84
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
85
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
86
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
87
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
88
|
+
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
|
89
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.3"])
|
90
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.3"])
|
91
|
+
s.add_dependency(%q<dynamic_default_scoping>, ["~> 0.0.3"])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
data/spec/database.yml
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
ActiveRecord::Schema.define(:version => 1) do
|
4
|
+
create_table :companies, :force => true do |t|
|
5
|
+
t.column :name, :string
|
6
|
+
end
|
7
|
+
|
8
|
+
create_table :users, :force => true do |t|
|
9
|
+
t.column :name, :string
|
10
|
+
t.column :company_id, :integer
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
create_table :tenants, :force => true do |t|
|
15
|
+
t.column :name, :string
|
16
|
+
end
|
17
|
+
|
18
|
+
create_table :items, :force => true do |t|
|
19
|
+
t.column :name, :string
|
20
|
+
t.column :tenant_id, :integer
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Company < ActiveRecord::Base
|
25
|
+
has_many :users
|
26
|
+
end
|
27
|
+
class User < ActiveRecord::Base
|
28
|
+
belongs_to :company
|
29
|
+
belongs_to_tenant :company
|
30
|
+
end
|
31
|
+
|
32
|
+
class Tenant < ActiveRecord::Base
|
33
|
+
has_many :items
|
34
|
+
end
|
35
|
+
class Item < ActiveRecord::Base
|
36
|
+
belongs_to :tenant
|
37
|
+
belongs_to_tenant
|
38
|
+
end
|
39
|
+
|
40
|
+
describe Multitenant do
|
41
|
+
after { Multitenant.current_tenant = nil }
|
42
|
+
|
43
|
+
describe 'Multitenant.current_tenant' do
|
44
|
+
before { Multitenant.current_tenant = :foo }
|
45
|
+
it { Multitenant.current_tenant == :foo }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe 'Multitenant.with_tenant block' do
|
49
|
+
before do
|
50
|
+
@executed = false
|
51
|
+
Multitenant.with_tenant :foo do
|
52
|
+
Multitenant.current_tenant.should == :foo
|
53
|
+
@executed = true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
it 'clears current_tenant after block runs' do
|
57
|
+
Multitenant.current_tenant.should == nil
|
58
|
+
end
|
59
|
+
it 'yields the block' do
|
60
|
+
@executed.should == true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'Multitenant.with_tenant block that raises error' do
|
65
|
+
before do
|
66
|
+
@executed = false
|
67
|
+
lambda {
|
68
|
+
Multitenant.with_tenant :foo do
|
69
|
+
@executed = true
|
70
|
+
raise 'expected error'
|
71
|
+
end
|
72
|
+
}.should raise_error('expected error')
|
73
|
+
end
|
74
|
+
it 'clears current_tenant after block runs' do
|
75
|
+
Multitenant.current_tenant.should == nil
|
76
|
+
end
|
77
|
+
it 'yields the block' do
|
78
|
+
@executed.should == true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'User.all when current_tenant is set' do
|
83
|
+
before do
|
84
|
+
@company = Company.create!(:name => 'foo')
|
85
|
+
@company2 = Company.create!(:name => 'bar')
|
86
|
+
|
87
|
+
@user = @company.users.create! :name => 'bob'
|
88
|
+
@user2 = @company2.users.create! :name => 'tim'
|
89
|
+
Multitenant.with_tenant @company do
|
90
|
+
@users = User.all
|
91
|
+
end
|
92
|
+
end
|
93
|
+
it { @users.length.should == 1 }
|
94
|
+
it { @users.should == [@user] }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe 'Item.all when current_tenant is set' do
|
98
|
+
before do
|
99
|
+
@tenant = Tenant.create!(:name => 'foo')
|
100
|
+
@tenant2 = Tenant.create!(:name => 'bar')
|
101
|
+
|
102
|
+
@item = @tenant.items.create! :name => 'baz'
|
103
|
+
@item2 = @tenant2.items.create! :name => 'booz'
|
104
|
+
Multitenant.with_tenant @tenant do
|
105
|
+
@items = Item.all
|
106
|
+
end
|
107
|
+
end
|
108
|
+
it { @items.length.should == 1 }
|
109
|
+
it { @items.should == [@item] }
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
describe 'creating new object when current_tenant is set' do
|
114
|
+
before do
|
115
|
+
@company = Company.create! :name => 'foo'
|
116
|
+
Multitenant.with_tenant @company do
|
117
|
+
@user = User.create! :name => 'jimmy'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
it 'should auto_populate the company' do
|
121
|
+
@user.company_id.should == @company.id
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'multitenant'
|
5
|
+
require 'active_record'
|
6
|
+
require 'logger'
|
7
|
+
|
8
|
+
config = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'database.yml')))
|
9
|
+
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
|
10
|
+
ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite'])
|
11
|
+
|
12
|
+
# Requires supporting files with custom matchers and macros, etc,
|
13
|
+
# in ./support/ and its subdirectories.
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
15
|
+
|
16
|
+
RSpec.configure do |config|
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: multitenant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Sonnek
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-07 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: multitenant
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
prerelease: false
|
33
|
+
type: :runtime
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 3
|
46
|
+
- 0
|
47
|
+
version: 2.3.0
|
48
|
+
prerelease: false
|
49
|
+
type: :development
|
50
|
+
requirement: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: bundler
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 23
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 0
|
62
|
+
- 0
|
63
|
+
version: 1.0.0
|
64
|
+
prerelease: false
|
65
|
+
type: :development
|
66
|
+
requirement: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: jeweler
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 7
|
75
|
+
segments:
|
76
|
+
- 1
|
77
|
+
- 5
|
78
|
+
- 2
|
79
|
+
version: 1.5.2
|
80
|
+
prerelease: false
|
81
|
+
type: :development
|
82
|
+
requirement: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rcov
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
prerelease: false
|
95
|
+
type: :development
|
96
|
+
requirement: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 29
|
105
|
+
segments:
|
106
|
+
- 1
|
107
|
+
- 3
|
108
|
+
- 3
|
109
|
+
version: 1.3.3
|
110
|
+
prerelease: false
|
111
|
+
type: :development
|
112
|
+
requirement: *id006
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec
|
115
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 2
|
123
|
+
- 3
|
124
|
+
- 0
|
125
|
+
version: 2.3.0
|
126
|
+
prerelease: false
|
127
|
+
type: :development
|
128
|
+
requirement: *id007
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: bundler
|
131
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ~>
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 23
|
137
|
+
segments:
|
138
|
+
- 1
|
139
|
+
- 0
|
140
|
+
- 0
|
141
|
+
version: 1.0.0
|
142
|
+
prerelease: false
|
143
|
+
type: :development
|
144
|
+
requirement: *id008
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: jeweler
|
147
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
hash: 7
|
153
|
+
segments:
|
154
|
+
- 1
|
155
|
+
- 5
|
156
|
+
- 2
|
157
|
+
version: 1.5.2
|
158
|
+
prerelease: false
|
159
|
+
type: :development
|
160
|
+
requirement: *id009
|
161
|
+
- !ruby/object:Gem::Dependency
|
162
|
+
name: rcov
|
163
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
hash: 3
|
169
|
+
segments:
|
170
|
+
- 0
|
171
|
+
version: "0"
|
172
|
+
prerelease: false
|
173
|
+
type: :development
|
174
|
+
requirement: *id010
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: sqlite3
|
177
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ~>
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 29
|
183
|
+
segments:
|
184
|
+
- 1
|
185
|
+
- 3
|
186
|
+
- 3
|
187
|
+
version: 1.3.3
|
188
|
+
prerelease: false
|
189
|
+
type: :development
|
190
|
+
requirement: *id011
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: activerecord
|
193
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
194
|
+
none: false
|
195
|
+
requirements:
|
196
|
+
- - ~>
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
hash: 1
|
199
|
+
segments:
|
200
|
+
- 3
|
201
|
+
- 0
|
202
|
+
- 3
|
203
|
+
version: 3.0.3
|
204
|
+
prerelease: false
|
205
|
+
type: :runtime
|
206
|
+
requirement: *id012
|
207
|
+
- !ruby/object:Gem::Dependency
|
208
|
+
name: activesupport
|
209
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
210
|
+
none: false
|
211
|
+
requirements:
|
212
|
+
- - ~>
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
hash: 1
|
215
|
+
segments:
|
216
|
+
- 3
|
217
|
+
- 0
|
218
|
+
- 3
|
219
|
+
version: 3.0.3
|
220
|
+
prerelease: false
|
221
|
+
type: :runtime
|
222
|
+
requirement: *id013
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: dynamic_default_scoping
|
225
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
226
|
+
none: false
|
227
|
+
requirements:
|
228
|
+
- - ~>
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
hash: 25
|
231
|
+
segments:
|
232
|
+
- 0
|
233
|
+
- 0
|
234
|
+
- 3
|
235
|
+
version: 0.0.3
|
236
|
+
prerelease: false
|
237
|
+
type: :runtime
|
238
|
+
requirement: *id014
|
239
|
+
description: never let an unscoped Model.all accidentally leak data to an unintended audience.
|
240
|
+
email: ryan@codecrate.com
|
241
|
+
executables: []
|
242
|
+
|
243
|
+
extensions: []
|
244
|
+
|
245
|
+
extra_rdoc_files:
|
246
|
+
- LICENSE.txt
|
247
|
+
- README.rdoc
|
248
|
+
files:
|
249
|
+
- .document
|
250
|
+
- .rspec
|
251
|
+
- Gemfile
|
252
|
+
- LICENSE.txt
|
253
|
+
- README.rdoc
|
254
|
+
- Rakefile
|
255
|
+
- VERSION
|
256
|
+
- lib/multitenant.rb
|
257
|
+
- multitenant.gemspec
|
258
|
+
- spec/database.yml
|
259
|
+
- spec/multitenant_spec.rb
|
260
|
+
- spec/spec_helper.rb
|
261
|
+
has_rdoc: true
|
262
|
+
homepage: http://github.com/wireframe/multitenant
|
263
|
+
licenses:
|
264
|
+
- MIT
|
265
|
+
post_install_message:
|
266
|
+
rdoc_options: []
|
267
|
+
|
268
|
+
require_paths:
|
269
|
+
- lib
|
270
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
271
|
+
none: false
|
272
|
+
requirements:
|
273
|
+
- - ">="
|
274
|
+
- !ruby/object:Gem::Version
|
275
|
+
hash: 3
|
276
|
+
segments:
|
277
|
+
- 0
|
278
|
+
version: "0"
|
279
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
|
+
none: false
|
281
|
+
requirements:
|
282
|
+
- - ">="
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
hash: 3
|
285
|
+
segments:
|
286
|
+
- 0
|
287
|
+
version: "0"
|
288
|
+
requirements: []
|
289
|
+
|
290
|
+
rubyforge_project:
|
291
|
+
rubygems_version: 1.5.0
|
292
|
+
signing_key:
|
293
|
+
specification_version: 3
|
294
|
+
summary: scope database queries to current tenant
|
295
|
+
test_files:
|
296
|
+
- spec/multitenant_spec.rb
|
297
|
+
- spec/spec_helper.rb
|