goncalossilva-subdomain_routes 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/LICENSE +20 -0
- data/README.textile +431 -0
- data/Rakefile +59 -0
- data/VERSION.yml +5 -0
- data/history.txt +21 -0
- data/lib/subdomain_routes.rb +13 -0
- data/lib/subdomain_routes/assertions.rb +68 -0
- data/lib/subdomain_routes/config.rb +6 -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 +47 -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 +86 -0
- metadata +94 -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,86 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{subdomain_routes}
|
8
|
+
s.version = "0.3.2"
|
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{2010-09-08}
|
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.7}
|
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::VERSION) >= 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
|
86
|
+
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: goncalossilva-subdomain_routes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matthew Hollingworth
|
9
|
+
- Akihiro Matsumura
|
10
|
+
- Goncalo Silva
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2011-06-15 00:00:00.000000000 +01:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: actionpack
|
19
|
+
requirement: &2160838520 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.3.9
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: *2160838520
|
28
|
+
description: ! " SubdomainRoutes add subdomain conditions to the Rails routing
|
29
|
+
system. Routes may be restricted to\n one or many specified subdomains. An
|
30
|
+
URL will be recognised only if the host subdomain matches the\n subdomain specified
|
31
|
+
in the route. Route generation is also enhanced, so that the subdomain of a\n generated
|
32
|
+
URL (or path) will be changed if the requested route has a different subdomain to
|
33
|
+
that of\n the current request. Model-based subdomain routes can also be defined.\n"
|
34
|
+
email: goncalossilva@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files:
|
38
|
+
- LICENSE
|
39
|
+
- README.textile
|
40
|
+
files:
|
41
|
+
- .document
|
42
|
+
- LICENSE
|
43
|
+
- README.textile
|
44
|
+
- Rakefile
|
45
|
+
- VERSION.yml
|
46
|
+
- history.txt
|
47
|
+
- lib/subdomain_routes.rb
|
48
|
+
- lib/subdomain_routes/assertions.rb
|
49
|
+
- lib/subdomain_routes/config.rb
|
50
|
+
- lib/subdomain_routes/mapper.rb
|
51
|
+
- lib/subdomain_routes/request.rb
|
52
|
+
- lib/subdomain_routes/resources.rb
|
53
|
+
- lib/subdomain_routes/routes.rb
|
54
|
+
- lib/subdomain_routes/split_host.rb
|
55
|
+
- lib/subdomain_routes/url_writer.rb
|
56
|
+
- lib/subdomain_routes/validations.rb
|
57
|
+
- rails/init.rb
|
58
|
+
- spec/assertions_spec.rb
|
59
|
+
- spec/extraction_spec.rb
|
60
|
+
- spec/mapping_spec.rb
|
61
|
+
- spec/recognition_spec.rb
|
62
|
+
- spec/resources_spec.rb
|
63
|
+
- spec/routes_spec.rb
|
64
|
+
- spec/spec_helper.rb
|
65
|
+
- spec/test_unit_matcher.rb
|
66
|
+
- spec/url_writing_spec.rb
|
67
|
+
- spec/validations_spec.rb
|
68
|
+
- subdomain_routes.gemspec
|
69
|
+
has_rdoc: true
|
70
|
+
homepage: http://github.com/goncalossilva/subdomain_routes
|
71
|
+
licenses: []
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.6.2
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: A Rails library for incorporating subdomains into route generation and recognition.
|
94
|
+
test_files: []
|