Capcode 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -0
- data/doc/rdoc/classes/Capcode.html +486 -439
- data/doc/rdoc/classes/Capcode/Configuration.html +28 -28
- data/doc/rdoc/classes/Capcode/Helpers.html +93 -63
- data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +26 -2
- data/doc/rdoc/files/lib/capcode/configuration_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/filters_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode_rb.html +4 -1
- data/doc/rdoc/fr_method_index.html +17 -15
- data/examples/rest-run.rb +1 -1
- data/examples/rest.log +70 -0
- data/examples/rest.rb +4 -3
- data/examples/rest.ru +1 -1
- data/lib/capcode.rb +41 -8
- data/lib/capcode/configuration.rb +2 -2
- data/lib/capcode/filters.rb +7 -1
- data/lib/capcode/version.rb +1 -1
- metadata +5 -4
@@ -111,7 +111,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
111
111
|
<h3 class="section-bar">Methods</h3>
|
112
112
|
|
113
113
|
<div class="name-list">
|
114
|
-
<a href="#
|
114
|
+
<a href="#M000024">http_authentication</a>
|
115
115
|
</div>
|
116
116
|
</div>
|
117
117
|
|
@@ -133,11 +133,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
133
133
|
<div id="methods">
|
134
134
|
<h3 class="section-bar">Public Instance methods</h3>
|
135
135
|
|
136
|
-
<div id="method-
|
137
|
-
<a name="
|
136
|
+
<div id="method-M000024" class="method-detail">
|
137
|
+
<a name="M000024"></a>
|
138
138
|
|
139
139
|
<div class="method-heading">
|
140
|
-
<a href="#
|
140
|
+
<a href="#M000024" class="method-signature">
|
141
141
|
<span class="method-name">http_authentication</span><span class="method-args">( opts = {}, &b )</span>
|
142
142
|
</a>
|
143
143
|
</div>
|
@@ -173,8 +173,8 @@ The block must return a Hash of username => password like that :
|
|
173
173
|
}
|
174
174
|
</pre>
|
175
175
|
<p><a class="source-toggle" href="#"
|
176
|
-
onclick="toggleCode('
|
177
|
-
<div class="method-source-code" id="
|
176
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
177
|
+
<div class="method-source-code" id="M000024-source">
|
178
178
|
<pre>
|
179
179
|
<span class="ruby-comment cmt"># File lib/capcode/helpers/auth.rb, line 105</span>
|
180
180
|
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_authentication</span>( <span class="ruby-identifier">opts</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span> )
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Wed,
|
1
|
+
Wed, 15 Sep 2010 14:22:01 +0200
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Wed
|
59
|
+
<td>Wed Sep 15 13:59:53 +0200 2010</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -91,6 +91,30 @@ href="http://www.algorithmique.net/capcode">www.algorithmique.net/capcode</a>/
|
|
91
91
|
<a href="../classes/Capcode.html">Capcode</a> is a web microframework
|
92
92
|
</p>
|
93
93
|
<h2>FEATURES/PROBLEMS:</h2>
|
94
|
+
<h3>0.9.8</h3>
|
95
|
+
<ul>
|
96
|
+
<li>Add "any" to easly replace an <tt>alias_method :post, :get</tt>
|
97
|
+
|
98
|
+
</li>
|
99
|
+
<li>Bug correction in Filter : actions are now executed in the order they are
|
100
|
+
declared
|
101
|
+
|
102
|
+
</li>
|
103
|
+
<li>Filters execution stop at the first non nul response
|
104
|
+
|
105
|
+
</li>
|
106
|
+
<li>Add "log" helper
|
107
|
+
|
108
|
+
</li>
|
109
|
+
<li>Add <a href="http://unicorn.bogomips.org/">Unicorn</a> and <a
|
110
|
+
href="http://rainbows.rubyforge.org/">Rainbows</a> supports
|
111
|
+
(<b>EXPERIMENTAL</b>)
|
112
|
+
|
113
|
+
</li>
|
114
|
+
<li>Add —server option
|
115
|
+
|
116
|
+
</li>
|
117
|
+
</ul>
|
94
118
|
<h3>0.9.7</h3>
|
95
119
|
<ul>
|
96
120
|
<li>Major bug correction in Capcode.URL
|
@@ -254,7 +278,7 @@ renderer
|
|
254
278
|
<li>Add :content_type option to renderers (see render-image.rb)
|
255
279
|
|
256
280
|
</li>
|
257
|
-
<li>Add <a href="../classes/Capcode.html#
|
281
|
+
<li>Add <a href="../classes/Capcode.html#M000013">Capcode.set</a> for
|
258
282
|
configuration. So Capcode::Herpers#erb_path=, Capcode::Herpers#sass_path=
|
259
283
|
and Capcode::Herpers#haml_path= are deprecated, you must now use `set :erb,
|
260
284
|
…’, `set :sass, …’ and `set :haml, …’
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Wed
|
59
|
+
<td>Wed Sep 15 14:11:05 +0200 2010</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -93,6 +93,9 @@ Please read the README.rdoc file !
|
|
93
93
|
capcode/filters
|
94
94
|
capcode/ext/rack/urlmap
|
95
95
|
mongrel
|
96
|
+
unicorn/launcher
|
97
|
+
unicorn/launcher
|
98
|
+
rainbows
|
96
99
|
</div>
|
97
100
|
</div>
|
98
101
|
|
@@ -21,30 +21,32 @@
|
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
23
|
<a href="classes/Capcode.html#M000001">Route (Capcode)</a><br />
|
24
|
-
<a href="classes/Capcode/Helpers.html#
|
24
|
+
<a href="classes/Capcode/Helpers.html#M000020">URL (Capcode::Helpers)</a><br />
|
25
25
|
<a href="classes/Capcode.html#M000010">application (Capcode)</a><br />
|
26
|
-
<a href="classes/Capcode/Helpers.html#
|
27
|
-
<a href="classes/Capcode/Helpers.html#
|
28
|
-
<a href="classes/Capcode.html#
|
29
|
-
<a href="classes/Capcode/Helpers.html#
|
26
|
+
<a href="classes/Capcode/Helpers.html#M000015">args (Capcode::Helpers)</a><br />
|
27
|
+
<a href="classes/Capcode/Helpers.html#M000016">args= (Capcode::Helpers)</a><br />
|
28
|
+
<a href="classes/Capcode.html#M000014">before_filter (Capcode)</a><br />
|
29
|
+
<a href="classes/Capcode/Helpers.html#M000021">content_for (Capcode::Helpers)</a><br />
|
30
30
|
<a href="classes/Capcode.html#M000003">env (Capcode)</a><br />
|
31
|
-
<a href="classes/Capcode/Configuration.html#
|
31
|
+
<a href="classes/Capcode/Configuration.html#M000027">get (Capcode::Configuration)</a><br />
|
32
32
|
<a href="classes/Capcode.html#M000009">http_authentication (Capcode)</a><br />
|
33
|
-
<a href="classes/Capcode/Helpers/Authorization.html#
|
34
|
-
<a href="classes/Capcode/Helpers.html#
|
33
|
+
<a href="classes/Capcode/Helpers/Authorization.html#M000024">http_authentication (Capcode::Helpers::Authorization)</a><br />
|
34
|
+
<a href="classes/Capcode/Helpers.html#M000018">json (Capcode::Helpers)</a><br />
|
35
|
+
<a href="classes/Capcode/Helpers.html#M000023">log (Capcode::Helpers)</a><br />
|
36
|
+
<a href="classes/Capcode.html#M000012">logger (Capcode)</a><br />
|
35
37
|
<a href="classes/Capcode.html#M000007">map (Capcode)</a><br />
|
36
|
-
<a href="classes/Capcode/Configuration.html#
|
38
|
+
<a href="classes/Capcode/Configuration.html#M000028">options (Capcode::Configuration)</a><br />
|
37
39
|
<a href="classes/Capcode.html#M000002">params (Capcode)</a><br />
|
38
|
-
<a href="classes/Capcode/Configuration.html#
|
39
|
-
<a href="classes/Capcode/Helpers.html#
|
40
|
-
<a href="classes/Capcode/Helpers.html#
|
40
|
+
<a href="classes/Capcode/Configuration.html#M000025">print_debug (Capcode::Configuration)</a><br />
|
41
|
+
<a href="classes/Capcode/Helpers.html#M000019">redirect (Capcode::Helpers)</a><br />
|
42
|
+
<a href="classes/Capcode/Helpers.html#M000017">render (Capcode::Helpers)</a><br />
|
41
43
|
<a href="classes/Capcode.html#M000005">request (Capcode)</a><br />
|
42
44
|
<a href="classes/Capcode.html#M000006">response (Capcode)</a><br />
|
43
45
|
<a href="classes/Capcode.html#M000011">run (Capcode)</a><br />
|
44
46
|
<a href="classes/Capcode.html#M000004">session (Capcode)</a><br />
|
45
|
-
<a href="classes/Capcode/Configuration.html#
|
46
|
-
<a href="classes/Capcode.html#
|
47
|
-
<a href="classes/Capcode/Helpers.html#
|
47
|
+
<a href="classes/Capcode/Configuration.html#M000026">set (Capcode::Configuration)</a><br />
|
48
|
+
<a href="classes/Capcode.html#M000013">set (Capcode)</a><br />
|
49
|
+
<a href="classes/Capcode/Helpers.html#M000022">static (Capcode::Helpers)</a><br />
|
48
50
|
<a href="classes/Capcode.html#M000008">use (Capcode)</a><br />
|
49
51
|
</div>
|
50
52
|
</div>
|
data/examples/rest-run.rb
CHANGED
data/examples/rest.log
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Logfile created on Sun Jun 13 20:42:18 +0200 2010 by logger.rb/22285
|
2
|
+
127.0.0.1 - - [13/Jun/2010 20:42:24] "GET / HTTP/1.1" 200 586 0.0173
|
3
|
+
GET...
|
4
|
+
127.0.0.1 - - [13/Jun/2010 20:42:27] "GET /action?data=1 HTTP/1.1" 200 619 0.0082
|
5
|
+
POST...
|
6
|
+
127.0.0.1 - - [13/Jun/2010 20:42:30] "POST /action HTTP/1.1" 200 620 0.0080
|
7
|
+
DELETE...
|
8
|
+
127.0.0.1 - - [13/Jun/2010 20:42:33] "POST /action HTTP/1.1" 200 622 0.0078
|
9
|
+
PUT...
|
10
|
+
127.0.0.1 - - [13/Jun/2010 20:42:37] "POST /action HTTP/1.1" 200 619 0.0066
|
11
|
+
127.0.0.1 - - [13/Jun/2010 20:43:33] "GET / HTTP/1.1" 200 586 0.0165
|
12
|
+
GET...
|
13
|
+
127.0.0.1 - - [13/Jun/2010 20:43:37] "GET /action?data=A HTTP/1.1" 200 619 0.0075
|
14
|
+
POST...
|
15
|
+
127.0.0.1 - - [13/Jun/2010 20:43:40] "POST /action HTTP/1.1" 200 620 0.0081
|
16
|
+
DELETE...
|
17
|
+
127.0.0.1 - - [13/Jun/2010 20:43:42] "POST /action HTTP/1.1" 200 622 0.0073
|
18
|
+
PUT...
|
19
|
+
127.0.0.1 - - [13/Jun/2010 20:43:43] "POST /action HTTP/1.1" 200 619 0.0072
|
20
|
+
127.0.0.1 - - [13/Jun/2010 20:48:07] "GET / HTTP/1.1" 200 586 0.0173
|
21
|
+
GET...
|
22
|
+
127.0.0.1 - - [13/Jun/2010 20:48:13] "GET /action?data=a HTTP/1.1" 200 619 0.0092
|
23
|
+
127.0.0.1 - - [13/Jun/2010 20:48:43] "GET / HTTP/1.1" 200 586 0.0157
|
24
|
+
GET...
|
25
|
+
127.0.0.1 - - [13/Jun/2010 20:48:46] "GET /action?data=z HTTP/1.1" 200 619 0.0072
|
26
|
+
GET...
|
27
|
+
127.0.0.1 - - [13/Jun/2010 20:49:01] "GET /action?data=zz HTTP/1.1" 200 620 0.0064
|
28
|
+
127.0.0.1 - - [20/Jun/2010 12:53:42] "GET / HTTP/1.1" 200 586 0.0804
|
29
|
+
127.0.0.1 - - [20/Jun/2010 12:53:43] "GET /favicon.ico HTTP/1.1" 200 586 0.0068
|
30
|
+
GET...
|
31
|
+
127.0.0.1 - - [20/Jun/2010 12:53:46] "GET /action?data=pipo HTTP/1.1" 200 622 0.0080
|
32
|
+
127.0.0.1 - - [20/Jun/2010 13:03:30] "GET / HTTP/1.1" 200 586 0.0208
|
33
|
+
127.0.0.1 - - [20/Jun/2010 13:03:32] "GET / HTTP/1.1" 200 586 0.0058
|
34
|
+
127.0.0.1 - - [20/Jun/2010 13:03:32] "GET /favicon.ico HTTP/1.1" 200 586 0.0652
|
35
|
+
GET...
|
36
|
+
127.0.0.1 - - [20/Jun/2010 13:03:36] "GET /action?data=pipo HTTP/1.1" 200 622 0.0076
|
37
|
+
POST...
|
38
|
+
127.0.0.1 - - [20/Jun/2010 13:03:39] "POST /action HTTP/1.1" 200 623 0.0077
|
39
|
+
DELETE...
|
40
|
+
127.0.0.1 - - [20/Jun/2010 13:03:43] "POST /action HTTP/1.1" 200 624 0.0071
|
41
|
+
PUT...
|
42
|
+
127.0.0.1 - - [20/Jun/2010 13:03:46] "POST /action HTTP/1.1" 200 625 0.0072
|
43
|
+
127.0.0.1 - - [20/Jun/2010 13:05:02] "GET / HTTP/1.1" 200 586 0.0328
|
44
|
+
GET...
|
45
|
+
127.0.0.1 - - [20/Jun/2010 13:05:05] "GET /action?data=pipo HTTP/1.1" 200 622 0.0079
|
46
|
+
POST...
|
47
|
+
127.0.0.1 - - [20/Jun/2010 13:05:08] "POST /action HTTP/1.1" 200 623 0.0093
|
48
|
+
DELETE...
|
49
|
+
127.0.0.1 - - [20/Jun/2010 13:05:11] "POST /action HTTP/1.1" 200 624 0.0096
|
50
|
+
PUT...
|
51
|
+
127.0.0.1 - - [20/Jun/2010 13:05:14] "POST /action HTTP/1.1" 200 625 0.0092
|
52
|
+
127.0.0.1 - - [20/Jun/2010 13:13:15] "GET / HTTP/1.1" 200 586 0.0290
|
53
|
+
GET...
|
54
|
+
127.0.0.1 - - [20/Jun/2010 13:13:19] "GET /action?data=A HTTP/1.1" 200 619 0.0081
|
55
|
+
POST...
|
56
|
+
127.0.0.1 - - [20/Jun/2010 13:13:22] "POST /action HTTP/1.1" 200 620 0.0101
|
57
|
+
DELETE...
|
58
|
+
127.0.0.1 - - [20/Jun/2010 13:13:23] "POST /action HTTP/1.1" 200 622 0.0111
|
59
|
+
PUT...
|
60
|
+
127.0.0.1 - - [20/Jun/2010 13:13:26] "POST /action HTTP/1.1" 200 619 0.2896
|
61
|
+
127.0.0.1 - - [02/Sep/2010 14:43:18] "GET / HTTP/1.1" 200 586 0.1292
|
62
|
+
127.0.0.1 - - [02/Sep/2010 14:43:18] "GET /favicon.ico HTTP/1.1" 200 586 0.0082
|
63
|
+
GET...
|
64
|
+
127.0.0.1 - - [02/Sep/2010 14:43:21] "GET /action?data=get HTTP/1.1" 200 621 0.0068
|
65
|
+
POST...
|
66
|
+
127.0.0.1 - - [02/Sep/2010 14:43:24] "POST /action HTTP/1.1" 200 623 0.0066
|
67
|
+
DELETE...
|
68
|
+
127.0.0.1 - - [02/Sep/2010 14:43:27] "POST /action HTTP/1.1" 200 625 0.0070
|
69
|
+
PUT...
|
70
|
+
127.0.0.1 - - [02/Sep/2010 14:43:31] "POST /action HTTP/1.1" 200 621 0.0800
|
data/examples/rest.rb
CHANGED
@@ -10,21 +10,22 @@ module Capcode
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class Action < Route "/action"
|
13
|
-
def
|
13
|
+
def any
|
14
14
|
@method = env["REQUEST_METHOD"]
|
15
|
+
log.write( "#{@method}...\n" )
|
15
16
|
@data = params["data"]
|
16
17
|
render :markaby => :action, :layout => :forms
|
17
18
|
end
|
18
19
|
|
19
|
-
alias_method :post, :get
|
20
|
-
|
21
20
|
def delete
|
21
|
+
log.write( "DELETE...\n" )
|
22
22
|
@method = "DELETE"
|
23
23
|
@data = params["data"]
|
24
24
|
render :markaby => :action, :layout => :forms
|
25
25
|
end
|
26
26
|
|
27
27
|
def put
|
28
|
+
log.write( "PUT...\n" )
|
28
29
|
@method = "PUT"
|
29
30
|
@data = params["data"]
|
30
31
|
render :markaby => :action, :layout => :forms
|
data/examples/rest.ru
CHANGED
data/lib/capcode.rb
CHANGED
@@ -285,6 +285,13 @@ module Capcode
|
|
285
285
|
}
|
286
286
|
end
|
287
287
|
|
288
|
+
# Use the Rack logger
|
289
|
+
#
|
290
|
+
# log.write( "This is a log !" )
|
291
|
+
def log
|
292
|
+
Capcode.logger || env['rack.errors']
|
293
|
+
end
|
294
|
+
|
288
295
|
include Authorization
|
289
296
|
end
|
290
297
|
|
@@ -484,15 +491,25 @@ module Capcode
|
|
484
491
|
filter_output = Capcode::Filter.execute( self )
|
485
492
|
|
486
493
|
if( filter_output.nil? )
|
487
|
-
case @env["REQUEST_METHOD"]
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
494
|
+
# case @env["REQUEST_METHOD"]
|
495
|
+
# when "GET"
|
496
|
+
# get( *args )
|
497
|
+
# when "POST"
|
498
|
+
# _method = params.delete( "_method" ) { |_| "post" }
|
499
|
+
# send( _method.downcase.to_sym, *args )
|
500
|
+
# else
|
501
|
+
# _method = @env["REQUEST_METHOD"]
|
502
|
+
# send( _method.downcase.to_sym, *args )
|
503
|
+
# end
|
504
|
+
begin
|
505
|
+
_method = params.delete( "_method" ) { |_| @env["REQUEST_METHOD"] }
|
506
|
+
if self.class.method_defined?( _method.downcase.to_sym )
|
492
507
|
send( _method.downcase.to_sym, *args )
|
493
508
|
else
|
494
|
-
|
495
|
-
|
509
|
+
any( *args )
|
510
|
+
end
|
511
|
+
rescue => e
|
512
|
+
raise e.class, e.to_s
|
496
513
|
end
|
497
514
|
else
|
498
515
|
filter_output
|
@@ -639,6 +656,7 @@ module Capcode
|
|
639
656
|
app = Rack::Lint.new(app)
|
640
657
|
app = Rack::ShowExceptions.new(app)
|
641
658
|
#app = Rack::Reloader.new(app) ## -- NE RELOAD QUE capcode.rb -- So !!!
|
659
|
+
app = Rack::CommonLogger.new( app, @cclogger = Logger.new(Capcode::Configuration.get(:log)) )
|
642
660
|
|
643
661
|
middlewares.each do |mw|
|
644
662
|
middleware, args, block = mw
|
@@ -695,6 +713,9 @@ module Capcode
|
|
695
713
|
opts.on( "-s", "--static PATH", "Static directory -- relative to the root directory (default: #{Capcode::Configuration.get(:static)})" ) { |r|
|
696
714
|
Capcode::Configuration.set :static, r
|
697
715
|
}
|
716
|
+
opts.on( "-S", "--server SERVER", "Server to use (default: #{Capcode::Configuration.get(:server)})" ) { |r|
|
717
|
+
Capcode::Configuration.set :server, r
|
718
|
+
}
|
698
719
|
|
699
720
|
opts.separator ""
|
700
721
|
opts.separator "Common options:"
|
@@ -764,7 +785,6 @@ module Capcode
|
|
764
785
|
else
|
765
786
|
app = application(Capcode::Configuration.get)
|
766
787
|
end
|
767
|
-
app = Rack::CommonLogger.new( app, Logger.new(Capcode::Configuration.get(:log)) )
|
768
788
|
|
769
789
|
if Capcode::Configuration.get(:console)
|
770
790
|
puts "Run console..."
|
@@ -789,6 +809,15 @@ module Capcode
|
|
789
809
|
Rack::Handler::Thin.run( app, {:Port => Capcode::Configuration.get(:port), :Host => Capcode::Configuration.get(:host)} ) { |server|
|
790
810
|
trap "SIGINT", proc { server.stop }
|
791
811
|
}
|
812
|
+
when "unicorn"
|
813
|
+
require 'unicorn/launcher'
|
814
|
+
puts "** Starting Unicorn on #{Capcode::Configuration.get(:host)}:#{Capcode::Configuration.get(:port)}"
|
815
|
+
Unicorn.run( app, {:listeners => ["#{Capcode::Configuration.get(:host)}:#{Capcode::Configuration.get(:port)}"]} )
|
816
|
+
when "rainbows"
|
817
|
+
require 'unicorn/launcher'
|
818
|
+
require 'rainbows'
|
819
|
+
puts "** Starting Rainbow on #{Capcode::Configuration.get(:host)}:#{Capcode::Configuration.get(:port)}"
|
820
|
+
Rainbows.run( app, {:listeners => ["#{Capcode::Configuration.get(:host)}:#{Capcode::Configuration.get(:port)}"]} )
|
792
821
|
end
|
793
822
|
end
|
794
823
|
end
|
@@ -797,6 +826,10 @@ module Capcode
|
|
797
826
|
@routes ||= {}
|
798
827
|
end
|
799
828
|
|
829
|
+
def logger
|
830
|
+
@cclogger
|
831
|
+
end
|
832
|
+
|
800
833
|
def static #:nodoc:
|
801
834
|
@static_dir ||= nil
|
802
835
|
end
|
@@ -9,7 +9,7 @@ module Capcode
|
|
9
9
|
@configuration = config.merge({
|
10
10
|
:port => args[:port]||Capcode::Configuration.get(:port)||3000,
|
11
11
|
:host => args[:host]||Capcode::Configuration.get(:host)||"0.0.0.0",
|
12
|
-
:server => args[:server]||Capcode::Configuration.get(:server)||
|
12
|
+
:server => args[:server]||Capcode::Configuration.get(:server)||"mongrel",
|
13
13
|
:log => args[:log]||Capcode::Configuration.get(:log)||$stdout,
|
14
14
|
:session => args[:session]||Capcode::Configuration.get(:session)||{},
|
15
15
|
:pid => args[:pid]||Capcode::Configuration.get(:pid)||"#{$0}.pid",
|
@@ -36,7 +36,7 @@ module Capcode
|
|
36
36
|
# Options :
|
37
37
|
# * <tt>:port</tt> = Listen port (default: 3000)
|
38
38
|
# * <tt>:host</tt> = Listen host (default: 0.0.0.0)
|
39
|
-
# * <tt>:server</tt> = Server type (webrick, mongrel or
|
39
|
+
# * <tt>:server</tt> = Server type (webrick, mongrel, thin, unicorn or rainbow)
|
40
40
|
# * <tt>:log</tt> = Output logfile (default: STDOUT)
|
41
41
|
# * <tt>:session</tt> = Session parameters. See Rack::Session for more informations
|
42
42
|
# * <tt>:pid</tt> = PID file (default: $0.pid)
|
data/lib/capcode/filters.rb
CHANGED
@@ -13,6 +13,7 @@ module Capcode
|
|
13
13
|
#
|
14
14
|
def before_filter( action, opts = {} )
|
15
15
|
Capcode::Filter.filters[action] = { }
|
16
|
+
Capcode::Filter.ordered_actions << action
|
16
17
|
|
17
18
|
opts.each do |k, v|
|
18
19
|
Capcode::Filter.filters[action][k] = v
|
@@ -26,6 +27,10 @@ module Capcode
|
|
26
27
|
@filters ||= { }
|
27
28
|
end
|
28
29
|
|
30
|
+
def ordered_actions
|
31
|
+
@ordered_actions ||= []
|
32
|
+
end
|
33
|
+
|
29
34
|
def execute( klass ) #:nodoc:
|
30
35
|
klass_sym = "#{klass.class}".split( /::/)[-1].to_sym
|
31
36
|
actions = []
|
@@ -39,8 +44,9 @@ module Capcode
|
|
39
44
|
|
40
45
|
klass.class.instance_eval{ include Capcode }
|
41
46
|
rCod = nil
|
42
|
-
actions.each do |a|
|
47
|
+
ordered_actions.clone.delete_if{ |x| not actions.include?(x) }.each do |a|
|
43
48
|
rCod = klass.send( a )
|
49
|
+
break unless rCod.nil?
|
44
50
|
end
|
45
51
|
|
46
52
|
return rCod
|
data/lib/capcode/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Capcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Gr\xC3\xA9goire Lejeune"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- examples/render-image.rb
|
113
113
|
- examples/render-text.rb
|
114
114
|
- examples/rest-run.rb
|
115
|
+
- examples/rest.log
|
115
116
|
- examples/rest.rb
|
116
117
|
- examples/rest.ru
|
117
118
|
- examples/route.rb
|