vidibus-permalink 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/vidibus/permalink/dispatcher.rb +9 -5
- data/spec/vidibus/permalink/dispatcher_spec.rb +22 -0
- data/vidibus-permalink.gemspec +57 -29
- metadata +172 -23
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= vidibus-permalink
|
2
2
|
|
3
|
-
This gem allows changeable permalinks. That
|
3
|
+
This gem allows changeable permalinks. That may be an oxymoron, but it's really useful from a SEO perspective.
|
4
4
|
|
5
5
|
It is part of the open source SOA framework Vidibus: http://vidibus.org
|
6
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -7,10 +7,7 @@ module Vidibus
|
|
7
7
|
# Initialize a new Dispatcher instance.
|
8
8
|
# Provide an absolute +path+ to be dispatched.
|
9
9
|
def initialize(path)
|
10
|
-
|
11
|
-
raise PathError, "Path must be absolute."
|
12
|
-
end
|
13
|
-
@path = path
|
10
|
+
self.path = path
|
14
11
|
end
|
15
12
|
|
16
13
|
# Returns the path to dispatch.
|
@@ -18,9 +15,16 @@ module Vidibus
|
|
18
15
|
@path
|
19
16
|
end
|
20
17
|
|
18
|
+
# Sets path to dispatch
|
19
|
+
def path=(value)
|
20
|
+
raise PathError.new("Path must be absolute.") unless value.match(/^\//)
|
21
|
+
@path = value
|
22
|
+
end
|
23
|
+
|
21
24
|
# Returns parts of the path.
|
25
|
+
# Ignores file extension and request params
|
22
26
|
def parts
|
23
|
-
@parts ||= path.
|
27
|
+
@parts ||= path.gsub(/(\.[^\/]+)?(\?.*)?$/, "").scan(/[^?\/]+/)
|
24
28
|
end
|
25
29
|
|
26
30
|
# Returns permalink objects matching the parts.
|
@@ -30,10 +30,32 @@ describe "Vidibus::Permalink::Dispatcher" do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
describe "#path=" do
|
34
|
+
it "should set the request path" do
|
35
|
+
this.path = "/something/nasty"
|
36
|
+
this.path.should eql("/something/nasty")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
33
40
|
describe "#parts" do
|
34
41
|
it "should contain the parts of the given path" do
|
35
42
|
this.parts.should eql(%w[something pretty])
|
36
43
|
end
|
44
|
+
|
45
|
+
it "should deal with empty parts of path" do
|
46
|
+
this.path = "/something//pretty"
|
47
|
+
this.parts.should eql(%w[something pretty])
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should ignore params" do
|
51
|
+
this.path = "/something/pretty?hello=world"
|
52
|
+
this.parts.should eql(%w[something pretty])
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should ignore file extension" do
|
56
|
+
this.path = "/something/pretty?hello=world"
|
57
|
+
this.parts.should eql(%w[something pretty])
|
58
|
+
end
|
37
59
|
end
|
38
60
|
|
39
61
|
describe "#objects" do
|
data/vidibus-permalink.gemspec
CHANGED
@@ -1,55 +1,53 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vidibus-permalink}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andre Pankratz"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-12-07}
|
13
13
|
s.description = %q{Allows changeable permalinks (good for SEO).}
|
14
14
|
s.email = %q{andre@vidibus.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".bundle/config",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
"vidibus-permalink.gemspec"
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"app/models/permalink.rb",
|
30
|
+
"lib/vidibus-permalink.rb",
|
31
|
+
"lib/vidibus/permalink.rb",
|
32
|
+
"lib/vidibus/permalink/dispatcher.rb",
|
33
|
+
"lib/vidibus/permalink/mongoid.rb",
|
34
|
+
"spec/models.rb",
|
35
|
+
"spec/permalink_spec.rb",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"spec/vidibus/permalink/dispatcher_spec.rb",
|
38
|
+
"spec/vidibus/permalink/mongoid_spec.rb",
|
39
|
+
"vidibus-permalink.gemspec"
|
41
40
|
]
|
42
41
|
s.homepage = %q{http://github.com/vidibus/vidibus-permalink}
|
43
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
44
42
|
s.require_paths = ["lib"]
|
45
43
|
s.rubygems_version = %q{1.3.7}
|
46
44
|
s.summary = %q{Permalink handling}
|
47
45
|
s.test_files = [
|
48
46
|
"spec/models.rb",
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
"spec/permalink_spec.rb",
|
48
|
+
"spec/spec_helper.rb",
|
49
|
+
"spec/vidibus/permalink/dispatcher_spec.rb",
|
50
|
+
"spec/vidibus/permalink/mongoid_spec.rb"
|
53
51
|
]
|
54
52
|
|
55
53
|
if s.respond_to? :specification_version then
|
@@ -62,12 +60,32 @@ Gem::Specification.new do |s|
|
|
62
60
|
s.add_runtime_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
63
61
|
s.add_runtime_dependency(%q<vidibus-uuid>, [">= 0"])
|
64
62
|
s.add_runtime_dependency(%q<vidibus-words>, [">= 0"])
|
63
|
+
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
|
66
|
+
s.add_runtime_dependency(%q<rr>, [">= 0"])
|
67
|
+
s.add_runtime_dependency(%q<relevance-rcov>, [">= 0"])
|
68
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
|
69
|
+
s.add_runtime_dependency(%q<mongoid>, ["~> 2.0.0.beta.20"])
|
70
|
+
s.add_runtime_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
71
|
+
s.add_runtime_dependency(%q<vidibus-uuid>, [">= 0"])
|
72
|
+
s.add_runtime_dependency(%q<vidibus-words>, [">= 0"])
|
65
73
|
else
|
66
74
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
67
75
|
s.add_dependency(%q<mongoid>, ["~> 2.0.0.beta.20"])
|
68
76
|
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
69
77
|
s.add_dependency(%q<vidibus-uuid>, [">= 0"])
|
70
78
|
s.add_dependency(%q<vidibus-words>, [">= 0"])
|
79
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
80
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
81
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
|
82
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
83
|
+
s.add_dependency(%q<relevance-rcov>, [">= 0"])
|
84
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
85
|
+
s.add_dependency(%q<mongoid>, ["~> 2.0.0.beta.20"])
|
86
|
+
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
87
|
+
s.add_dependency(%q<vidibus-uuid>, [">= 0"])
|
88
|
+
s.add_dependency(%q<vidibus-words>, [">= 0"])
|
71
89
|
end
|
72
90
|
else
|
73
91
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
@@ -75,6 +93,16 @@ Gem::Specification.new do |s|
|
|
75
93
|
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
76
94
|
s.add_dependency(%q<vidibus-uuid>, [">= 0"])
|
77
95
|
s.add_dependency(%q<vidibus-words>, [">= 0"])
|
96
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
97
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
98
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
|
99
|
+
s.add_dependency(%q<rr>, [">= 0"])
|
100
|
+
s.add_dependency(%q<relevance-rcov>, [">= 0"])
|
101
|
+
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
102
|
+
s.add_dependency(%q<mongoid>, ["~> 2.0.0.beta.20"])
|
103
|
+
s.add_dependency(%q<vidibus-core_extensions>, [">= 0"])
|
104
|
+
s.add_dependency(%q<vidibus-uuid>, [">= 0"])
|
105
|
+
s.add_dependency(%q<vidibus-words>, [">= 0"])
|
78
106
|
end
|
79
107
|
end
|
80
108
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-permalink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andre Pankratz
|
@@ -15,13 +15,14 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-07 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
|
24
|
+
name: rails
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
27
28
|
- - ~>
|
@@ -32,12 +33,12 @@ dependencies:
|
|
32
33
|
- 0
|
33
34
|
- 0
|
34
35
|
version: 3.0.0
|
35
|
-
|
36
|
-
version_requirements: *id001
|
36
|
+
requirement: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
38
|
+
type: :runtime
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
name: mongoid
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
43
44
|
- - ~>
|
@@ -50,12 +51,26 @@ dependencies:
|
|
50
51
|
- beta
|
51
52
|
- 20
|
52
53
|
version: 2.0.0.beta.20
|
53
|
-
|
54
|
-
version_requirements: *id002
|
54
|
+
requirement: *id002
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
56
58
|
name: vidibus-core_extensions
|
59
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirement: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :runtime
|
57
71
|
prerelease: false
|
58
|
-
|
72
|
+
name: vidibus-uuid
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
59
74
|
none: false
|
60
75
|
requirements:
|
61
76
|
- - ">="
|
@@ -64,12 +79,26 @@ dependencies:
|
|
64
79
|
segments:
|
65
80
|
- 0
|
66
81
|
version: "0"
|
82
|
+
requirement: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
67
84
|
type: :runtime
|
68
|
-
|
85
|
+
prerelease: false
|
86
|
+
name: vidibus-words
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirement: *id005
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
|
-
|
98
|
+
type: :runtime
|
71
99
|
prerelease: false
|
72
|
-
|
100
|
+
name: jeweler
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
73
102
|
none: false
|
74
103
|
requirements:
|
75
104
|
- - ">="
|
@@ -78,12 +107,58 @@ dependencies:
|
|
78
107
|
segments:
|
79
108
|
- 0
|
80
109
|
version: "0"
|
110
|
+
requirement: *id006
|
111
|
+
- !ruby/object:Gem::Dependency
|
81
112
|
type: :runtime
|
82
|
-
|
113
|
+
prerelease: false
|
114
|
+
name: rake
|
115
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
requirement: *id007
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
|
-
|
126
|
+
type: :runtime
|
127
|
+
prerelease: false
|
128
|
+
name: rspec
|
129
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ~>
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
hash: 62196427
|
135
|
+
segments:
|
136
|
+
- 2
|
137
|
+
- 0
|
138
|
+
- 0
|
139
|
+
- beta
|
140
|
+
- 20
|
141
|
+
version: 2.0.0.beta.20
|
142
|
+
requirement: *id008
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
type: :runtime
|
145
|
+
prerelease: false
|
146
|
+
name: rr
|
147
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
hash: 3
|
153
|
+
segments:
|
154
|
+
- 0
|
155
|
+
version: "0"
|
156
|
+
requirement: *id009
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
type: :runtime
|
85
159
|
prerelease: false
|
86
|
-
|
160
|
+
name: relevance-rcov
|
161
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
87
162
|
none: false
|
88
163
|
requirements:
|
89
164
|
- - ">="
|
@@ -92,8 +167,83 @@ dependencies:
|
|
92
167
|
segments:
|
93
168
|
- 0
|
94
169
|
version: "0"
|
170
|
+
requirement: *id010
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
type: :runtime
|
173
|
+
prerelease: false
|
174
|
+
name: rails
|
175
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
177
|
+
requirements:
|
178
|
+
- - ~>
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
hash: 7
|
181
|
+
segments:
|
182
|
+
- 3
|
183
|
+
- 0
|
184
|
+
- 0
|
185
|
+
version: 3.0.0
|
186
|
+
requirement: *id011
|
187
|
+
- !ruby/object:Gem::Dependency
|
95
188
|
type: :runtime
|
96
|
-
|
189
|
+
prerelease: false
|
190
|
+
name: mongoid
|
191
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
192
|
+
none: false
|
193
|
+
requirements:
|
194
|
+
- - ~>
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
hash: 62196427
|
197
|
+
segments:
|
198
|
+
- 2
|
199
|
+
- 0
|
200
|
+
- 0
|
201
|
+
- beta
|
202
|
+
- 20
|
203
|
+
version: 2.0.0.beta.20
|
204
|
+
requirement: *id012
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
type: :runtime
|
207
|
+
prerelease: false
|
208
|
+
name: vidibus-core_extensions
|
209
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
210
|
+
none: false
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
hash: 3
|
215
|
+
segments:
|
216
|
+
- 0
|
217
|
+
version: "0"
|
218
|
+
requirement: *id013
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
type: :runtime
|
221
|
+
prerelease: false
|
222
|
+
name: vidibus-uuid
|
223
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
224
|
+
none: false
|
225
|
+
requirements:
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
hash: 3
|
229
|
+
segments:
|
230
|
+
- 0
|
231
|
+
version: "0"
|
232
|
+
requirement: *id014
|
233
|
+
- !ruby/object:Gem::Dependency
|
234
|
+
type: :runtime
|
235
|
+
prerelease: false
|
236
|
+
name: vidibus-words
|
237
|
+
version_requirements: &id015 !ruby/object:Gem::Requirement
|
238
|
+
none: false
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
hash: 3
|
243
|
+
segments:
|
244
|
+
- 0
|
245
|
+
version: "0"
|
246
|
+
requirement: *id015
|
97
247
|
description: Allows changeable permalinks (good for SEO).
|
98
248
|
email: andre@vidibus.com
|
99
249
|
executables: []
|
@@ -106,7 +256,6 @@ extra_rdoc_files:
|
|
106
256
|
files:
|
107
257
|
- .bundle/config
|
108
258
|
- .document
|
109
|
-
- .gitignore
|
110
259
|
- .rspec
|
111
260
|
- Gemfile
|
112
261
|
- Gemfile.lock
|
@@ -130,8 +279,8 @@ homepage: http://github.com/vidibus/vidibus-permalink
|
|
130
279
|
licenses: []
|
131
280
|
|
132
281
|
post_install_message:
|
133
|
-
rdoc_options:
|
134
|
-
|
282
|
+
rdoc_options: []
|
283
|
+
|
135
284
|
require_paths:
|
136
285
|
- lib
|
137
286
|
required_ruby_version: !ruby/object:Gem::Requirement
|