sublease 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1c458d5eb065f845834f0b68125d1a0806fd68e43c19243132f2719cf06570c
4
- data.tar.gz: 1e731164736e3e56e8480041e70623294111de7cbd50d2a3c0d3137280096bf7
3
+ metadata.gz: 6ad7748b6dc95213d4e46cbf64197bac631e1aa8230ef85590e359c782727a79
4
+ data.tar.gz: f05487133a6cb7f8edcae43dca0141301b7d76354cb85637fa8e01dc041e961c
5
5
  SHA512:
6
- metadata.gz: e0b40e28f0ab57015f85e91bb9f86fafefaee9f6f12463047f7a8c89f099ed62279b147c07ec6f860f2fa3cedeb99ca8727e9cf1a8a4cc8379a0981d4974f17e
7
- data.tar.gz: bce2fd5028bc0af4d46c74c7bec501c7e13cf774777ef54aac7b014140943a16e6dd1fee734231ba8991cc50f77f80a127416bfe4f9517a4d3f8ed15d0aa2dd2
6
+ metadata.gz: c1d50ea38221d76794fe033006e209c7dbe4f6a045fa52e7e655762adaece85c9aa02dffa889f78cc79ef932dee87aaab49d070365079d986c43432753816d2e
7
+ data.tar.gz: af9eb8a87708d98c03182c04ff84439daf25777eec49b72f8819cb1ef3a3f9434f92f949470c33daedb3ccc7df006abc434ea86992c5700837af6927c15b039c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.1
2
+ -----
3
+ * Removed dependency on request_store gem.
4
+
1
5
  0.1.0
2
6
  -----
3
7
  * Initial release
data/Gemfile.lock CHANGED
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sublease (0.1.0)
4
+ sublease (0.1.1)
5
5
  rails (>= 4.1, < 6.0)
