subdomain_router 1.0.0 → 1.0.2
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 +7 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +160 -92
- data/README.md +2 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/spec/subdomain_router_spec.rb +45 -45
- data/subdomain_router.gemspec +47 -35
- metadata +36 -47
- data/.rvmrc +0 -1
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: beddf2d4b4cb474736fe40b722c3bbf965d40dbb6fd8318f5d1ab8111de3c22d
|
|
4
|
+
data.tar.gz: 265256f1fb39214e0296fd5027ddccb2893aa0b846b767a2f5b204eae4babad4
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e29f380bfce2af2672c6860a3e200ec984369413b2709912a0603b12484c668c65b313db08f1c8edd33e67c149cdb40ed497d7f430d46179da8d9a94cefd79aa
|
|
7
|
+
data.tar.gz: d9a7b96516f27b6cfe59b7cec2009089705db66fd984b9aa61f0767e9892116a5552b79e3090f920eb8c9f23af1d54af67e50bd53f5ee4d1af5f423a853fdd02
|
data/.rspec
CHANGED
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
subdomain_router
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,107 +1,175 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
actionpack (=
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
activesupport (=
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
4
|
+
actioncable (5.1.4)
|
|
5
|
+
actionpack (= 5.1.4)
|
|
6
|
+
nio4r (~> 2.0)
|
|
7
|
+
websocket-driver (~> 0.6.1)
|
|
8
|
+
actionmailer (5.1.4)
|
|
9
|
+
actionpack (= 5.1.4)
|
|
10
|
+
actionview (= 5.1.4)
|
|
11
|
+
activejob (= 5.1.4)
|
|
12
|
+
mail (~> 2.5, >= 2.5.4)
|
|
13
|
+
rails-dom-testing (~> 2.0)
|
|
14
|
+
actionpack (5.1.4)
|
|
15
|
+
actionview (= 5.1.4)
|
|
16
|
+
activesupport (= 5.1.4)
|
|
17
|
+
rack (~> 2.0)
|
|
18
|
+
rack-test (>= 0.6.3)
|
|
19
|
+
rails-dom-testing (~> 2.0)
|
|
20
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
21
|
+
actionview (5.1.4)
|
|
22
|
+
activesupport (= 5.1.4)
|
|
23
|
+
builder (~> 3.1)
|
|
24
|
+
erubi (~> 1.4)
|
|
25
|
+
rails-dom-testing (~> 2.0)
|
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
27
|
+
activejob (5.1.4)
|
|
28
|
+
activesupport (= 5.1.4)
|
|
29
|
+
globalid (>= 0.3.6)
|
|
30
|
+
activemodel (5.1.4)
|
|
31
|
+
activesupport (= 5.1.4)
|
|
32
|
+
activerecord (5.1.4)
|
|
33
|
+
activemodel (= 5.1.4)
|
|
34
|
+
activesupport (= 5.1.4)
|
|
35
|
+
arel (~> 8.0)
|
|
36
|
+
activesupport (5.1.4)
|
|
37
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
38
|
+
i18n (~> 0.7)
|
|
39
|
+
minitest (~> 5.1)
|
|
40
|
+
tzinfo (~> 1.1)
|
|
41
|
+
addressable (2.5.2)
|
|
42
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
43
|
+
arel (8.0.0)
|
|
44
|
+
builder (3.2.3)
|
|
45
|
+
concurrent-ruby (1.0.5)
|
|
46
|
+
crass (1.0.3)
|
|
47
|
+
descendants_tracker (0.0.4)
|
|
48
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
49
|
+
diff-lcs (1.3)
|
|
50
|
+
erubi (1.7.0)
|
|
51
|
+
faraday (0.12.2)
|
|
52
|
+
multipart-post (>= 1.2, < 3)
|
|
53
|
+
git (1.3.0)
|
|
54
|
+
github_api (0.18.2)
|
|
55
|
+
addressable (~> 2.4)
|
|
56
|
+
descendants_tracker (~> 0.0.4)
|
|
57
|
+
faraday (~> 0.8)
|
|
58
|
+
hashie (~> 3.5, >= 3.5.2)
|
|
59
|
+
oauth2 (~> 1.0)
|
|
60
|
+
globalid (0.4.1)
|
|
61
|
+
activesupport (>= 4.2.0)
|
|
62
|
+
hashie (3.5.6)
|
|
63
|
+
highline (1.7.10)
|
|
64
|
+
i18n (0.9.1)
|
|
65
|
+
concurrent-ruby (~> 1.0)
|
|
66
|
+
juwelier (2.4.7)
|
|
67
|
+
builder
|
|
68
|
+
bundler
|
|
69
|
+
git
|
|
70
|
+
github_api
|
|
71
|
+
highline
|
|
72
|
+
kamelcase (~> 0)
|
|
73
|
+
nokogiri
|
|
74
|
+
psych
|
|
41
75
|
rake
|
|
42
76
|
rdoc
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
semver2
|
|
78
|
+
jwt (1.5.6)
|
|
79
|
+
kamelcase (0.0.1)
|
|
80
|
+
semver2 (~> 3)
|
|
81
|
+
loofah (2.1.1)
|
|
82
|
+
crass (~> 1.0.2)
|
|
83
|
+
nokogiri (>= 1.5.9)
|
|
84
|
+
mail (2.7.0)
|
|
85
|
+
mini_mime (>= 0.1.1)
|
|
86
|
+
method_source (0.9.0)
|
|
87
|
+
mini_mime (1.0.0)
|
|
88
|
+
mini_portile2 (2.3.0)
|
|
89
|
+
minitest (5.10.3)
|
|
90
|
+
multi_json (1.12.2)
|
|
91
|
+
multi_xml (0.6.0)
|
|
92
|
+
multipart-post (2.0.0)
|
|
93
|
+
nio4r (2.1.0)
|
|
94
|
+
nokogiri (1.8.1)
|
|
95
|
+
mini_portile2 (~> 2.3.0)
|
|
96
|
+
oauth2 (1.4.0)
|
|
97
|
+
faraday (>= 0.8, < 0.13)
|
|
98
|
+
jwt (~> 1.0)
|
|
99
|
+
multi_json (~> 1.3)
|
|
100
|
+
multi_xml (~> 0.5)
|
|
101
|
+
rack (>= 1.2, < 3)
|
|
102
|
+
psych (3.0.1)
|
|
103
|
+
public_suffix (3.0.1)
|
|
104
|
+
rack (2.0.3)
|
|
105
|
+
rack-test (0.8.2)
|
|
106
|
+
rack (>= 1.0, < 3)
|
|
107
|
+
rails (5.1.4)
|
|
108
|
+
actioncable (= 5.1.4)
|
|
109
|
+
actionmailer (= 5.1.4)
|
|
110
|
+
actionpack (= 5.1.4)
|
|
111
|
+
actionview (= 5.1.4)
|
|
112
|
+
activejob (= 5.1.4)
|
|
113
|
+
activemodel (= 5.1.4)
|
|
114
|
+
activerecord (= 5.1.4)
|
|
115
|
+
activesupport (= 5.1.4)
|
|
116
|
+
bundler (>= 1.3.0)
|
|
117
|
+
railties (= 5.1.4)
|
|
118
|
+
sprockets-rails (>= 2.0.0)
|
|
119
|
+
rails-dom-testing (2.0.3)
|
|
120
|
+
activesupport (>= 4.2.0)
|
|
121
|
+
nokogiri (>= 1.6)
|
|
122
|
+
rails-html-sanitizer (1.0.3)
|
|
123
|
+
loofah (~> 2.0)
|
|
124
|
+
railties (5.1.4)
|
|
125
|
+
actionpack (= 5.1.4)
|
|
126
|
+
activesupport (= 5.1.4)
|
|
127
|
+
method_source
|
|
71
128
|
rake (>= 0.8.7)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rspec-
|
|
80
|
-
|
|
81
|
-
rspec-
|
|
82
|
-
rspec-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
rspec-mocks (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
129
|
+
thor (>= 0.18.1, < 2.0)
|
|
130
|
+
rake (12.3.0)
|
|
131
|
+
rdoc (6.0.0)
|
|
132
|
+
redcarpet (3.4.0)
|
|
133
|
+
rspec (3.7.0)
|
|
134
|
+
rspec-core (~> 3.7.0)
|
|
135
|
+
rspec-expectations (~> 3.7.0)
|
|
136
|
+
rspec-mocks (~> 3.7.0)
|
|
137
|
+
rspec-core (3.7.0)
|
|
138
|
+
rspec-support (~> 3.7.0)
|
|
139
|
+
rspec-expectations (3.7.0)
|
|
140
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
141
|
+
rspec-support (~> 3.7.0)
|
|
142
|
+
rspec-mocks (3.7.0)
|
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
144
|
+
rspec-support (~> 3.7.0)
|
|
145
|
+
rspec-support (3.7.0)
|
|
146
|
+
semver2 (3.4.2)
|
|
147
|
+
sprockets (3.7.1)
|
|
148
|
+
concurrent-ruby (~> 1.0)
|
|
149
|
+
rack (> 1, < 3)
|
|
150
|
+
sprockets-rails (3.2.1)
|
|
151
|
+
actionpack (>= 4.0)
|
|
152
|
+
activesupport (>= 4.0)
|
|
153
|
+
sprockets (>= 3.0.0)
|
|
154
|
+
thor (0.20.0)
|
|
155
|
+
thread_safe (0.3.6)
|
|
156
|
+
tzinfo (1.2.4)
|
|
157
|
+
thread_safe (~> 0.1)
|
|
158
|
+
websocket-driver (0.6.5)
|
|
159
|
+
websocket-extensions (>= 0.1.0)
|
|
160
|
+
websocket-extensions (0.1.3)
|
|
161
|
+
yard (0.9.12)
|
|
97
162
|
|
|
98
163
|
PLATFORMS
|
|
99
164
|
ruby
|
|
100
165
|
|
|
101
166
|
DEPENDENCIES
|
|
102
167
|
bundler
|
|
103
|
-
|
|
104
|
-
rails
|
|
168
|
+
juwelier
|
|
169
|
+
rails (>= 5.0.0)
|
|
105
170
|
redcarpet
|
|
106
171
|
rspec
|
|
107
172
|
yard
|
|
173
|
+
|
|
174
|
+
BUNDLED WITH
|
|
175
|
+
1.16.0
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -11,8 +11,8 @@ rescue Bundler::BundlerError => e
|
|
|
11
11
|
end
|
|
12
12
|
require 'rake'
|
|
13
13
|
|
|
14
|
-
require '
|
|
15
|
-
|
|
14
|
+
require 'juwelier'
|
|
15
|
+
Juwelier::Tasks.new do |gem|
|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
17
|
gem.name = "subdomain_router"
|
|
18
18
|
gem.homepage = "http://github.com/RISCfuture/subdomain_router"
|
|
@@ -23,7 +23,7 @@ Jeweler::Tasks.new do |gem|
|
|
|
23
23
|
gem.authors = ["Tim Morgan"]
|
|
24
24
|
# dependencies defined in Gemfile
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
Juwelier::RubygemsDotOrgTasks.new
|
|
27
27
|
|
|
28
28
|
require 'rspec/core'
|
|
29
29
|
require 'rspec/core/rake_task'
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
|
@@ -15,65 +15,65 @@ describe SubdomainRouter::Controller do
|
|
|
15
15
|
|
|
16
16
|
describe "#url_for" do
|
|
17
17
|
it "should call the superclass unless a hash is given" do
|
|
18
|
-
@controller.url_for('foo').
|
|
18
|
+
expect(@controller.url_for('foo')).to eql('foo')
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
context "[given host]" do
|
|
22
22
|
before :each do
|
|
23
|
-
@controller.
|
|
23
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'test.host'))
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "should leave the domain untouched if :subdomain => nil" do
|
|
27
|
-
@controller.url_for(host: 'foo.bar').
|
|
28
|
-
@controller.url_for(host: 'sd.foo.bar').
|
|
29
|
-
@controller.url_for(host: 'baz.bat.foo.bar').
|
|
27
|
+
expect(@controller.url_for(host: 'foo.bar')).to eql(host: 'foo.bar')
|
|
28
|
+
expect(@controller.url_for(host: 'sd.foo.bar')).to eql(host: 'sd.foo.bar')
|
|
29
|
+
expect(@controller.url_for(host: 'baz.bat.foo.bar')).to eql(host: 'baz.bat.foo.bar')
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
it "should replace the subdomain if :subdomain is given" do
|
|
33
|
-
@controller.url_for(host: 'foo.bar', subdomain: 'sd').
|
|
34
|
-
@controller.url_for(host: 'baz.foo.bar', subdomain: 'sd').
|
|
35
|
-
@controller.url_for(host: 'baz.bat.foo.bar', subdomain: 'sd').
|
|
33
|
+
expect(@controller.url_for(host: 'foo.bar', subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
34
|
+
expect(@controller.url_for(host: 'baz.foo.bar', subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
35
|
+
expect(@controller.url_for(host: 'baz.bat.foo.bar', subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it "should use the default subdomain if :subdomain is false" do
|
|
39
|
-
@controller.url_for(host: 'foo.bar', subdomain: false).
|
|
40
|
-
@controller.url_for(host: 'baz.foo.bar', subdomain: false).
|
|
41
|
-
@controller.url_for(host: 'baz.bat.foo.bar', subdomain: false).
|
|
39
|
+
expect(@controller.url_for(host: 'foo.bar', subdomain: false)).to eql(host: 'foo.bar')
|
|
40
|
+
expect(@controller.url_for(host: 'baz.foo.bar', subdomain: false)).to eql(host: 'foo.bar')
|
|
41
|
+
expect(@controller.url_for(host: 'baz.bat.foo.bar', subdomain: false)).to eql(host: 'foo.bar')
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
context "[request host]" do
|
|
46
46
|
it "should leave the domain untouched if :subdomain => nil" do
|
|
47
|
-
@controller.
|
|
48
|
-
@controller.url_for(subdomain: nil).
|
|
47
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'foo.bar'))
|
|
48
|
+
expect(@controller.url_for(subdomain: nil)).to eql({})
|
|
49
49
|
|
|
50
|
-
@controller.
|
|
51
|
-
@controller.url_for(subdomain: nil).
|
|
50
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'sd.foo.bar'))
|
|
51
|
+
expect(@controller.url_for(subdomain: nil)).to eql({})
|
|
52
52
|
|
|
53
|
-
@controller.
|
|
54
|
-
@controller.url_for(subdomain: nil).
|
|
53
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'baz.bat.foo.bar'))
|
|
54
|
+
expect(@controller.url_for(subdomain: nil)).to eql({})
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it "should replace the subdomain if :subdomain is given" do
|
|
58
|
-
@controller.
|
|
59
|
-
@controller.url_for(subdomain: 'sd').
|
|
58
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'foo.bar'))
|
|
59
|
+
expect(@controller.url_for(subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
60
60
|
|
|
61
|
-
@controller.
|
|
62
|
-
@controller.url_for(subdomain: 'sd').
|
|
61
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'baz.foo.bar'))
|
|
62
|
+
expect(@controller.url_for(subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
63
63
|
|
|
64
|
-
@controller.
|
|
65
|
-
@controller.url_for(subdomain: 'sd').
|
|
64
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'baz.bat.foo.bar'))
|
|
65
|
+
expect(@controller.url_for(subdomain: 'sd')).to eql(host: 'sd.foo.bar')
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
it "should use the default subdomain if :subdomain is false" do
|
|
69
|
-
@controller.
|
|
70
|
-
@controller.url_for(subdomain: false).
|
|
69
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'foo.bar'))
|
|
70
|
+
expect(@controller.url_for(subdomain: false)).to eql(host: 'foo.bar')
|
|
71
71
|
|
|
72
|
-
@controller.
|
|
73
|
-
@controller.url_for(subdomain: false).
|
|
72
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'baz.foo.bar'))
|
|
73
|
+
expect(@controller.url_for(subdomain: false)).to eql(host: 'foo.bar')
|
|
74
74
|
|
|
75
|
-
@controller.
|
|
76
|
-
@controller.url_for(subdomain: false).
|
|
75
|
+
allow(@controller).to receive(:request).and_return(double('ActionDispatch::Request', host: 'baz.bat.foo.bar'))
|
|
76
|
+
expect(@controller.url_for(subdomain: false)).to eql(host: 'foo.bar')
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -88,15 +88,15 @@ describe SubdomainRouter::Controller do
|
|
|
88
88
|
|
|
89
89
|
it "should leave the domain untouched if :subdomain => nil" do
|
|
90
90
|
# no host provided = exception
|
|
91
|
-
|
|
91
|
+
expect { @mailer.url_for(controller: 'users', action: 'new', subdomain: nil) }.to raise_error(ArgumentError)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "should replace the subdomain if :subdomain is given" do
|
|
95
|
-
@mailer.url_for(controller: 'users', action: 'new', subdomain: 'sd').
|
|
95
|
+
expect(@mailer.url_for(controller: 'users', action: 'new', subdomain: 'sd')).to eql('http://sd.test.host/users/new')
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it "should use the default subdomain if :subdomain is false" do
|
|
99
|
-
@mailer.url_for(controller: 'users', action: 'new', subdomain: false).
|
|
99
|
+
expect(@mailer.url_for(controller: 'users', action: 'new', subdomain: false)).to eql('http://test.host/users/new')
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
end
|
|
@@ -106,40 +106,40 @@ describe SubdomainRouter::Constraint do
|
|
|
106
106
|
describe ".matches?" do
|
|
107
107
|
before :each do
|
|
108
108
|
@env = {}
|
|
109
|
-
@request =
|
|
109
|
+
@request = double('ActionDispatch::Request', env: @env)
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
it "should return false if there is more than one subdomain" do
|
|
113
|
-
@request.
|
|
114
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
113
|
+
allow(@request).to receive(:subdomains).and_return(%w( foo bar ))
|
|
114
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(false)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
it "should return false if there is no subdomain" do
|
|
118
|
-
@request.
|
|
119
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
118
|
+
allow(@request).to receive(:subdomains).and_return([])
|
|
119
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(false)
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
it "should return false if the subdomain is equal to the default subdomain" do
|
|
123
123
|
SubdomainRouter::Config.default_subdomain = 'www'
|
|
124
|
-
@request.
|
|
125
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
124
|
+
allow(@request).to receive(:subdomains).and_return(%w( www ))
|
|
125
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(false)
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it "should return false if the subdomain does not belong to any user" do
|
|
129
|
-
@request.
|
|
130
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
129
|
+
allow(@request).to receive(:subdomains).and_return(%w( not-found ))
|
|
130
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(false)
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
it "should return true if the subdomain belongs to a user and save the user to the env" do
|
|
134
134
|
SubdomainRouter::Config.subdomain_matcher = ->(subdomain, request) { subdomain == 'valid' }
|
|
135
|
-
@request.
|
|
136
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
135
|
+
allow(@request).to receive(:subdomains).and_return([ 'valid' ])
|
|
136
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(true)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it "should downcase the subdomain" do
|
|
140
140
|
SubdomainRouter::Config.subdomain_matcher = ->(subdomain, request) { subdomain == 'valid' }
|
|
141
|
-
@request.
|
|
142
|
-
SubdomainRouter::Constraint.matches?(@request).
|
|
141
|
+
allow(@request).to receive(:subdomains).and_return([ 'VALID' ])
|
|
142
|
+
expect(SubdomainRouter::Constraint.matches?(@request)).to eql(true)
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
end
|
data/subdomain_router.gemspec
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
# Generated by
|
|
1
|
+
# Generated by juwelier
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit
|
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
+
# stub: subdomain_router 1.0.2 ruby lib
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name = "subdomain_router"
|
|
8
|
-
s.version = "1.0.
|
|
8
|
+
s.name = "subdomain_router".freeze
|
|
9
|
+
s.version = "1.0.2"
|
|
9
10
|
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.
|
|
14
|
-
s.
|
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
|
+
s.require_paths = ["lib".freeze]
|
|
13
|
+
s.authors = ["Tim Morgan".freeze]
|
|
14
|
+
s.date = "2016-07-04"
|
|
15
|
+
s.description = "This adds a routing constraint and controller methods to allow dynamic subdomain-based routing.".freeze
|
|
16
|
+
s.email = "gemcutter@timothymorgan.info".freeze
|
|
15
17
|
s.extra_rdoc_files = [
|
|
16
18
|
"LICENSE.txt",
|
|
17
19
|
"README.md"
|
|
@@ -19,7 +21,8 @@ Gem::Specification.new do |s|
|
|
|
19
21
|
s.files = [
|
|
20
22
|
".document",
|
|
21
23
|
".rspec",
|
|
22
|
-
".
|
|
24
|
+
".ruby-gemset",
|
|
25
|
+
".ruby-version",
|
|
23
26
|
"Gemfile",
|
|
24
27
|
"Gemfile.lock",
|
|
25
28
|
"LICENSE.txt",
|
|
@@ -28,39 +31,48 @@ Gem::Specification.new do |s|
|
|
|
28
31
|
"VERSION",
|
|
29
32
|
"lib/subdomain_router.rb",
|
|
30
33
|
"spec/spec_helper.rb",
|
|
31
|
-
"spec/subdomain_router_spec.rb"
|
|
34
|
+
"spec/subdomain_router_spec.rb",
|
|
35
|
+
"subdomain_router.gemspec"
|
|
32
36
|
]
|
|
33
|
-
s.homepage = "http://github.com/RISCfuture/subdomain_router"
|
|
34
|
-
s.licenses = ["MIT"]
|
|
35
|
-
s.
|
|
36
|
-
s.
|
|
37
|
-
s.
|
|
37
|
+
s.homepage = "http://github.com/RISCfuture/subdomain_router".freeze
|
|
38
|
+
s.licenses = ["MIT".freeze]
|
|
39
|
+
s.rubygems_version = "2.6.6".freeze
|
|
40
|
+
s.summary = "[DEPRECATED] Use dynamic subdomains in your Rails website".freeze
|
|
41
|
+
s.post_install_message = <<~MSG
|
|
42
|
+
|
|
43
|
+
⚠️ DEPRECATED: subdomain_router is no longer maintained.
|
|
44
|
+
|
|
45
|
+
No longer maintained. Modern Rails has built-in subdomain routing constraints that cover the same use cases.
|
|
46
|
+
|
|
47
|
+
This is the final release. No further updates are planned.
|
|
48
|
+
|
|
49
|
+
MSG
|
|
38
50
|
|
|
39
51
|
if s.respond_to? :specification_version then
|
|
40
|
-
s.specification_version =
|
|
52
|
+
s.specification_version = 4
|
|
41
53
|
|
|
42
54
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
43
|
-
s.add_runtime_dependency(%q<rails
|
|
44
|
-
s.add_development_dependency(%q<rspec
|
|
45
|
-
s.add_development_dependency(%q<yard
|
|
46
|
-
s.add_development_dependency(%q<redcarpet
|
|
47
|
-
s.add_development_dependency(%q<bundler
|
|
48
|
-
s.add_development_dependency(%q<
|
|
55
|
+
s.add_runtime_dependency(%q<rails>.freeze, [">= 5.0.0"])
|
|
56
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
|
57
|
+
s.add_development_dependency(%q<yard>.freeze, [">= 0"])
|
|
58
|
+
s.add_development_dependency(%q<redcarpet>.freeze, [">= 0"])
|
|
59
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
|
60
|
+
s.add_development_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
49
61
|
else
|
|
50
|
-
s.add_dependency(%q<rails
|
|
51
|
-
s.add_dependency(%q<rspec
|
|
52
|
-
s.add_dependency(%q<yard
|
|
53
|
-
s.add_dependency(%q<redcarpet
|
|
54
|
-
s.add_dependency(%q<bundler
|
|
55
|
-
s.add_dependency(%q<
|
|
62
|
+
s.add_dependency(%q<rails>.freeze, [">= 5.0.0"])
|
|
63
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
64
|
+
s.add_dependency(%q<yard>.freeze, [">= 0"])
|
|
65
|
+
s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
|
|
66
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
67
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
56
68
|
end
|
|
57
69
|
else
|
|
58
|
-
s.add_dependency(%q<rails
|
|
59
|
-
s.add_dependency(%q<rspec
|
|
60
|
-
s.add_dependency(%q<yard
|
|
61
|
-
s.add_dependency(%q<redcarpet
|
|
62
|
-
s.add_dependency(%q<bundler
|
|
63
|
-
s.add_dependency(%q<
|
|
70
|
+
s.add_dependency(%q<rails>.freeze, [">= 5.0.0"])
|
|
71
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
72
|
+
s.add_dependency(%q<yard>.freeze, [">= 0"])
|
|
73
|
+
s.add_dependency(%q<redcarpet>.freeze, [">= 0"])
|
|
74
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
|
75
|
+
s.add_dependency(%q<juwelier>.freeze, [">= 0"])
|
|
64
76
|
end
|
|
65
77
|
end
|
|
66
78
|
|
metadata
CHANGED
|
@@ -1,110 +1,96 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: subdomain_router
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.2
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Tim Morgan
|
|
9
|
-
autorequire:
|
|
10
8
|
bindir: bin
|
|
11
9
|
cert_chain: []
|
|
12
|
-
date:
|
|
10
|
+
date: 2016-07-04 00:00:00.000000000 Z
|
|
13
11
|
dependencies:
|
|
14
12
|
- !ruby/object:Gem::Dependency
|
|
15
13
|
name: rails
|
|
16
14
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
15
|
requirements:
|
|
19
|
-
- -
|
|
16
|
+
- - ">="
|
|
20
17
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
18
|
+
version: 5.0.0
|
|
22
19
|
type: :runtime
|
|
23
20
|
prerelease: false
|
|
24
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
22
|
requirements:
|
|
27
|
-
- -
|
|
23
|
+
- - ">="
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
25
|
+
version: 5.0.0
|
|
30
26
|
- !ruby/object:Gem::Dependency
|
|
31
27
|
name: rspec
|
|
32
28
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
29
|
requirements:
|
|
35
|
-
- -
|
|
30
|
+
- - ">="
|
|
36
31
|
- !ruby/object:Gem::Version
|
|
37
32
|
version: '0'
|
|
38
33
|
type: :development
|
|
39
34
|
prerelease: false
|
|
40
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
36
|
requirements:
|
|
43
|
-
- -
|
|
37
|
+
- - ">="
|
|
44
38
|
- !ruby/object:Gem::Version
|
|
45
39
|
version: '0'
|
|
46
40
|
- !ruby/object:Gem::Dependency
|
|
47
41
|
name: yard
|
|
48
42
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
43
|
requirements:
|
|
51
|
-
- -
|
|
44
|
+
- - ">="
|
|
52
45
|
- !ruby/object:Gem::Version
|
|
53
46
|
version: '0'
|
|
54
47
|
type: :development
|
|
55
48
|
prerelease: false
|
|
56
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
50
|
requirements:
|
|
59
|
-
- -
|
|
51
|
+
- - ">="
|
|
60
52
|
- !ruby/object:Gem::Version
|
|
61
53
|
version: '0'
|
|
62
54
|
- !ruby/object:Gem::Dependency
|
|
63
55
|
name: redcarpet
|
|
64
56
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
57
|
requirements:
|
|
67
|
-
- -
|
|
58
|
+
- - ">="
|
|
68
59
|
- !ruby/object:Gem::Version
|
|
69
60
|
version: '0'
|
|
70
61
|
type: :development
|
|
71
62
|
prerelease: false
|
|
72
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
64
|
requirements:
|
|
75
|
-
- -
|
|
65
|
+
- - ">="
|
|
76
66
|
- !ruby/object:Gem::Version
|
|
77
67
|
version: '0'
|
|
78
68
|
- !ruby/object:Gem::Dependency
|
|
79
69
|
name: bundler
|
|
80
70
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
71
|
requirements:
|
|
83
|
-
- -
|
|
72
|
+
- - ">="
|
|
84
73
|
- !ruby/object:Gem::Version
|
|
85
74
|
version: '0'
|
|
86
75
|
type: :development
|
|
87
76
|
prerelease: false
|
|
88
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
78
|
requirements:
|
|
91
|
-
- -
|
|
79
|
+
- - ">="
|
|
92
80
|
- !ruby/object:Gem::Version
|
|
93
81
|
version: '0'
|
|
94
82
|
- !ruby/object:Gem::Dependency
|
|
95
|
-
name:
|
|
83
|
+
name: juwelier
|
|
96
84
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
85
|
requirements:
|
|
99
|
-
- -
|
|
86
|
+
- - ">="
|
|
100
87
|
- !ruby/object:Gem::Version
|
|
101
88
|
version: '0'
|
|
102
89
|
type: :development
|
|
103
90
|
prerelease: false
|
|
104
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
92
|
requirements:
|
|
107
|
-
- -
|
|
93
|
+
- - ">="
|
|
108
94
|
- !ruby/object:Gem::Version
|
|
109
95
|
version: '0'
|
|
110
96
|
description: This adds a routing constraint and controller methods to allow dynamic
|
|
@@ -116,9 +102,10 @@ extra_rdoc_files:
|
|
|
116
102
|
- LICENSE.txt
|
|
117
103
|
- README.md
|
|
118
104
|
files:
|
|
119
|
-
- .document
|
|
120
|
-
- .rspec
|
|
121
|
-
- .
|
|
105
|
+
- ".document"
|
|
106
|
+
- ".rspec"
|
|
107
|
+
- ".ruby-gemset"
|
|
108
|
+
- ".ruby-version"
|
|
122
109
|
- Gemfile
|
|
123
110
|
- Gemfile.lock
|
|
124
111
|
- LICENSE.txt
|
|
@@ -132,29 +119,31 @@ files:
|
|
|
132
119
|
homepage: http://github.com/RISCfuture/subdomain_router
|
|
133
120
|
licenses:
|
|
134
121
|
- MIT
|
|
135
|
-
|
|
122
|
+
metadata: {}
|
|
123
|
+
post_install_message: |2+
|
|
124
|
+
|
|
125
|
+
⚠️ DEPRECATED: subdomain_router is no longer maintained.
|
|
126
|
+
|
|
127
|
+
No longer maintained. Modern Rails has built-in subdomain routing constraints that cover the same use cases.
|
|
128
|
+
|
|
129
|
+
This is the final release. No further updates are planned.
|
|
130
|
+
|
|
136
131
|
rdoc_options: []
|
|
137
132
|
require_paths:
|
|
138
133
|
- lib
|
|
139
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
|
-
none: false
|
|
141
135
|
requirements:
|
|
142
|
-
- -
|
|
136
|
+
- - ">="
|
|
143
137
|
- !ruby/object:Gem::Version
|
|
144
138
|
version: '0'
|
|
145
|
-
segments:
|
|
146
|
-
- 0
|
|
147
|
-
hash: -4479704525159209868
|
|
148
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
|
-
none: false
|
|
150
140
|
requirements:
|
|
151
|
-
- -
|
|
141
|
+
- - ">="
|
|
152
142
|
- !ruby/object:Gem::Version
|
|
153
143
|
version: '0'
|
|
154
144
|
requirements: []
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
specification_version: 3
|
|
159
|
-
summary: Use dynamic subdomains in your Rails website
|
|
145
|
+
rubygems_version: 4.0.11
|
|
146
|
+
specification_version: 4
|
|
147
|
+
summary: "[DEPRECATED] Use dynamic subdomains in your Rails website"
|
|
160
148
|
test_files: []
|
|
149
|
+
...
|
data/.rvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
rvm 1.9.3@subdomain_router --create
|