saasable 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (3.2.9)
5
- activesupport (= 3.2.9)
4
+ activemodel (3.2.13)
5
+ activesupport (= 3.2.13)
6
6
  builder (~> 3.0.0)
7
- activesupport (3.2.9)
8
- i18n (~> 0.6)
7
+ activesupport (3.2.13)
8
+ i18n (= 0.6.1)
9
9
  multi_json (~> 1.0)
10
- bson (1.7.0)
10
+ bson (1.8.4)
11
11
  builder (3.0.4)
12
- diff-lcs (1.1.3)
12
+ diff-lcs (1.2.2)
13
13
  git (1.2.5)
14
14
  i18n (0.6.1)
15
15
  jeweler (1.8.4)
@@ -17,26 +17,26 @@ GEM
17
17
  git (>= 1.2.5)
18
18
  rake
19
19
  rdoc
20
- json (1.7.5)
21
- mongo (1.7.0)
22
- bson (~> 1.7.0)
23
- mongoid (2.5.1)
20
+ json (1.7.7)
21
+ mongo (1.8.4)
22
+ bson (~> 1.8.4)
23
+ mongoid (2.7.1)
24
24
  activemodel (~> 3.1)
25
- mongo (~> 1.7)
25
+ mongo (~> 1.8)
26
26
  tzinfo (~> 0.3.22)
27
- multi_json (1.3.7)
28
- rake (10.0.0)
29
- rdoc (3.12)
27
+ multi_json (1.7.2)
28
+ rake (10.0.4)
29
+ rdoc (4.0.1)
30
30
  json (~> 1.4)
31
- rspec (2.11.0)
32
- rspec-core (~> 2.11.0)
33
- rspec-expectations (~> 2.11.0)
34
- rspec-mocks (~> 2.11.0)
35
- rspec-core (2.11.1)
36
- rspec-expectations (2.11.3)
37
- diff-lcs (~> 1.1.3)
38
- rspec-mocks (2.11.3)
39
- tzinfo (0.3.35)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ tzinfo (0.3.37)
40
40
 
41
41
  PLATFORMS
42
42
  ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -1,20 +1,21 @@
1
1
  class Saasable::Middleware
2
2
  def initialize app
3
3
  @app = app
4
- end
5
-
6
- def call env
4
+ @_saas_for_host = {}
5
+
7
6
  # Loads all models so we know how to apply the scopes on Rails
8
7
  Rails::Mongoid.load_models(Rails.application) if defined?(Rails::Mongoid)
9
-
8
+ end
9
+
10
+ def call env
10
11
  env[:saasable] = {:current_saas => saas_for_host(env["SERVER_NAME"])}
11
12
  env[:saasable][:current_saas].activate! if env[:saasable][:current_saas]
12
-
13
+
13
14
  @app.call env
14
15
  end
15
-
16
+
16
17
  private
17
18
  def saas_for_host hostname
18
- Saasable::Mongoid::SaasDocument.saas_document.find_by_host!(hostname) rescue nil
19
+ @_saas_for_host[hostname] ||= Saasable::Mongoid::SaasDocument.saas_document.find_by_host!(hostname) rescue nil
19
20
  end
20
21
  end
data/saasable.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "saasable"
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Educa2", "Rafael Gaspar"]
12
- s.date = "2012-11-12"
12
+ s.date = "2013-04-10"
13
13
  s.description = "A gem for making a Multi-Tenant SaaS using Mongoid"
14
14
  s.email = "suporte@educa2.com.br"
15
15
  s.extra_rdoc_files = [
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.homepage = "http://github.com/educa2/saasable"
42
42
  s.licenses = ["MIT"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = "1.8.24"
44
+ s.rubygems_version = "1.8.25"
45
45
  s.summary = "A gem for making a Multi-Tenant SaaS using Mongoid"
46
46
 
47
47
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saasable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
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-11-12 00:00:00.000000000 Z
13
+ date: 2013-04-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mongoid
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  segments:
137
137
  - 0
138
- hash: 758273759438966357
138
+ hash: 74225619918418
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 1.8.24
147
+ rubygems_version: 1.8.25
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: A gem for making a Multi-Tenant SaaS using Mongoid