6
- request_store (>= 1.4.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
@@ -95,8 +94,6 @@ GEM
95
94
  thor (>= 0.18.1, < 2.0)
96
95
  rake (12.3.0)
97
96
  rdoc (6.0.1)
98
- request_store (1.4.0)
99
- rack (>= 1.4)
100
97
  shoulda (3.5.0)
101
98
  shoulda-context (~> 1.0, >= 1.0.1)
102
99
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -48,9 +48,8 @@ GIT
48
48
  PATH
49
49
  remote: .
50
50
  specs:
51
- sublease (0.1.0)
51
+ sublease (0.1.1)
52
52
  rails (>= 4.1, < 6.0)
53
- request_store (>= 1.4.0)
54
53
 
55
54
  GEM
56
55
  remote: https://rubygems.org/
@@ -85,8 +84,6 @@ GEM
85
84
  rack (>= 1.0)
86
85
  rake (12.3.0)
87
86
  rdoc (6.0.1)
88
- request_store (1.4.0)
89
- rack (>= 1.4)
90
87
  shoulda (3.5.0)
91
88
  shoulda-context (~> 1.0, >= 1.0.1)
92
89
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -57,9 +57,8 @@ GIT
57
57
  PATH
58
58
  remote: .
59
59
  specs:
60
- sublease (0.1.0)
60
+ sublease (0.1.1)
61
61
  rails (>= 4.1, < 6.0)
62
- request_store (>= 1.4.0)
63
62
 
64
63
  GEM
65
64
  remote: https://rubygems.org/
@@ -108,8 +107,6 @@ GEM
108
107
  loofah (~> 2.0)
109
108
  rake (12.3.0)
110
109
  rdoc (6.0.1)
111
- request_store (1.4.0)
112
- rack (>= 1.4)
113
110
  shoulda (3.5.0)
114
111
  shoulda-context (~> 1.0, >= 1.0.1)
115
112
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sublease (0.1.0.rc4)
4
+ sublease (0.1.1)
5
5
  rails (>= 4.1, < 6.0)
6
- request_store (>= 1.4.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
@@ -111,8 +110,6 @@ GEM
111
110
  thor (>= 0.18.1, < 2.0)
112
111
  rake (12.3.0)
113
112
  rdoc (6.0.1)
114
- request_store (1.4.0)
115
- rack (>= 1.4)
116
113
  shoulda (3.5.0)
117
114
  shoulda-context (~> 1.0, >= 1.0.1)
118
115
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -48,9 +48,8 @@ GIT
48
48
  PATH
49
49
  remote: .
50
50
  specs:
51
- sublease (0.1.0.rc4)
51
+ sublease (0.1.1)
52
52
  rails (>= 4.1, < 6.0)
53
- request_store (>= 1.4.0)
54
53
 
55
54
  GEM
56
55
  remote: https://rubygems.org/
@@ -72,8 +71,6 @@ GEM
72
71
  rack (>= 1.0)
73
72
  rake (12.3.0)
74
73
  rdoc (6.0.1)
75
- request_store (1.4.0)
76
- rack (>= 1.4)
77
74
  shoulda (3.5.0)
78
75
  shoulda-context (~> 1.0, >= 1.0.1)
79
76
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -57,9 +57,8 @@ GIT
57
57
  PATH
58
58
  remote: .
59
59
  specs:
60
- sublease (0.1.0.rc4)
60
+ sublease (0.1.1)
61
61
  rails (>= 4.1, < 6.0)
62
- request_store (>= 1.4.0)
63
62
 
64
63
  GEM
65
64
  remote: https://rubygems.org/
@@ -97,8 +96,6 @@ GEM
97
96
  loofah (~> 2.0)
98
97
  rake (12.3.0)
99
98
  rdoc (6.0.1)
100
- request_store (1.4.0)
101
- rack (>= 1.4)
102
99
  shoulda (3.5.0)
103
100
  shoulda-context (~> 1.0, >= 1.0.1)
104
101
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sublease (0.1.0.rc4)
4
+ sublease (0.1.1)
5
5
  rails (>= 4.1, < 6.0)
6
- request_store (>= 1.4.0)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
@@ -95,8 +94,6 @@ GEM
95
94
  thor (>= 0.18.1, < 2.0)
96
95
  rake (12.3.0)
97
96
  rdoc (6.0.1)
98
- request_store (1.4.0)
99
- rack (>= 1.4)
100
97
  shoulda (3.5.0)
101
98
  shoulda-context (~> 1.0, >= 1.0.1)
102
99
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sublease
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/lib/sublease.rb CHANGED
@@ -3,54 +3,63 @@
3
3
  require 'sublease/engine'
4
4
  require 'sublease/errors'
5
5
  require 'sublease/tenant_switcher'
6
- require 'request_store'
7
6
 
8
7
  module Sublease
9
8
 
10
9
  class << self
11
10
  attr_reader :tenant_model, :switch_on_domain, :switch_on_subdomain, :switch_on_subdomain_and_domain
12
11
 
12
+ # Current tenant information
13
+ @@current_tenant = nil
14
+ @@current_tenant_domain = nil
15
+ @@current_tenant_subdomain = nil
16
+
17
+ # Default tenant information
18
+ @@default_tenant = nil
19
+ @@default_tenant_domain = nil
20
+ @@default_tenant_subdomain = nil
21
+
13
22
  # configure sublease with available options
14
23
  def configure
15
24
  yield self if block_given?
16
25
  end
17
26
 
18
27
  def current_tenant=(tenant)
19
- RequestStore.store[:sublease_current_tenant] = tenant
28
+ @@current_tenant = tenant
20
29
  end
21
30
 
22
31
  def current_tenant
23
- RequestStore.store[:sublease_current_tenant] || default_tenant
32
+ @@current_tenant || default_tenant
24
33
  end
25
34
 
26
35
  def current_tenant_domain=(domain)
27
- RequestStore.store[:sublease_current_tenant_domain] = domain
36
+ @@current_tenant_domain = domain
28
37
  end
29
38
 
30
39
  def current_tenant_domain
31
- RequestStore.store[:sublease_current_tenant_domain] || default_tenant_domain
40
+ @@current_tenant_domain || default_tenant_domain
32
41
  end
33
42
 
34
43
  def current_tenant_subdomain=(subdomain)
35
- RequestStore.store[:sublease_current_tenant_subdomain] = subdomain
44
+ @@current_tenant_subdomain = subdomain
36
45
  end
37
46
 
38
47
  def current_tenant_subdomain
39
- RequestStore.store[:sublease_current_tenant_subdomain] || default_tenant_subdomain
48
+ @@current_tenant_subdomain || default_tenant_subdomain
40
49
  end
41
50
 
42
51
  def default_tenant=(tenant)
43
52
  raise Sublease::TenantNotFound if tenant.nil?
44
- RequestStore.store[:sublease_default_tenant] = tenant
53
+ @@default_tenant = tenant
45
54
  end
46
55
 
47
56
  def default_tenant
48
- RequestStore.store[:sublease_default_tenant]
57
+ @@default_tenant
49
58
  end
50
59
 
51
60
  def default_tenant_domain=(domain)
52
61
  tenant_model?
53
- RequestStore.store[:sublease_default_tenant_domain] = domain
62
+ @@default_tenant_domain = domain
54
63
  unless domain.nil?
55
64
  if default_tenant_subdomain.nil?
56
65
  self.default_tenant = tenant_model.where(domain: domain).first
@@ -61,12 +70,12 @@ module Sublease
61
70
  end
62
71
 
63
72
  def default_tenant_domain
64
- RequestStore.store[:sublease_default_tenant_domain]
73
+ @@default_tenant_domain
65
74
  end
66
75
 
67
76
  def default_tenant_subdomain=(subdomain)
68
77
  tenant_model?
69
- RequestStore.store[:sublease_default_tenant_subdomain] = subdomain
78
+ @@default_tenant_subdomain = subdomain
70
79
  unless subdomain.nil?
71
80
  if default_tenant_domain.nil?
72
81
  self.default_tenant = tenant_model.where(subdomain: subdomain).first
@@ -77,7 +86,7 @@ module Sublease
77
86
  end
78
87
 
79
88
  def default_tenant_subdomain
80
- RequestStore.store[:sublease_default_tenant_subdomain]
89
+ @@default_tenant_subdomain
81
90
  end
82
91
 
83
92
  def tenant_model=(model)
data/sublease.gemspec CHANGED
@@ -20,8 +20,6 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_dependency 'rails', '>= 4.1', '< 6.0'
22
22
 
23
- s.add_runtime_dependency('request_store', '>= 1.4.0')
24
-
25
23
  s.add_development_dependency 'sqlite3'
26
24
  s.add_development_dependency 'shoulda'
27
25
 
@@ -13,7 +13,7 @@ class NavigationTest < ActionDispatch::IntegrationTest
13
13
  Sublease.switch_on_domain = true
14
14
  get '/'
15
15
  assert_response :success
16
- assert_select '#current_tenant_name','site1'
16
+ assert_select '#current_tenant_name',Sublease.current_tenant.name
17
17
  end
18
18
  end
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sublease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bacrossland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-31 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6.0'
33
- - !ruby/object:Gem::Dependency
34
- name: request_store
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 1.4.0
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 1.4.0
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: sqlite3
49
35
  requirement: !ruby/object:Gem::Requirement