ghazel-subdomain_routes 0.3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.textile +420 -0
- data/Rakefile +59 -0
- data/VERSION.yml +4 -0
- data/history.txt +23 -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 +83 -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 +121 -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", "2girls1cup" ].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{ghazel-subdomain_routes}
|
8
|
+
s.version = "0.3.1.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.3.9"])
|
79
|
+
else
|
80
|
+
s.add_dependency(%q<actionpack>, [">= 2.3.9"])
|
81
|
+
end
|
82
|
+
else
|
83
|
+
s.add_dependency(%q<actionpack>, [">= 2.3.9"])
|
84
|
+
end
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghazel-subdomain_routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 81
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 1
|
10
|
+
- 1
|
11
|
+
version: 0.3.1.1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Matthew Hollingworth
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2009-10-10 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: mdholling@gmail.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE
|
46
|
+
- README.textile
|
47
|
+
files:
|
48
|
+
- .document
|
49
|
+
- .gitignore
|
50
|
+
- LICENSE
|
51
|
+
- README.textile
|
52
|
+
- Rakefile
|
53
|
+
- VERSION.yml
|
54
|
+
- history.txt
|
55
|
+
- lib/subdomain_routes.rb
|
56
|
+
- lib/subdomain_routes/assertions.rb
|
57
|
+
- lib/subdomain_routes/config.rb
|
58
|
+
- lib/subdomain_routes/mapper.rb
|
59
|
+
- lib/subdomain_routes/request.rb
|
60
|
+
- lib/subdomain_routes/resources.rb
|
61
|
+
- lib/subdomain_routes/routes.rb
|
62
|
+
- lib/subdomain_routes/split_host.rb
|
63
|
+
- lib/subdomain_routes/url_writer.rb
|
64
|
+
- lib/subdomain_routes/validations.rb
|
65
|
+
- rails/init.rb
|
66
|
+
- spec/assertions_spec.rb
|
67
|
+
- spec/extraction_spec.rb
|
68
|
+
- spec/mapping_spec.rb
|
69
|
+
- spec/recognition_spec.rb
|
70
|
+
- spec/resources_spec.rb
|
71
|
+
- spec/routes_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
- spec/test_unit_matcher.rb
|
74
|
+
- spec/url_writing_spec.rb
|
75
|
+
- spec/validations_spec.rb
|
76
|
+
- subdomain_routes.gemspec
|
77
|
+
has_rdoc: true
|
78
|
+
homepage: http://github.com/mholling/subdomain_routes
|
79
|
+
licenses: []
|
80
|
+
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options:
|
83
|
+
- --charset=UTF-8
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
hash: 3
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
requirements: []
|
105
|
+
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.4.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: A Rails library for incorporating subdomains into route generation and recognition.
|
111
|
+
test_files:
|
112
|
+
- spec/assertions_spec.rb
|
113
|
+
- spec/extraction_spec.rb
|
114
|
+
- spec/mapping_spec.rb
|
115
|
+
- spec/recognition_spec.rb
|
116
|
+
- spec/resources_spec.rb
|
117
|
+
- spec/routes_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
- spec/test_unit_matcher.rb
|
120
|
+
- spec/url_writing_spec.rb
|
121
|
+
- spec/validations_spec.rb
|