ramaze 0.1.0 → 0.1.1
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 +4 -12
- data/bin/ramaze +95 -171
- data/doc/CHANGELOG +387 -4
- data/doc/README +81 -13
- data/doc/meta/announcement.txt +51 -8
- data/doc/meta/configuration.txt +17 -34
- data/doc/meta/internals.txt +34 -4
- data/doc/migrate/1110_to_1111.txt +131 -0
- data/doc/readme_chunks/features.txt +81 -12
- data/doc/readme_chunks/installing.txt +0 -1
- data/doc/tutorial/todolist.html +293 -65
- data/doc/tutorial/{todolist.txt → todolist.mkd} +251 -51
- data/examples/blog/main.rb +1 -1
- data/examples/blog/src/model.rb +0 -1
- data/examples/hello.rb +2 -5
- data/examples/templates/template/external.haml +5 -5
- data/examples/templates/template/external.liquid +1 -1
- data/examples/templates/template/external.mab +8 -8
- data/examples/templates/template/external.rem +30 -0
- data/examples/templates/template/external.rhtml +6 -7
- data/examples/templates/template/external.zmr +13 -9
- data/examples/templates/template_amrita2.rb +8 -8
- data/examples/templates/template_erubis.rb +11 -11
- data/examples/templates/template_ezamar.rb +9 -11
- data/examples/templates/template_haml.rb +13 -13
- data/examples/templates/template_liquid.rb +10 -10
- data/examples/templates/template_markaby.rb +13 -10
- data/examples/templates/template_remarkably.rb +59 -0
- data/examples/todolist/main.rb +1 -7
- data/examples/todolist/src/controller/main.rb +26 -13
- data/examples/todolist/src/element/page.rb +5 -0
- data/examples/whywiki/main.rb +1 -1
- data/lib/proto/main.rb +0 -8
- data/lib/proto/public/css/ramaze_error.css +12 -4
- data/lib/proto/public/error.zmr +6 -25
- data/lib/ramaze.rb +35 -245
- data/lib/ramaze/action.rb +21 -0
- data/lib/ramaze/adapter.rb +94 -29
- data/lib/ramaze/adapter/base.rb +57 -0
- data/lib/ramaze/adapter/mongrel.rb +12 -19
- data/lib/ramaze/adapter/webrick.rb +21 -20
- data/lib/ramaze/cache.rb +47 -3
- data/lib/ramaze/cache/memcached.rb +22 -0
- data/lib/ramaze/cache/yaml_store.rb +19 -0
- data/lib/ramaze/controller.rb +47 -271
- data/lib/ramaze/controller/error.rb +43 -0
- data/lib/ramaze/controller/render.rb +90 -0
- data/lib/ramaze/controller/resolve.rb +147 -0
- data/lib/ramaze/dispatcher.rb +41 -9
- data/lib/ramaze/dispatcher/file.rb +1 -1
- data/lib/ramaze/global.rb +73 -158
- data/lib/ramaze/global/dsl.rb +29 -0
- data/lib/ramaze/global/globalstruct.rb +90 -0
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +39 -179
- data/lib/ramaze/helper/cache.rb +8 -9
- data/lib/ramaze/helper/cgi.rb +23 -0
- data/lib/ramaze/helper/file.rb +3 -0
- data/lib/ramaze/helper/inform.rb +3 -0
- data/lib/ramaze/helper/link.rb +56 -63
- data/lib/ramaze/helper/nitroform.rb +4 -0
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/inform.rb +6 -2
- data/lib/ramaze/inform/analogger.rb +5 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informing.rb +7 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +2 -0
- data/lib/ramaze/snippets/kernel/constant.rb +2 -0
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +2 -0
- data/lib/ramaze/snippets/object/traits.rb +4 -0
- data/lib/ramaze/snippets/openstruct/temp.rb +3 -0
- data/lib/ramaze/snippets/string/DIVIDE.rb +2 -0
- data/lib/ramaze/snippets/string/camel_case.rb +2 -0
- data/lib/ramaze/snippets/string/color.rb +2 -0
- data/lib/ramaze/snippets/string/each.rb +2 -0
- data/lib/ramaze/snippets/string/snake_case.rb +3 -0
- data/lib/ramaze/snippets/struct/fill.rb +8 -2
- data/lib/ramaze/snippets/struct/values_at.rb +16 -0
- data/lib/ramaze/snippets/symbol/to_proc.rb +3 -0
- data/lib/ramaze/sourcereload.rb +89 -0
- data/lib/ramaze/template.rb +21 -12
- data/lib/ramaze/template/amrita2.rb +6 -6
- data/lib/ramaze/template/erubis.rb +4 -9
- data/lib/ramaze/template/ezamar.rb +13 -57
- data/lib/ramaze/template/ezamar/element.rb +10 -12
- data/lib/ramaze/template/ezamar/engine.rb +40 -101
- data/lib/ramaze/template/ezamar/morpher.rb +3 -3
- data/lib/ramaze/template/haml.rb +3 -6
- data/lib/ramaze/template/liquid.rb +4 -9
- data/lib/ramaze/template/markaby.rb +16 -22
- data/lib/ramaze/template/remarkably.rb +28 -0
- data/lib/ramaze/tool/mime.rb +2 -0
- data/lib/ramaze/tool/record.rb +6 -0
- data/lib/ramaze/trinity/request.rb +44 -54
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +15 -37
- data/lib/ramaze/version.rb +1 -1
- data/rake_tasks/gem.rake +2 -2
- data/rake_tasks/maintaince.rake +42 -1
- data/rake_tasks/spec.rake +45 -0
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/templates/template_amrita2.rb +1 -0
- data/spec/examples/templates/template_erubis.rb +2 -1
- data/spec/examples/templates/template_ezamar.rb +1 -1
- data/spec/examples/templates/template_haml.rb +2 -1
- data/spec/examples/templates/template_liquid.rb +2 -1
- data/spec/examples/templates/template_markaby.rb +2 -1
- data/spec/examples/templates/template_remarkably.rb +22 -0
- data/spec/examples/todolist.rb +125 -0
- data/spec/helper.rb +2 -23
- data/spec/helper/minimal.rb +20 -0
- data/spec/helper/mock_http.rb +24 -30
- data/spec/helper/simple_http.rb +2 -2
- data/spec/helper/wrap.rb +6 -9
- data/spec/ramaze/adapter.rb +1 -1
- data/spec/ramaze/adapter/record.rb +31 -0
- data/spec/ramaze/cache.rb +41 -54
- data/spec/ramaze/controller.rb +121 -137
- data/spec/ramaze/controller/template/list.xhtml +1 -0
- data/spec/ramaze/controller/template/other/greet/other.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +27 -3
- data/spec/ramaze/element.rb +11 -7
- data/spec/ramaze/error.rb +1 -1
- data/spec/ramaze/gestalt.rb +2 -0
- data/spec/ramaze/helper/aspect.rb +30 -21
- data/spec/ramaze/helper/auth.rb +1 -1
- data/spec/ramaze/helper/cache.rb +2 -1
- data/spec/ramaze/helper/form.rb +14 -11
- data/spec/ramaze/helper/link.rb +18 -41
- data/spec/ramaze/localize.rb +29 -2
- data/spec/ramaze/morpher.rb +23 -12
- data/spec/ramaze/params.rb +46 -24
- data/spec/ramaze/request.rb +6 -2
- data/spec/ramaze/store/yaml.rb +5 -0
- data/spec/ramaze/template.rb +22 -27
- data/spec/ramaze/template/amrita2.rb +1 -2
- data/spec/ramaze/template/erubis.rb +1 -1
- data/spec/ramaze/template/ezamar.rb +1 -2
- data/spec/ramaze/template/haml.rb +2 -2
- data/spec/ramaze/template/haml/with_vars.haml +1 -1
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/remarkably.rb +56 -0
- data/spec/ramaze/template/remarkably/external.rem +8 -0
- data/spec/ramaze/template/remarkably/sum.rem +1 -0
- metadata +38 -63
- data/doc/README.html +0 -637
- data/doc/allison/LICENSE +0 -184
- data/doc/allison/README +0 -37
- data/doc/allison/allison.css +0 -299
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/allison.js +0 -307
- data/doc/allison/allison.rb +0 -287
- data/doc/allison/cache/BODY +0 -588
- data/doc/allison/cache/CLASS_INDEX +0 -4
- data/doc/allison/cache/CLASS_PAGE +0 -1
- data/doc/allison/cache/FILE_INDEX +0 -4
- data/doc/allison/cache/FILE_PAGE +0 -1
- data/doc/allison/cache/FONTS +0 -1
- data/doc/allison/cache/FR_INDEX_BODY +0 -1
- data/doc/allison/cache/IMGPATH +0 -1
- data/doc/allison/cache/INDEX +0 -1
- data/doc/allison/cache/JAVASCRIPT +0 -307
- data/doc/allison/cache/METHOD_INDEX +0 -4
- data/doc/allison/cache/METHOD_LIST +0 -1
- data/doc/allison/cache/SRC_PAGE +0 -1
- data/doc/allison/cache/STYLE +0 -321
- data/doc/allison/cache/URL +0 -1
- data/doc/changes.txt +0 -3375
- data/doc/changes.xml +0 -3378
- data/examples/todolist/conf/benchmark.yaml +0 -35
- data/examples/todolist/conf/debug.yaml +0 -34
- data/examples/todolist/conf/live.yaml +0 -33
- data/examples/todolist/conf/silent.yaml +0 -31
- data/examples/todolist/conf/stage.yaml +0 -33
- data/examples/todolist/public/css/coderay.css +0 -105
- data/examples/todolist/public/css/ramaze_error.css +0 -42
- data/lib/proto/conf/benchmark.yaml +0 -21
- data/lib/proto/conf/debug.yaml +0 -21
- data/lib/proto/conf/live.yaml +0 -21
- data/lib/proto/conf/silent.yaml +0 -21
- data/lib/proto/conf/stage.yaml +0 -21
- data/lib/proto/public/css/coderay.css +0 -105
- data/lib/ramaze/http_status.rb +0 -66
- data/lib/ramaze/snippets/hash/keys_to_sym.rb +0 -19
- data/lib/ramaze/snippets/kernel/method.rb +0 -26
- data/lib/ramaze/snippets/method/name.rb +0 -22
- data/lib/ramaze/snippets/ramaze/autoreload.rb +0 -135
- data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +0 -65
- data/spec/all.rb +0 -32
- data/spec/ramaze/conf/locale_de.yaml +0 -6
- data/spec/ramaze/conf/locale_en.yaml +0 -6
- data/spec/ramaze/dependencies.rb +0 -16
- data/spec/ramaze/global.rb +0 -44
|
@@ -15,33 +15,27 @@ module Ramaze
|
|
|
15
15
|
# Also tries to render the template.
|
|
16
16
|
# In Theory you can use this standalone, this has not been tested though.
|
|
17
17
|
|
|
18
|
-
def transform
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
unless controller.private_methods.include?(action)
|
|
22
|
-
reaction = controller.__send__(action, *parameter)
|
|
23
|
-
template =
|
|
24
|
-
if file
|
|
25
|
-
transform_file(controller, file)
|
|
26
|
-
elsif reaction.respond_to?(:to_str)
|
|
27
|
-
reaction
|
|
28
|
-
end
|
|
29
|
-
return template if template
|
|
30
|
-
end
|
|
18
|
+
def transform action
|
|
19
|
+
result, file = result_and_file(action)
|
|
31
20
|
|
|
32
|
-
|
|
21
|
+
result = transform_file(file, action) if file
|
|
22
|
+
result.to_s
|
|
33
23
|
end
|
|
34
24
|
|
|
35
|
-
def transform_file
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
25
|
+
def transform_file file, action
|
|
26
|
+
controller = action.controller
|
|
27
|
+
ivs = extract_ivs(controller)
|
|
28
|
+
|
|
40
29
|
controller.send(:mab, ivs) do
|
|
41
|
-
instance_eval(
|
|
30
|
+
instance_eval(file)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def extract_ivs(controller)
|
|
35
|
+
controller.instance_variables.inject({}) do |hash, iv|
|
|
36
|
+
sym = iv.gsub('@', '').to_sym
|
|
37
|
+
hash.merge! sym => controller.instance_variable_get(iv)
|
|
42
38
|
end
|
|
43
|
-
rescue Object => ex
|
|
44
|
-
raise Error::Template, ex.message, ex.backtrace
|
|
45
39
|
end
|
|
46
40
|
end
|
|
47
41
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
+
|
|
4
|
+
require 'remarkably/engines/html'
|
|
5
|
+
|
|
6
|
+
module Ramaze
|
|
7
|
+
module Template
|
|
8
|
+
class Remarkably < Template
|
|
9
|
+
Controller.register_engine self, %w[ rem ]
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def transform action
|
|
13
|
+
result, file = result_and_file(action)
|
|
14
|
+
|
|
15
|
+
result = transform_file(file, action) if file
|
|
16
|
+
result.to_s
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def transform_file(file, action)
|
|
20
|
+
action.controller.instance_eval do
|
|
21
|
+
args = action.params
|
|
22
|
+
instance_eval(file)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/ramaze/tool/mime.rb
CHANGED
|
@@ -12,7 +12,7 @@ module Ramaze
|
|
|
12
12
|
# The purpose of this class is to act as a simple wrapper for Rack::Request
|
|
13
13
|
# and provide some convinient methods for our own use.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
class Request < ::Rack::Request
|
|
16
16
|
class << self
|
|
17
17
|
|
|
18
18
|
# get the current request out of Thread.current[:request]
|
|
@@ -24,33 +24,6 @@ module Ramaze
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# shortcut for request.params[key]
|
|
28
|
-
|
|
29
|
-
def [](key)
|
|
30
|
-
params[key.to_s]
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# shortcut for request.params[key] = value
|
|
34
|
-
|
|
35
|
-
def []=(key, value)
|
|
36
|
-
params[key.to_s] = value
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# like Hash#values_at
|
|
40
|
-
|
|
41
|
-
def values_at(*keys)
|
|
42
|
-
keys.map{|key| params[key] }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# the referer of the client or '/'
|
|
47
|
-
|
|
48
|
-
def referer
|
|
49
|
-
env['HTTP_REFERER'] || '/'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
alias referrer referer
|
|
53
|
-
|
|
54
27
|
# you can access the original @request via this method_missing,
|
|
55
28
|
# first it tries to match your method with any of the HTTP parameters
|
|
56
29
|
# then, in case that fails, it will relay to @request
|
|
@@ -61,35 +34,52 @@ module Ramaze
|
|
|
61
34
|
super
|
|
62
35
|
end
|
|
63
36
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
unless defined?(fullpath)
|
|
67
|
-
def fullpath
|
|
68
|
-
path = script_name + path_info
|
|
69
|
-
path << "?" << query_string unless query_string.empty?
|
|
70
|
-
path
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
unless defined?(rack_params)
|
|
75
|
-
alias rack_params params
|
|
76
|
-
|
|
77
|
-
def params
|
|
78
|
-
ps = rack_params
|
|
79
|
-
temp = Hash.new{|h,k| h[k] = {}}
|
|
37
|
+
unless defined?(rack_params)
|
|
38
|
+
alias rack_params params
|
|
80
39
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
40
|
+
# Wrapping Request#params to support a one-level hash notation.
|
|
41
|
+
# It doesn't support anything really fancy, so be conservative in its use.
|
|
42
|
+
#
|
|
43
|
+
# Example Usage:
|
|
44
|
+
#
|
|
45
|
+
# # Template:
|
|
46
|
+
#
|
|
47
|
+
# <form action="/paste">
|
|
48
|
+
# <input type="text" name="paste[name]" />
|
|
49
|
+
# <input type="text" name="paste[syntax]" />
|
|
50
|
+
# <input type="submit" />
|
|
51
|
+
# </form>
|
|
52
|
+
#
|
|
53
|
+
# # In your Controller:
|
|
54
|
+
#
|
|
55
|
+
# def paste
|
|
56
|
+
# name, syntax = request.params['paste'].values_at('name', 'syntax')
|
|
57
|
+
# paste = Paste.create_with(:name => name, :syntax => syntax)
|
|
58
|
+
# redirect '/'
|
|
59
|
+
# end
|
|
60
|
+
#
|
|
61
|
+
# # Or, easier:
|
|
62
|
+
#
|
|
63
|
+
# def paste
|
|
64
|
+
# paste = Paste.create_with(request.params)
|
|
65
|
+
# redirect '/'
|
|
66
|
+
# end
|
|
67
|
+
|
|
68
|
+
def params
|
|
69
|
+
ps = rack_params
|
|
70
|
+
temp = {}
|
|
71
|
+
|
|
72
|
+
ps.each do |key, value|
|
|
73
|
+
outer_key, inner_key = key.scan(/^(.+)\[(.*?)\]$/).first
|
|
74
|
+
if outer_key and inner_key
|
|
75
|
+
temp[outer_key] ||= {}
|
|
76
|
+
temp[outer_key][inner_key] = value
|
|
77
|
+
else
|
|
78
|
+
temp[key] = value
|
|
91
79
|
end
|
|
92
80
|
end
|
|
81
|
+
|
|
82
|
+
temp
|
|
93
83
|
end
|
|
94
84
|
end
|
|
95
85
|
end
|
|
@@ -22,7 +22,7 @@ module Ramaze
|
|
|
22
22
|
old = @hash.dup
|
|
23
23
|
result = @hash.send(*args, &block)
|
|
24
24
|
unless old == @hash
|
|
25
|
-
|
|
25
|
+
Cache.sessions[Session.current.session_id] = self
|
|
26
26
|
end
|
|
27
27
|
result
|
|
28
28
|
end
|
|
@@ -53,14 +53,19 @@ module Ramaze
|
|
|
53
53
|
|
|
54
54
|
SESSION_KEY = '_ramaze_session_id'
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
IP_CACHE = Hash.new{|h,k| h[k] = []}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
trait :ip_cache_limit => 1000
|
|
58
|
+
IP_CACHE_LIMIT = 1000
|
|
61
59
|
|
|
62
60
|
class << self
|
|
63
61
|
|
|
62
|
+
# called from Ramaze::startup and adds Cache.sessions if cookies are
|
|
63
|
+
# enabled
|
|
64
|
+
|
|
65
|
+
def startup(options = {})
|
|
66
|
+
Cache.add(:sessions) if Global.cookies
|
|
67
|
+
end
|
|
68
|
+
|
|
64
69
|
# answers with Thread.current[:session] which holds the current session
|
|
65
70
|
# set by the Dispatcher#setup_environment.
|
|
66
71
|
|
|
@@ -73,34 +78,18 @@ module Ramaze
|
|
|
73
78
|
# given to us from Dispatcher#setup_environment.
|
|
74
79
|
#
|
|
75
80
|
# sets @session_id and @session_flash
|
|
76
|
-
#
|
|
77
|
-
# will set Thread.main[:session_cache] to an instance of
|
|
78
|
-
# Ramaze::Global.cache if no cache for the sessions is initialized yet
|
|
79
81
|
|
|
80
82
|
def initialize request
|
|
81
83
|
@session_id = (request.cookies[SESSION_KEY] || random_key)
|
|
82
|
-
ip_cache =
|
|
84
|
+
ip_cache = IP_CACHE
|
|
83
85
|
ip = request.remote_addr
|
|
84
86
|
ip_cache[ip] << @session_id
|
|
85
87
|
|
|
86
|
-
if ip_cache[ip].size
|
|
88
|
+
if ip_cache[ip].size > IP_CACHE_LIMIT
|
|
87
89
|
sessions.delete(ip_cache[ip].shift)
|
|
88
90
|
end
|
|
89
91
|
|
|
90
92
|
@flash = Ramaze::SessionFlash.new
|
|
91
|
-
|
|
92
|
-
unless sessions
|
|
93
|
-
global_cache = Ramaze::Global.cache
|
|
94
|
-
|
|
95
|
-
if global_cache.respond_to?(:new)
|
|
96
|
-
cache = global_cache.new
|
|
97
|
-
else
|
|
98
|
-
cache = constant("::Ramaze::#{global_cache}")
|
|
99
|
-
cache = cache.new if cache.respond_to?(:new)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
Thread.main[:session_cache] = cache
|
|
103
|
-
end
|
|
104
93
|
end
|
|
105
94
|
|
|
106
95
|
# relay all messages we don't understand to the currently active session
|
|
@@ -116,10 +105,10 @@ module Ramaze
|
|
|
116
105
|
sessions[session_id] ||= SessionHash.new
|
|
117
106
|
end
|
|
118
107
|
|
|
119
|
-
# shortcut to
|
|
108
|
+
# shortcut to Cache.sessions
|
|
120
109
|
|
|
121
110
|
def sessions
|
|
122
|
-
|
|
111
|
+
Cache.sessions
|
|
123
112
|
end
|
|
124
113
|
|
|
125
114
|
# generate a random (and hopefully unique) id for the current session.
|
|
@@ -140,28 +129,17 @@ module Ramaze
|
|
|
140
129
|
Digest::SHA256.hexdigest(h)
|
|
141
130
|
end
|
|
142
131
|
|
|
143
|
-
# send each element of the trait[:finalize]
|
|
144
|
-
# this is at the moment used for flash_finalize.
|
|
145
|
-
|
|
146
|
-
def finalize
|
|
147
|
-
ancestral_trait[:finalize].each do |meth|
|
|
148
|
-
send meth
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
132
|
def inspect
|
|
153
133
|
current.inspect
|
|
154
134
|
end
|
|
155
135
|
|
|
156
|
-
private
|
|
157
|
-
|
|
158
136
|
# at the end of a request delete the current[:FLASH] and assign it to
|
|
159
137
|
# current[:FLASH_PREVIOUS]
|
|
160
138
|
#
|
|
161
139
|
# this is needed so flash can iterate over requests
|
|
162
140
|
# and always just keep the current and previous key/value pairs.
|
|
163
141
|
|
|
164
|
-
def
|
|
142
|
+
def finalize
|
|
165
143
|
old = delete(:FLASH)
|
|
166
144
|
current[:FLASH_PREVIOUS] = old if old
|
|
167
145
|
end
|
data/lib/ramaze/version.rb
CHANGED
data/rake_tasks/gem.rake
CHANGED
|
@@ -17,8 +17,8 @@ spec =
|
|
|
17
17
|
s.post_install_message = POST_INSTALL_MESSAGE
|
|
18
18
|
|
|
19
19
|
s.add_dependency('rake', '>=0.7.3')
|
|
20
|
-
s.add_dependency('rspec', '>=0.
|
|
21
|
-
s.add_dependency('rack', '>=0.
|
|
20
|
+
s.add_dependency('rspec', '>=1.0.2')
|
|
21
|
+
s.add_dependency('rack', '>=0.2.0')
|
|
22
22
|
# s.required_ruby_version = '>= 1.8.5'
|
|
23
23
|
|
|
24
24
|
s.files = (RDOC_FILES + %w[Rakefile] + Dir["{examples,bin,doc,spec,lib,rake_tasks}/**/*"]).uniq
|
data/rake_tasks/maintaince.rake
CHANGED
|
@@ -119,7 +119,7 @@ task 'tutorial2html' do
|
|
|
119
119
|
|
|
120
120
|
basefile = File.join('doc', 'tutorial', 'todolist')
|
|
121
121
|
|
|
122
|
-
content = File.read(basefile + '.
|
|
122
|
+
content = File.read(basefile + '.mkd')
|
|
123
123
|
|
|
124
124
|
html = BlueCloth.new(content).to_html
|
|
125
125
|
|
|
@@ -156,6 +156,47 @@ task 'tutorial2html' do
|
|
|
156
156
|
File.open(basefile + '.html', 'w+'){|f| f.puts(wrap) }
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
+
task 'tutorial' => ['tutorial2html'] do
|
|
160
|
+
require 'hpricot'
|
|
161
|
+
|
|
162
|
+
system 'rake tutorial2html'
|
|
163
|
+
|
|
164
|
+
filename = 'doc/tutorial/todolist.html'
|
|
165
|
+
file = File.read(filename)
|
|
166
|
+
doc = Hpricot(file)
|
|
167
|
+
|
|
168
|
+
to_links = []
|
|
169
|
+
|
|
170
|
+
(doc/:h2).each do |h2|
|
|
171
|
+
text = h2.inner_html
|
|
172
|
+
link_id = text.gsub(' ', '_')
|
|
173
|
+
to_links << %{<a href="##{link_id}">#{text}</a>}
|
|
174
|
+
to_link = %{<a name="#{link_id}"><h2>#{text}</h2></a>}
|
|
175
|
+
|
|
176
|
+
file.gsub!(h2.to_html, to_link)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
links = to_links.join("</ol>\n <ol>")
|
|
180
|
+
h1 = "<h1>To-do List Tutorial</h1>"
|
|
181
|
+
menu =
|
|
182
|
+
%{
|
|
183
|
+
#{h1}
|
|
184
|
+
|
|
185
|
+
<div class="menu">
|
|
186
|
+
<h3>Table of Contents</h3>
|
|
187
|
+
<li>
|
|
188
|
+
<ol>#{links}</ol>
|
|
189
|
+
</li>
|
|
190
|
+
</div>
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
file.gsub!(h1, menu)
|
|
194
|
+
|
|
195
|
+
File.open(filename, 'w+') do |f|
|
|
196
|
+
f.puts file
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
159
200
|
task 'authors' do
|
|
160
201
|
changes = `darcs changes`
|
|
161
202
|
authors = []
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
+
|
|
4
|
+
require 'rake'
|
|
5
|
+
require 'spec/helper/layout'
|
|
6
|
+
require 'lib/ramaze/snippets/string/DIVIDE'
|
|
7
|
+
|
|
8
|
+
SPEC_BASE = File.expand_path('spec')
|
|
9
|
+
|
|
10
|
+
# ignore files with these paths
|
|
11
|
+
ignores = [ './*', './helper/*', './ramaze/adapter.rb', './ramaze/request.rb', ]
|
|
12
|
+
|
|
13
|
+
files = Dir[SPEC_BASE/'**'/'*.rb']
|
|
14
|
+
ignores.each do |ignore|
|
|
15
|
+
ignore_files = Dir[SPEC_BASE/ignore]
|
|
16
|
+
ignore_files.each do |ignore_file|
|
|
17
|
+
files.delete File.expand_path(ignore_file)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
files.sort!
|
|
22
|
+
|
|
23
|
+
spec_layout = Hash.new{|h,k| h[k] = []}
|
|
24
|
+
|
|
25
|
+
files.each do |file|
|
|
26
|
+
name = file.gsub(/^#{SPEC_BASE}/, '.')
|
|
27
|
+
dir_name = File.dirname(name)[2..-1]
|
|
28
|
+
task_name = ([:test] + dir_name.split('/')).join(':')
|
|
29
|
+
spec_layout[task_name] << file
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
spec_layout.each do |task_name, specs|
|
|
33
|
+
|
|
34
|
+
desc task_name
|
|
35
|
+
task task_name => [:clean] do
|
|
36
|
+
wrap = SpecWrap.new(*specs)
|
|
37
|
+
wrap.run
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc "Test all"
|
|
42
|
+
task "test:all" => [:clean] do
|
|
43
|
+
wrap = SpecWrap.new(*spec_layout.values.flatten)
|
|
44
|
+
wrap.run
|
|
45
|
+
end
|