projectdx-subdomain_routes 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +7 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +40 -0
- data/LICENSE +20 -0
- data/README.textile +421 -0
- data/Rakefile +59 -0
- data/VERSION.yml +5 -0
- data/history.txt +18 -0
- data/lib/subdomain_routes.rb +13 -0
- data/lib/subdomain_routes/assertions.rb +68 -0
- data/lib/subdomain_routes/config.rb +5 -0
- data/lib/subdomain_routes/mapper.rb +43 -0
- data/lib/subdomain_routes/request.rb +11 -0
- data/lib/subdomain_routes/resources.rb +49 -0
- data/lib/subdomain_routes/routes.rb +97 -0
- data/lib/subdomain_routes/split_host.rb +32 -0
- data/lib/subdomain_routes/url_writer.rb +92 -0
- data/lib/subdomain_routes/validations.rb +42 -0
- data/rails/init.rb +1 -0
- data/spec/assertions_spec.rb +193 -0
- data/spec/extraction_spec.rb +73 -0
- data/spec/mapping_spec.rb +168 -0
- data/spec/recognition_spec.rb +78 -0
- data/spec/resources_spec.rb +33 -0
- data/spec/routes_spec.rb +13 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/test_unit_matcher.rb +46 -0
- data/spec/url_writing_spec.rb +262 -0
- data/spec/validations_spec.rb +27 -0
- data/subdomain_routes.gemspec +85 -0
- metadata +124 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
describe "ActiveRecord::Base" do
|
2
|
+
before(:each) do
|
3
|
+
class User < ActiveRecord::Base
|
4
|
+
attr_accessor :subdomain
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have validates_subdomain_format_of which runs SubdomainRoutes.valid_subdomain? against the attributes" do
|
9
|
+
User.validates_subdomain_format_of :subdomain
|
10
|
+
SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(true)
|
11
|
+
User.new(:subdomain => "mholling").should be_valid
|
12
|
+
SubdomainRoutes.should_receive(:valid_subdomain?).with("mholling").and_return(nil)
|
13
|
+
User.new(:subdomain => "mholling").should_not be_valid
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have validates_subdomain_not_reserved which checks the attributes against the fixed-subdomain routes" do
|
17
|
+
User.validates_subdomain_not_reserved :subdomain
|
18
|
+
reserved = [ "", "www", "support", "admin" ]
|
19
|
+
map_subdomain(*reserved) { |map| map.resource :home }
|
20
|
+
reserved.each do |subdomain|
|
21
|
+
User.new(:subdomain => subdomain).should_not be_valid
|
22
|
+
end
|
23
|
+
[ "mholling", "edmondst" ].each do |subdomain|
|
24
|
+
User.new(:subdomain => subdomain).should be_valid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
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{subdomain_routes}
|
8
|
+
s.version = "0.3.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Matthew Hollingworth"]
|
12
|
+
s.date = %q{2009-10-10}
|
13
|
+
s.description = %q{ SubdomainRoutes add subdomain conditions to the Rails routing system. Routes may be restricted to
|
14
|
+
one or many specified subdomains. An URL will be recognised only if the host subdomain matches the
|
15
|
+
subdomain specified in the route. Route generation is also enhanced, so that the subdomain of a
|
16
|
+
generated URL (or path) will be changed if the requested route has a different subdomain to that of
|
17
|
+
the current request. Model-based subdomain routes can also be defined.
|
18
|
+
}
|
19
|
+
s.email = %q{mdholling@gmail.com}
|
20
|
+
s.extra_rdoc_files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README.textile"
|
23
|
+
]
|
24
|
+
s.files = [
|
25
|
+
".document",
|
26
|
+
".gitignore",
|
27
|
+
"LICENSE",
|
28
|
+
"README.textile",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION.yml",
|
31
|
+
"history.txt",
|
32
|
+
"lib/subdomain_routes.rb",
|
33
|
+
"lib/subdomain_routes/assertions.rb",
|
34
|
+
"lib/subdomain_routes/config.rb",
|
35
|
+
"lib/subdomain_routes/mapper.rb",
|
36
|
+
"lib/subdomain_routes/request.rb",
|
37
|
+
"lib/subdomain_routes/resources.rb",
|
38
|
+
"lib/subdomain_routes/routes.rb",
|
39
|
+
"lib/subdomain_routes/split_host.rb",
|
40
|
+
"lib/subdomain_routes/url_writer.rb",
|
41
|
+
"lib/subdomain_routes/validations.rb",
|
42
|
+
"rails/init.rb",
|
43
|
+
"spec/assertions_spec.rb",
|
44
|
+
"spec/extraction_spec.rb",
|
45
|
+
"spec/mapping_spec.rb",
|
46
|
+
"spec/recognition_spec.rb",
|
47
|
+
"spec/resources_spec.rb",
|
48
|
+
"spec/routes_spec.rb",
|
49
|
+
"spec/spec_helper.rb",
|
50
|
+
"spec/test_unit_matcher.rb",
|
51
|
+
"spec/url_writing_spec.rb",
|
52
|
+
"spec/validations_spec.rb",
|
53
|
+
"subdomain_routes.gemspec"
|
54
|
+
]
|
55
|
+
s.homepage = %q{http://github.com/mholling/subdomain_routes}
|
56
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
57
|
+
s.require_paths = ["lib"]
|
58
|
+
s.rubygems_version = %q{1.3.5}
|
59
|
+
s.summary = %q{A Rails library for incorporating subdomains into route generation and recognition.}
|
60
|
+
s.test_files = [
|
61
|
+
"spec/assertions_spec.rb",
|
62
|
+
"spec/extraction_spec.rb",
|
63
|
+
"spec/mapping_spec.rb",
|
64
|
+
"spec/recognition_spec.rb",
|
65
|
+
"spec/resources_spec.rb",
|
66
|
+
"spec/routes_spec.rb",
|
67
|
+
"spec/spec_helper.rb",
|
68
|
+
"spec/test_unit_matcher.rb",
|
69
|
+
"spec/url_writing_spec.rb",
|
70
|
+
"spec/validations_spec.rb"
|
71
|
+
]
|
72
|
+
|
73
|
+
if s.respond_to? :specification_version then
|
74
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
75
|
+
s.specification_version = 3
|
76
|
+
|
77
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
78
|
+
s.add_runtime_dependency(%q<actionpack>, [">= 2.2.1"])
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<actionpack>, [">= 2.2.1"])
|
81
|
+
end
|
82
|
+
else
|
83
|
+
s.add_dependency(%q<actionpack>, [">= 2.2.1"])
|
84
|
+
end
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: projectdx-subdomain_routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Matthew Hollingworth
|
14
|
+
- ProjectDX
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-09-22 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: actionpack
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 17
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 3
|
34
|
+
- 9
|
35
|
+
version: 2.3.9
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: " SubdomainRoutes add subdomain conditions to the Rails routing system. Routes may be restricted to\n one or many specified subdomains. An URL will be recognised only if the host subdomain matches the\n subdomain specified in the route. Route generation is also enhanced, so that the subdomain of a\n generated URL (or path) will be changed if the requested route has a different subdomain to that of\n the current request. Model-based subdomain routes can also be defined.\n"
|
39
|
+
email: devteam@projectdx.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE
|
46
|
+
- README.textile
|
47
|
+
files:
|
48
|
+
- .document
|
49
|
+
- .gitignore
|
50
|
+
- .rvmrc
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE
|
54
|
+
- README.textile
|
55
|
+
- Rakefile
|
56
|
+
- VERSION.yml
|
57
|
+
- history.txt
|
58
|
+
- lib/subdomain_routes.rb
|
59
|
+
- lib/subdomain_routes/assertions.rb
|
60
|
+
- lib/subdomain_routes/config.rb
|
61
|
+
- lib/subdomain_routes/mapper.rb
|
62
|
+
- lib/subdomain_routes/request.rb
|
63
|
+
- lib/subdomain_routes/resources.rb
|
64
|
+
- lib/subdomain_routes/routes.rb
|
65
|
+
- lib/subdomain_routes/split_host.rb
|
66
|
+
- lib/subdomain_routes/url_writer.rb
|
67
|
+
- lib/subdomain_routes/validations.rb
|
68
|
+
- rails/init.rb
|
69
|
+
- spec/assertions_spec.rb
|
70
|
+
- spec/extraction_spec.rb
|
71
|
+
- spec/mapping_spec.rb
|
72
|
+
- spec/recognition_spec.rb
|
73
|
+
- spec/resources_spec.rb
|
74
|
+
- spec/routes_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- spec/test_unit_matcher.rb
|
77
|
+
- spec/url_writing_spec.rb
|
78
|
+
- spec/validations_spec.rb
|
79
|
+
- subdomain_routes.gemspec
|
80
|
+
has_rdoc: true
|
81
|
+
homepage: http://github.com/projectdx/subdomain_routes
|
82
|
+
licenses: []
|
83
|
+
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- --charset=UTF-8
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
version: "0"
|
107
|
+
requirements: []
|
108
|
+
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.3.7
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: A Rails library for incorporating subdomains into route generation and recognition.
|
114
|
+
test_files:
|
115
|
+
- spec/assertions_spec.rb
|
116
|
+
- spec/extraction_spec.rb
|
117
|
+
- spec/mapping_spec.rb
|
118
|
+
- spec/recognition_spec.rb
|
119
|
+
- spec/resources_spec.rb
|
120
|
+
- spec/routes_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
- spec/test_unit_matcher.rb
|
123
|
+
- spec/url_writing_spec.rb
|
124
|
+
- spec/validations_spec.rb
|