sinatra-advanced-routes 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +27 -0
- data/README.md +4 -4
- data/lib/sinatra/advanced_routes.rb +2 -2
- data/spec/sinatra/advanced_routes_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- metadata +30 -15
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
copyright (c) 2010 Konstantin Haase. All rights reserved.
|
2
|
+
|
3
|
+
Developed by: Konstantin Haase
|
4
|
+
http://github.com/rkh/big_band
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to
|
8
|
+
deal with the Software without restriction, including without limitation the
|
9
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
1. Redistributions of source code must retain the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimers.
|
14
|
+
2. Redistributions in binary form must reproduce the above copyright
|
15
|
+
notice, this list of conditions and the following disclaimers in the
|
16
|
+
documentation and/or other materials provided with the distribution.
|
17
|
+
3. Neither the name of Konstantin Haase, nor the names of other contributors
|
18
|
+
may be used to endorse or promote products derived from this Software without
|
19
|
+
specific prior written permission.
|
20
|
+
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
27
|
+
WITH THE SOFTWARE.
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Route manipulation:
|
|
34
34
|
end
|
35
35
|
|
36
36
|
first_route = get "/:name" do
|
37
|
-
|
37
|
+
# stuff
|
38
38
|
end
|
39
39
|
|
40
40
|
other_route = get "/foo_:name" do
|
@@ -56,20 +56,20 @@ Route inspection:
|
|
56
56
|
puts route.verb # get / head / post / put / delete
|
57
57
|
puts route.file # "some_sinatra_app.rb" or something
|
58
58
|
puts route.line # the line number of the get/post/... statement
|
59
|
-
puts route.pattern # that's the pattern internally used by
|
59
|
+
puts route.pattern # that's the pattern internally used by sinatra
|
60
60
|
puts route.keys # keys given when route was defined
|
61
61
|
puts route.conditions # conditions given when route was defined
|
62
62
|
puts route.block # the route's closure
|
63
63
|
end
|
64
64
|
|
65
|
-
Some of that fields (like conditions or pattern) can be changed
|
65
|
+
Some of that fields (like conditions or pattern) can be changed, which will take immediate effect on the routing.
|
66
66
|
|
67
67
|
Usage with Sinatra::Base
|
68
68
|
------------------------
|
69
69
|
|
70
70
|
require "sinatra/base"
|
71
71
|
require "sinatra/advanced_routes"
|
72
|
-
|
72
|
+
|
73
73
|
class Foo < Sinatra::Base
|
74
74
|
register Sinatra::AdvancedRoutes
|
75
75
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "sinatra/base"
|
2
2
|
require "sinatra/sugar"
|
3
|
-
require "monkey"
|
3
|
+
require "monkey-lib"
|
4
4
|
|
5
5
|
module Sinatra
|
6
6
|
Base.ignore_caller
|
@@ -53,7 +53,7 @@ module Sinatra
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def active?
|
56
|
-
app.routes[verb].include? self
|
56
|
+
app.routes.include? verb and app.routes[verb].include? self
|
57
57
|
end
|
58
58
|
|
59
59
|
def activate(at_top = false)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "sinatra/rspec"
|
1
|
+
require "sinatra/rspec/shared"
|
2
2
|
require "sinatra/advanced_routes"
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-advanced-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Konstantin Haase
|
@@ -14,72 +15,81 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-07-09 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: monkey-lib
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
27
30
|
segments:
|
28
31
|
- 0
|
29
|
-
-
|
32
|
+
- 5
|
30
33
|
- 0
|
31
|
-
version: 0.
|
34
|
+
version: 0.5.0
|
32
35
|
type: :runtime
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
38
|
name: sinatra-sugar
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 11
|
41
46
|
segments:
|
42
47
|
- 0
|
43
|
-
-
|
48
|
+
- 5
|
44
49
|
- 0
|
45
|
-
version: 0.
|
50
|
+
version: 0.5.0
|
46
51
|
type: :runtime
|
47
52
|
version_requirements: *id002
|
48
53
|
- !ruby/object:Gem::Dependency
|
49
54
|
name: sinatra-test-helper
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 11
|
55
62
|
segments:
|
56
63
|
- 0
|
57
|
-
-
|
64
|
+
- 5
|
58
65
|
- 0
|
59
|
-
version: 0.
|
66
|
+
version: 0.5.0
|
60
67
|
type: :development
|
61
68
|
version_requirements: *id003
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: sinatra
|
64
71
|
prerelease: false
|
65
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
66
74
|
requirements:
|
67
|
-
- -
|
75
|
+
- - ~>
|
68
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 15
|
69
78
|
segments:
|
79
|
+
- 1
|
70
80
|
- 0
|
71
|
-
|
72
|
-
- 4
|
73
|
-
version: 0.9.4
|
81
|
+
version: "1.0"
|
74
82
|
type: :runtime
|
75
83
|
version_requirements: *id004
|
76
84
|
- !ruby/object:Gem::Dependency
|
77
85
|
name: rspec
|
78
86
|
prerelease: false
|
79
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
80
89
|
requirements:
|
81
90
|
- - ">="
|
82
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 27
|
83
93
|
segments:
|
84
94
|
- 1
|
85
95
|
- 3
|
@@ -100,6 +110,7 @@ files:
|
|
100
110
|
- spec/sinatra/advanced_routes_spec.rb
|
101
111
|
- spec/spec_helper.rb
|
102
112
|
- README.md
|
113
|
+
- LICENSE
|
103
114
|
has_rdoc: yard
|
104
115
|
homepage: http://github.com/rkh/sinatra-advanced-routes
|
105
116
|
licenses: []
|
@@ -110,23 +121,27 @@ rdoc_options: []
|
|
110
121
|
require_paths:
|
111
122
|
- lib
|
112
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
113
125
|
requirements:
|
114
126
|
- - ">="
|
115
127
|
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
116
129
|
segments:
|
117
130
|
- 0
|
118
131
|
version: "0"
|
119
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
120
134
|
requirements:
|
121
135
|
- - ">="
|
122
136
|
- !ruby/object:Gem::Version
|
137
|
+
hash: 3
|
123
138
|
segments:
|
124
139
|
- 0
|
125
140
|
version: "0"
|
126
141
|
requirements: []
|
127
142
|
|
128
143
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.3.
|
144
|
+
rubygems_version: 1.3.7
|
130
145
|
signing_key:
|
131
146
|
specification_version: 3
|
132
147
|
summary: Make Sinatra routes first class objects (part of BigBand).
|