ramaze 0.3.5 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +5 -20
- data/bin/ramaze +0 -4
- data/doc/AUTHORS +5 -0
- data/doc/meta/announcement.txt +2 -1
- data/doc/tutorial/todolist.html +20 -21
- data/doc/tutorial/todolist.mkd +10 -9
- data/examples/blog/{src/controller.rb → controller/main.rb} +2 -0
- data/examples/blog/{src/model.rb → model/entry.rb} +0 -0
- data/examples/blog/spec/blog.rb +3 -3
- data/examples/blog/start.rb +2 -3
- data/examples/blog/view/edit.xhtml +17 -0
- data/examples/blog/view/index.xhtml +17 -0
- data/examples/blog/view/layout.xhtml +11 -0
- data/examples/blog/view/new.xhtml +16 -0
- data/examples/facebook.rb +15 -8
- data/examples/identity.rb +1 -1
- data/examples/memleak_detector.rb +1 -1
- data/examples/rammit/src/model.rb +1 -1
- data/examples/rapaste/controller/paste.rb +7 -7
- data/examples/rapaste/model/paste.rb +1 -3
- data/examples/rapaste/public/css/display.css +2 -1
- data/examples/rapaste/start.rb +2 -3
- data/examples/sourceview/sourceview.rb +1 -1
- data/examples/templates/template/external.tenjin +28 -0
- data/examples/templates/template_amrita2.rb +0 -3
- data/examples/templates/template_tenjin.rb +57 -0
- data/examples/todolist/spec/todolist.rb +13 -2
- data/examples/todolist/src/controller/main.rb +1 -1
- data/examples/todolist/template/index.xhtml +1 -1
- data/examples/wiktacular/spec/wiktacular.rb +18 -0
- data/examples/wiktacular/src/controller.rb +2 -2
- data/examples/wiktacular/src/model.rb +8 -2
- data/lib/proto/public/css/ramaze_error.css +4 -0
- data/lib/proto/public/dispatch.fcgi +11 -0
- data/lib/proto/spec/main.rb +1 -1
- data/lib/proto/start.ru +8 -0
- data/lib/proto/view/error.xhtml +2 -0
- data/lib/ramaze.rb +28 -5
- data/lib/ramaze/action.rb +9 -2
- data/lib/ramaze/action/render.rb +40 -24
- data/lib/ramaze/adapter.rb +10 -17
- data/lib/ramaze/adapter/base.rb +8 -12
- data/lib/ramaze/adapter/cgi.rb +14 -13
- data/lib/ramaze/adapter/ebb.rb +34 -0
- data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
- data/lib/ramaze/adapter/fcgi.rb +14 -14
- data/lib/ramaze/adapter/lsws.rb +15 -11
- data/lib/ramaze/adapter/mongrel.rb +2 -1
- data/lib/ramaze/adapter/scgi.rb +24 -0
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
- data/lib/ramaze/adapter/thin.rb +4 -5
- data/lib/ramaze/adapter/webrick.rb +5 -5
- data/lib/ramaze/cache.rb +1 -1
- data/lib/ramaze/cache/memcached.rb +1 -1
- data/lib/ramaze/contrib.rb +70 -10
- data/lib/ramaze/contrib/auto_params.rb +1 -1
- data/lib/ramaze/contrib/email.rb +15 -15
- data/lib/ramaze/contrib/facebook.rb +2 -2
- data/lib/ramaze/contrib/facebook/facebook.rb +7 -4
- data/lib/ramaze/contrib/file_cache.rb +65 -0
- data/lib/ramaze/contrib/gettext.rb +56 -55
- data/lib/ramaze/contrib/profiling.rb +36 -0
- data/lib/ramaze/contrib/sequel_cache.rb +92 -0
- data/lib/ramaze/controller.rb +80 -47
- data/lib/ramaze/controller/error.rb +10 -5
- data/lib/ramaze/controller/resolve.rb +36 -48
- data/lib/ramaze/current.rb +70 -0
- data/lib/ramaze/{trinity → current}/request.rb +62 -15
- data/lib/ramaze/current/response.rb +19 -0
- data/lib/ramaze/{trinity → current}/session.rb +32 -110
- data/lib/ramaze/current/session/flash.rb +67 -0
- data/lib/ramaze/current/session/hash.rb +65 -0
- data/lib/ramaze/dispatcher.rb +1 -28
- data/lib/ramaze/dispatcher/action.rb +6 -3
- data/lib/ramaze/dispatcher/directory.rb +1 -1
- data/lib/ramaze/dispatcher/error.rb +26 -5
- data/lib/ramaze/dispatcher/file.rb +13 -2
- data/lib/ramaze/gestalt.rb +3 -1
- data/lib/ramaze/global.rb +6 -3
- data/lib/ramaze/global/globalstruct.rb +3 -1
- data/lib/ramaze/helper.rb +66 -20
- data/lib/ramaze/helper/aspect.rb +25 -17
- data/lib/ramaze/helper/auth.rb +4 -3
- data/lib/ramaze/helper/cache.rb +5 -4
- data/lib/ramaze/helper/cgi.rb +11 -9
- data/lib/ramaze/helper/flash.rb +28 -3
- data/lib/ramaze/helper/formatting.rb +1 -3
- data/lib/ramaze/helper/identity.rb +2 -3
- data/lib/ramaze/helper/inform.rb +7 -6
- data/lib/ramaze/helper/link.rb +15 -17
- data/lib/ramaze/helper/markaby.rb +2 -4
- data/lib/ramaze/helper/maruku.rb +1 -1
- data/lib/ramaze/helper/nitroform.rb +4 -4
- data/lib/ramaze/helper/pager.rb +4 -6
- data/lib/ramaze/helper/partial.rb +24 -21
- data/lib/ramaze/helper/redirect.rb +8 -5
- data/lib/ramaze/helper/{file.rb → sendfile.rb} +1 -3
- data/lib/ramaze/helper/sequel.rb +1 -3
- data/lib/ramaze/helper/stack.rb +1 -3
- data/lib/ramaze/helper/tagz.rb +19 -0
- data/lib/ramaze/helper/user.rb +63 -0
- data/lib/ramaze/inform.rb +2 -24
- data/lib/ramaze/log.rb +28 -0
- data/lib/ramaze/{inform → log}/analogger.rb +3 -3
- data/lib/ramaze/{inform → log}/growl.rb +2 -2
- data/lib/ramaze/{inform → log}/hub.rb +4 -6
- data/lib/ramaze/{inform → log}/informer.rb +4 -4
- data/lib/ramaze/{inform → log}/knotify.rb +2 -2
- data/lib/ramaze/log/logger.rb +22 -0
- data/lib/ramaze/{inform/informing.rb → log/logging.rb} +16 -16
- data/lib/ramaze/{inform → log}/syslog.rb +0 -0
- data/lib/ramaze/{inform → log}/xosd.rb +2 -2
- data/lib/ramaze/route.rb +64 -36
- data/lib/ramaze/snippets/array/put_within.rb +13 -0
- data/lib/ramaze/snippets/binding/locals.rb +13 -0
- data/lib/ramaze/snippets/kernel/__dir__.rb +10 -8
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
- data/lib/ramaze/snippets/kernel/constant.rb +1 -1
- data/lib/ramaze/snippets/object/pretty.rb +6 -0
- data/lib/ramaze/snippets/object/scope.rb +11 -0
- data/lib/ramaze/snippets/object/thread_accessor.rb +5 -0
- data/lib/ramaze/snippets/ordered_set.rb +1 -1
- data/lib/ramaze/snippets/proc/locals.rb +11 -0
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +44 -0
- data/lib/ramaze/snippets/string/esc.rb +29 -0
- data/lib/ramaze/snippets/string/start_with.rb +7 -0
- data/lib/ramaze/snippets/string/unindent.rb +6 -1
- data/lib/ramaze/snippets/struct/values_at.rb +1 -5
- data/lib/ramaze/sourcereload.rb +16 -14
- data/lib/ramaze/spec.rb +1 -0
- data/lib/ramaze/spec/helper.rb +11 -3
- data/lib/ramaze/spec/helper/browser.rb +25 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +11 -11
- data/lib/ramaze/template.rb +5 -4
- data/lib/ramaze/template/amrita2.rb +2 -3
- data/lib/ramaze/template/ezamar/element.rb +2 -3
- data/lib/ramaze/template/ezamar/morpher.rb +1 -2
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/haml.rb +5 -2
- data/lib/ramaze/template/markaby.rb +2 -0
- data/lib/ramaze/template/tagz.rb +79 -0
- data/lib/ramaze/template/tenjin.rb +34 -0
- data/lib/ramaze/tool/create.rb +0 -3
- data/lib/ramaze/tool/localize.rb +107 -105
- data/lib/ramaze/tool/mime.rb +0 -2
- data/lib/ramaze/trinity.rb +1 -26
- data/lib/ramaze/version.rb +1 -1
- data/lib/vendor/bacon.rb +47 -41
- data/rake_tasks/conf.rake +18 -0
- data/rake_tasks/darcs.rake +5 -0
- data/rake_tasks/maintenance.rake +37 -24
- data/rake_tasks/spec.rake +1 -1
- data/spec/contrib/auto_params.rb +3 -1
- data/spec/contrib/profiling.rb +26 -0
- data/spec/examples/templates/template_redcloth.rb +1 -1
- data/spec/examples/templates/template_tenjin.rb +28 -0
- data/spec/helper.rb +0 -1
- data/spec/ramaze/action/layout.rb +28 -0
- data/spec/ramaze/controller/actionless_templates.rb +32 -0
- data/spec/ramaze/controller/template/other_wrapper.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +37 -0
- data/spec/ramaze/{trinity → current}/request.rb +12 -2
- data/spec/ramaze/current/session.rb +97 -0
- data/spec/ramaze/dispatcher/directory.rb +2 -1
- data/spec/ramaze/dispatcher/file.rb +8 -3
- data/spec/ramaze/dispatcher/public/file name.txt +1 -0
- data/spec/ramaze/gestalt.rb +11 -0
- data/spec/ramaze/helper/aspect.rb +28 -22
- data/spec/ramaze/helper/cgi.rb +2 -2
- data/spec/ramaze/helper/flash.rb +33 -15
- data/spec/ramaze/helper/formatting.rb +2 -2
- data/spec/ramaze/helper/link.rb +46 -18
- data/spec/ramaze/helper/pager.rb +8 -5
- data/spec/ramaze/helper/partial.rb +8 -1
- data/spec/ramaze/helper/template/recursive_local_ivars.xhtml +7 -0
- data/spec/ramaze/helper/user.rb +46 -0
- data/spec/ramaze/{inform → log}/informer.rb +0 -0
- data/spec/ramaze/{inform → log}/syslog.rb +1 -1
- data/spec/ramaze/request.rb +14 -10
- data/spec/ramaze/route.rb +23 -0
- data/spec/ramaze/template.rb +48 -1
- data/spec/ramaze/template/haml.rb +6 -16
- data/spec/ramaze/template/haml/locals.haml +2 -1
- data/spec/ramaze/template/tagz.rb +62 -0
- data/spec/ramaze/template/tagz/external.tagz +8 -0
- data/spec/ramaze/template/tagz/sum.tagz +1 -0
- data/spec/ramaze/template/tenjin.rb +49 -0
- data/spec/ramaze/template/tenjin/external.tenjin +1 -0
- data/spec/snippets/string/unindent.rb +15 -0
- metadata +509 -475
- data/doc/README.html +0 -729
- data/doc/changes.txt +0 -5757
- data/doc/changes.xml +0 -5759
- data/examples/blog/src/view.rb +0 -16
- data/examples/blog/template/edit.xhtml +0 -19
- data/examples/blog/template/index.xhtml +0 -19
- data/examples/blog/template/new.xhtml +0 -18
- data/examples/wiktacular/mkd/newpagename/current.mkd +0 -1
- data/examples/wiktacular/mkd/newpagename/current.mkd.bak +0 -1
- data/lib/ramaze/contrib/email.rb-darcs-backup0 +0 -81
- data/lib/ramaze/template/bijou.rb +0 -39
- data/lib/ramaze/trinity/response.rb +0 -32
- data/spec/ramaze/template/bijou.rb +0 -25
- data/spec/ramaze/trinity/session.rb +0 -29
data/lib/ramaze/tool/mime.rb
CHANGED
data/lib/ramaze/trinity.rb
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
|
-
require 'ramaze/trinity/request'
|
|
5
|
-
require 'ramaze/trinity/response'
|
|
6
|
-
require 'ramaze/trinity/session'
|
|
7
|
-
|
|
8
4
|
module Ramaze
|
|
9
5
|
|
|
10
6
|
# The module to be included into the Controller it basically just provides
|
|
@@ -12,27 +8,6 @@ module Ramaze
|
|
|
12
8
|
# retrieve the demanded object
|
|
13
9
|
|
|
14
10
|
module Trinity
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# same as
|
|
18
|
-
# Thread.current[:request]
|
|
19
|
-
|
|
20
|
-
def request
|
|
21
|
-
Request.current
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# same as
|
|
25
|
-
# Thread.current[:response]
|
|
26
|
-
|
|
27
|
-
def response
|
|
28
|
-
Response.current
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# same as
|
|
32
|
-
# Thread.current[:session]
|
|
33
|
-
|
|
34
|
-
def session
|
|
35
|
-
Session.current
|
|
36
|
-
end
|
|
11
|
+
thread_accessor :request, :response, :session
|
|
37
12
|
end
|
|
38
13
|
end
|
data/lib/ramaze/version.rb
CHANGED
data/lib/vendor/bacon.rb
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
#
|
|
3
3
|
# "Truth will sooner come out from error than from confusion." ---Francis Bacon
|
|
4
4
|
|
|
5
|
-
# Copyright (C) 2007 Christian Neukirchen <purl.org/net/chneukirchen>
|
|
5
|
+
# Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
|
6
6
|
#
|
|
7
7
|
# Bacon is freely distributable under the terms of an MIT-style license.
|
|
8
8
|
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
9
9
|
|
|
10
10
|
module Bacon
|
|
11
|
-
VERSION = "0.
|
|
11
|
+
VERSION = "0.9"
|
|
12
12
|
|
|
13
13
|
Counter = Hash.new(0)
|
|
14
14
|
ErrorLog = ""
|
|
@@ -53,9 +53,7 @@ module Bacon
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
module TestUnitOutput
|
|
56
|
-
def handle_specification(name)
|
|
57
|
-
yield
|
|
58
|
-
end
|
|
56
|
+
def handle_specification(name) yield end
|
|
59
57
|
|
|
60
58
|
def handle_requirement(description)
|
|
61
59
|
error = yield
|
|
@@ -74,17 +72,15 @@ module Bacon
|
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
module TapOutput
|
|
77
|
-
def handle_specification(name)
|
|
78
|
-
yield
|
|
79
|
-
end
|
|
75
|
+
def handle_specification(name) yield end
|
|
80
76
|
|
|
81
77
|
def handle_requirement(description)
|
|
82
78
|
ErrorLog.replace ""
|
|
83
79
|
error = yield
|
|
84
80
|
if error.empty?
|
|
85
|
-
printf "ok %-
|
|
81
|
+
printf "ok %-3d - %s\n" % [Counter[:specifications], description]
|
|
86
82
|
else
|
|
87
|
-
printf "not ok
|
|
83
|
+
printf "not ok %d - %s: %s\n" %
|
|
88
84
|
[Counter[:specifications], description, error]
|
|
89
85
|
puts ErrorLog.strip.gsub(/^/, '# ')
|
|
90
86
|
end
|
|
@@ -110,38 +106,58 @@ module Bacon
|
|
|
110
106
|
|
|
111
107
|
class Context
|
|
112
108
|
def initialize(name, &block)
|
|
113
|
-
@before = []
|
|
114
|
-
@after = []
|
|
115
109
|
@name = name
|
|
110
|
+
@before, @after = [], []
|
|
116
111
|
|
|
117
112
|
return unless name =~ RestrictContext
|
|
118
|
-
Bacon.handle_specification(name)
|
|
119
|
-
instance_eval(&block)
|
|
120
|
-
end
|
|
113
|
+
Bacon.handle_specification(name) { instance_eval(&block) }
|
|
121
114
|
end
|
|
122
115
|
|
|
123
116
|
def before(&block); @before << block; end
|
|
124
117
|
def after(&block); @after << block; end
|
|
125
118
|
|
|
126
119
|
def behaves_like(*names)
|
|
127
|
-
names.each
|
|
128
|
-
instance_eval(&Shared[name])
|
|
129
|
-
end
|
|
120
|
+
names.each { |name| instance_eval(&Shared[name]) }
|
|
130
121
|
end
|
|
131
122
|
|
|
132
123
|
def it(description, &block)
|
|
133
124
|
return unless description =~ RestrictName
|
|
125
|
+
block ||= lambda { should.flunk "not implemented" }
|
|
134
126
|
Counter[:specifications] += 1
|
|
135
127
|
run_requirement description, block
|
|
136
128
|
end
|
|
129
|
+
|
|
130
|
+
def should(*args, &block)
|
|
131
|
+
if Counter[:depth]==0
|
|
132
|
+
it('should '+args.first,&block)
|
|
133
|
+
else
|
|
134
|
+
super(*args,&block)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
137
|
|
|
138
138
|
def run_requirement(description, spec)
|
|
139
139
|
Bacon.handle_requirement description do
|
|
140
140
|
begin
|
|
141
141
|
Counter[:depth] += 1
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
rescued = false
|
|
143
|
+
begin
|
|
144
|
+
@before.each { |block| instance_eval(&block) }
|
|
145
|
+
prev_req = Counter[:requirements]
|
|
146
|
+
instance_eval(&spec)
|
|
147
|
+
rescue Object => e
|
|
148
|
+
rescued = true
|
|
149
|
+
raise e
|
|
150
|
+
ensure
|
|
151
|
+
if Counter[:requirements] == prev_req
|
|
152
|
+
raise Error.new(:missing,
|
|
153
|
+
"empty specification: #{@name} #{description}")
|
|
154
|
+
end
|
|
155
|
+
begin
|
|
156
|
+
@after.each { |block| instance_eval(&block) }
|
|
157
|
+
rescue Object => e
|
|
158
|
+
raise e unless rescued
|
|
159
|
+
end
|
|
160
|
+
end
|
|
145
161
|
rescue Object => e
|
|
146
162
|
ErrorLog << "#{e.class}: #{e.message}\n"
|
|
147
163
|
e.backtrace.find_all { |line| line !~ /bin\/bacon|\/bacon\.rb:\d+/ }.
|
|
@@ -187,10 +203,10 @@ end
|
|
|
187
203
|
|
|
188
204
|
class Proc
|
|
189
205
|
def raise?(*exceptions)
|
|
190
|
-
exceptions
|
|
206
|
+
exceptions = [RuntimeError] if exceptions.empty?
|
|
191
207
|
call
|
|
192
208
|
|
|
193
|
-
|
|
209
|
+
# Only to work in 1.9.0, rescue with splat doesn't work there right now
|
|
194
210
|
rescue Object => e
|
|
195
211
|
case e
|
|
196
212
|
when *exceptions
|
|
@@ -226,21 +242,14 @@ end
|
|
|
226
242
|
|
|
227
243
|
|
|
228
244
|
class Object
|
|
229
|
-
def should(*args, &block)
|
|
230
|
-
Should.new(self).be(*args, &block)
|
|
231
|
-
end
|
|
245
|
+
def should(*args, &block) Should.new(self).be(*args, &block) end
|
|
232
246
|
end
|
|
233
247
|
|
|
234
248
|
module Kernel
|
|
235
249
|
private
|
|
236
250
|
|
|
237
|
-
def describe(
|
|
238
|
-
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
def shared(name, &block)
|
|
242
|
-
Bacon::Shared[name] = block
|
|
243
|
-
end
|
|
251
|
+
def describe(*args, &block) Bacon::Context.new(args.join(' '), &block) end
|
|
252
|
+
def shared(name, &block) Bacon::Shared[name] = block end
|
|
244
253
|
end
|
|
245
254
|
|
|
246
255
|
|
|
@@ -287,8 +296,8 @@ class Should
|
|
|
287
296
|
|
|
288
297
|
r = yield(@object, *args)
|
|
289
298
|
if Bacon::Counter[:depth] > 0
|
|
290
|
-
raise Bacon::Error.new(:failed, description) unless @negated ^ r
|
|
291
299
|
Bacon::Counter[:requirements] += 1
|
|
300
|
+
raise Bacon::Error.new(:failed, description) unless @negated ^ r
|
|
292
301
|
end
|
|
293
302
|
@negated ^ r ? r : false
|
|
294
303
|
end
|
|
@@ -300,15 +309,12 @@ class Should
|
|
|
300
309
|
desc << @object.inspect << "." << name.to_s
|
|
301
310
|
desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed"
|
|
302
311
|
|
|
303
|
-
satisfy(desc) { |x|
|
|
304
|
-
x.__send__(name, *args, &block)
|
|
305
|
-
}
|
|
312
|
+
satisfy(desc) { |x| x.__send__(name, *args, &block) }
|
|
306
313
|
end
|
|
307
314
|
|
|
308
|
-
def equal(value)
|
|
309
|
-
def match(value)
|
|
310
|
-
|
|
311
|
-
def identical_to(value); self.equal? value; end
|
|
315
|
+
def equal(value) self == value end
|
|
316
|
+
def match(value) self =~ value end
|
|
317
|
+
def identical_to(value) self.equal? value end
|
|
312
318
|
alias same_as identical_to
|
|
313
319
|
|
|
314
320
|
def flunk(reason="Flunked")
|
data/rake_tasks/conf.rake
CHANGED
|
@@ -51,5 +51,23 @@ You can now do following:
|
|
|
51
51
|
#{'=' * 60}
|
|
52
52
|
}.strip
|
|
53
53
|
|
|
54
|
+
AUTHOR_MAP = {
|
|
55
|
+
'ahoward' => 'Ara T. Howard',
|
|
56
|
+
'ara.t.howard@gmail.com' => 'Ara T. Howard',
|
|
57
|
+
'blueonyx@dev-area.net' => 'Martin Hilbig',
|
|
58
|
+
'clive@crous.co.za' => 'Clive Crous',
|
|
59
|
+
'comp.lang.zenix+ramaze@gmail.com' => 'zenix',
|
|
60
|
+
'jesusisramazing.10.pistos@geoshell.com' => 'Pistos',
|
|
61
|
+
'jesuswasramazing.10.pistos@geoshell.com' => 'Pistos',
|
|
62
|
+
'keita.yamaguchi@gmail.com' => 'Keita Yamaguchi',
|
|
63
|
+
'leo.borisenko@gmail.com' => 'Leo Borisenko',
|
|
64
|
+
'manveru@weez-int.com' => 'Michael Fellinger',
|
|
65
|
+
'm.fellinger@gmail.com' => 'Michael Fellinger',
|
|
66
|
+
'outtenr@gmail.com' => 'Richard Outten',
|
|
67
|
+
'rff.rff@gmail.com' => 'Gabriele Renzi',
|
|
68
|
+
'skaar@waste.org' => 'skaar',
|
|
69
|
+
'stephan@spaceboyz.net' => 'Stephan Maka',
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
# * Browse and try the Examples in
|
|
55
73
|
# #{File.join(Gem.path, 'gems', 'ramaze-' + VERS, 'examples')}
|
data/rake_tasks/maintenance.rake
CHANGED
|
@@ -204,30 +204,21 @@ task 'tutorial' => ['tutorial2html'] do
|
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
def authors
|
|
207
|
-
author_map = {
|
|
208
|
-
'blueonyx@dev-area.net' => 'Martin Hilbig',
|
|
209
|
-
'clive@crous.co.za' => 'Clive Crous',
|
|
210
|
-
'comp.lang.zenix+ramaze@gmail.com' => 'zenix',
|
|
211
|
-
'jesuswasramazing.10.pistos@geoshell.com' => 'Pistos',
|
|
212
|
-
'jesusisramazing.10.pistos@geoshell.com' => 'Pistos',
|
|
213
|
-
'manveru@weez-int.com' => 'Michael Fellinger',
|
|
214
|
-
'm.fellinger@gmail.com' => 'Michael Fellinger',
|
|
215
|
-
'outtenr@gmail.com' => 'Richard Outten',
|
|
216
|
-
'rff.rff@gmail.com' => 'Gabriele Renzi',
|
|
217
|
-
'skaar@waste.org' => 'skaar',
|
|
218
|
-
'stephan@spaceboyz.net' => 'Stephan Maka',
|
|
219
|
-
'keita.yamaguchi@gmail.com' => 'Keita Yamaguchi',
|
|
220
|
-
}
|
|
221
|
-
|
|
222
207
|
mapping = {}
|
|
223
|
-
`darcs
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
208
|
+
`darcs show authors`.split("\n").each do |line|
|
|
209
|
+
atoms = line.split
|
|
210
|
+
patches = atoms.shift.to_i
|
|
211
|
+
|
|
212
|
+
if email = atoms.find{|a| a.gsub!(/(.*?@.*?)/, '\1') }
|
|
213
|
+
email.tr!('<>', '')
|
|
214
|
+
atoms.delete email
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
name = atoms.join(' ')
|
|
218
|
+
name = AUTHOR_MAP.fetch(email) if name.empty?
|
|
219
|
+
patches += mapping.fetch(name, {}).fetch(:patches, 0)
|
|
220
|
+
|
|
221
|
+
mapping[name] = { :email => email, :patches => patches }
|
|
231
222
|
end
|
|
232
223
|
|
|
233
224
|
max = mapping.map{|k,v| k.size }.max
|
|
@@ -246,10 +237,32 @@ task 'authors' do
|
|
|
246
237
|
end
|
|
247
238
|
end
|
|
248
239
|
|
|
240
|
+
desc "show how many patches we made so far"
|
|
241
|
+
task :patchsize do
|
|
242
|
+
patches = `darcs show repo`[/Num Patches: (\d+)/, 1].to_i
|
|
243
|
+
puts "currently we have #{patches} patches"
|
|
244
|
+
init = Time.parse("Sat Oct 14 04:22:49 JST 2006")
|
|
245
|
+
days = (Time.now - init) / (3600 * 24)
|
|
246
|
+
puts "%d days since init, avg %4.2f patches per day" % [days, patches/days]
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
desc "show who made how many patches"
|
|
250
|
+
task :patchstat do
|
|
251
|
+
total = 0.0
|
|
252
|
+
|
|
253
|
+
authors.map do |name, hash|
|
|
254
|
+
patches = hash[:patches]
|
|
255
|
+
total += patches
|
|
256
|
+
[patches, name]
|
|
257
|
+
end.sort.reverse_each do |patches, name|
|
|
258
|
+
puts "%s %4d [%6.2f%% ]" % [name, patches, patches/total * 100]
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
249
262
|
desc "upload packages to rubyforge"
|
|
250
263
|
task 'release' => ['distribute'] do
|
|
251
264
|
sh 'rubyforge login'
|
|
252
|
-
|
|
265
|
+
sh "rubyforge add_release ramaze ramaze #{VERS} pkg/ramaze-#{VERS}.gem"
|
|
253
266
|
|
|
254
267
|
require 'open-uri'
|
|
255
268
|
require 'hpricot'
|
data/rake_tasks/spec.rake
CHANGED
data/spec/contrib/auto_params.rb
CHANGED
|
@@ -4,11 +4,13 @@ spec_require 'ruby2ruby'
|
|
|
4
4
|
Ramaze.contrib :auto_params
|
|
5
5
|
|
|
6
6
|
module AnotherController
|
|
7
|
+
Ramaze::Helper::LOOKUP << self
|
|
8
|
+
|
|
7
9
|
def another_page
|
|
8
10
|
'another page'
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
define_method(
|
|
13
|
+
define_method('css/style.css') { 'style.css' }
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
class MainController < Ramaze::Controller
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'spec/helper'
|
|
2
|
+
|
|
3
|
+
spec_require 'ruby-prof'
|
|
4
|
+
|
|
5
|
+
Ramaze.contrib :profiling
|
|
6
|
+
|
|
7
|
+
class MainController < Ramaze::Controller
|
|
8
|
+
def index
|
|
9
|
+
100.times {"h" + "e" + "l" + "l" + "o"}
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
output = StringIO.new
|
|
14
|
+
Ramaze::Inform.loggers << Ramaze::Informer.new(output)
|
|
15
|
+
|
|
16
|
+
describe 'Profiling' do
|
|
17
|
+
behaves_like "http"
|
|
18
|
+
ramaze
|
|
19
|
+
|
|
20
|
+
it "should profile" do
|
|
21
|
+
get('/')
|
|
22
|
+
output.string.should =~ /Thread ID:\s\d+/
|
|
23
|
+
output.string.should =~ /Total:/
|
|
24
|
+
output.string.should =~ /self\s+total\s+self\s+wait\s+child\s+call/
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec/helper'
|
|
2
|
+
|
|
3
|
+
spec_require 'tenjin'
|
|
4
|
+
require 'examples/templates/template_tenjin'
|
|
5
|
+
|
|
6
|
+
describe 'Template Tenjin' do
|
|
7
|
+
behaves_like 'http'
|
|
8
|
+
ramaze
|
|
9
|
+
|
|
10
|
+
it '/' do
|
|
11
|
+
html = get('/').body.strip
|
|
12
|
+
html.should =~ %r(<a href=\"/\">Home</a>)
|
|
13
|
+
html.should =~ %r(<a href=\"/internal\">internal</a>)
|
|
14
|
+
html.should =~ %r(<a href=\"/external\">external</a>)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
%w[/internal /external].each do |url|
|
|
18
|
+
it url do
|
|
19
|
+
name = url.gsub(/^\//, '')
|
|
20
|
+
response = get(url)
|
|
21
|
+
response.status.should == 200
|
|
22
|
+
html = response.body
|
|
23
|
+
html.should.not == nil
|
|
24
|
+
html.should =~ %r(<title>Template::Tenjin #{name}</title>)
|
|
25
|
+
html.should =~ %r(<h1>The #{name} Template for Tenjin</h1>)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/spec/helper.rb
CHANGED