sinatra-advanced-routes 0.4.0.a → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +26 -0
  2. data/spec/spec_helper.rb +0 -2
  3. metadata +67 -34
data/README.md CHANGED
@@ -9,9 +9,16 @@ BigBand
9
9
  Sinatra::AdvancedRoutes is part of the [BigBand](http://github.com/rkh/big_band) stack.
10
10
  Check it out if you are looking for other fancy Sinatra extensions.
11
11
 
12
+ Installation
13
+ ------------
14
+
15
+ gem install sinatra-advanced-routes
16
+
12
17
  Example
13
18
  -------
14
19
 
20
+ Route manipulation:
21
+
15
22
  require "sinatra"
16
23
  require "sinatra/advanced_routes"
17
24
 
@@ -38,6 +45,25 @@ Example
38
45
  # have gotten, since it has been defined first. But wait, we can fix this!
39
46
  other_route.promote
40
47
 
48
+ Route inspection:
49
+
50
+ require "some_sinatra_app"
51
+
52
+ SomeSinatraApp.each_route do |route|
53
+ puts "-"*20
54
+ puts route.app.name # "SomeSinatraApp"
55
+ puts route.path # that's the path given as argument to get and akin
56
+ puts route.verb # get / head / post / put / delete
57
+ puts route.file # "some_sinatra_app.rb" or something
58
+ puts route.line # the line number of the get/post/... statement
59
+ puts route.pattern # that's the pattern internally used by
60
+ puts route.keys # keys given when route was defined
61
+ puts route.conditions # conditions given when route was defined
62
+ puts route.block # the route's closure
63
+ end
64
+
65
+ Some of that fields (like conditions or pattern) can be changed (will take effect on the routing).
66
+
41
67
  Usage with Sinatra::Base
42
68
  ------------------------
43
69
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,2 @@
1
1
  require "sinatra/rspec"
2
2
  require "sinatra/advanced_routes"
3
- require "monkey"
4
- Sinatra::Base.set :environment, :test
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-advanced-routes
3
- version: &id001 !ruby/object:Gem::Version
4
- version: 0.4.0.a
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Konstantin Haase
@@ -9,56 +14,82 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-17 00:00:00 +01:00
17
+ date: 2010-04-13 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: monkey-lib
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
- - - "="
22
- - *id001
23
- version:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 4
30
+ - 0
31
+ - 0
32
+ version: 0.4.0.0
33
+ type: :runtime
34
+ version_requirements: *id001
24
35
  - !ruby/object:Gem::Dependency
25
36
  name: sinatra-sugar
26
- type: :runtime
27
- version_requirement:
28
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
29
39
  requirements:
30
- - - "="
31
- - *id001
32
- version:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 4
45
+ - 0
46
+ - 0
47
+ version: 0.4.0.0
48
+ type: :runtime
49
+ version_requirements: *id002
33
50
  - !ruby/object:Gem::Dependency
34
51
  name: sinatra-test-helper
35
- type: :development
36
- version_requirement:
37
- version_requirements: !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
38
54
  requirements:
39
- - - "="
40
- - *id001
41
- version:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ - 4
60
+ - 0
61
+ - 0
62
+ version: 0.4.0.0
63
+ type: :development
64
+ version_requirements: *id003
42
65
  - !ruby/object:Gem::Dependency
43
66
  name: sinatra
44
- type: :runtime
45
- version_requirement:
46
- version_requirements: !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
47
69
  requirements:
48
70
  - - ">="
49
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ - 9
75
+ - 4
50
76
  version: 0.9.4
51
- version:
77
+ type: :runtime
78
+ version_requirements: *id004
52
79
  - !ruby/object:Gem::Dependency
53
80
  name: rspec
54
- type: :development
55
- version_requirement:
56
- version_requirements: !ruby/object:Gem::Requirement
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
57
83
  requirements:
58
84
  - - ">="
59
85
  - !ruby/object:Gem::Version
86
+ segments:
87
+ - 1
88
+ - 3
89
+ - 0
60
90
  version: 1.3.0
61
- version:
91
+ type: :development
92
+ version_requirements: *id005
62
93
  description: Make Sinatra routes first class objects (part of BigBand).
63
94
  email: konstantin.mailinglists@googlemail.com
64
95
  executables: []
@@ -85,18 +116,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
116
  requirements:
86
117
  - - ">="
87
118
  - !ruby/object:Gem::Version
119
+ segments:
120
+ - 0
88
121
  version: "0"
89
- version:
90
122
  required_rubygems_version: !ruby/object:Gem::Requirement
91
123
  requirements:
92
- - - ">"
124
+ - - ">="
93
125
  - !ruby/object:Gem::Version
94
- version: 1.3.1
95
- version:
126
+ segments:
127
+ - 0
128
+ version: "0"
96
129
  requirements: []
97
130
 
98
131
  rubyforge_project:
99
- rubygems_version: 1.3.5
132
+ rubygems_version: 1.3.6
100
133
  signing_key:
101
134
  specification_version: 3
102
135
  summary: Make Sinatra routes first class objects (part of BigBand).