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.
Files changed (195) hide show
  1. data/Rakefile +4 -12
  2. data/bin/ramaze +95 -171
  3. data/doc/CHANGELOG +387 -4
  4. data/doc/README +81 -13
  5. data/doc/meta/announcement.txt +51 -8
  6. data/doc/meta/configuration.txt +17 -34
  7. data/doc/meta/internals.txt +34 -4
  8. data/doc/migrate/1110_to_1111.txt +131 -0
  9. data/doc/readme_chunks/features.txt +81 -12
  10. data/doc/readme_chunks/installing.txt +0 -1
  11. data/doc/tutorial/todolist.html +293 -65
  12. data/doc/tutorial/{todolist.txt → todolist.mkd} +251 -51
  13. data/examples/blog/main.rb +1 -1
  14. data/examples/blog/src/model.rb +0 -1
  15. data/examples/hello.rb +2 -5
  16. data/examples/templates/template/external.haml +5 -5
  17. data/examples/templates/template/external.liquid +1 -1
  18. data/examples/templates/template/external.mab +8 -8
  19. data/examples/templates/template/external.rem +30 -0
  20. data/examples/templates/template/external.rhtml +6 -7
  21. data/examples/templates/template/external.zmr +13 -9
  22. data/examples/templates/template_amrita2.rb +8 -8
  23. data/examples/templates/template_erubis.rb +11 -11
  24. data/examples/templates/template_ezamar.rb +9 -11
  25. data/examples/templates/template_haml.rb +13 -13
  26. data/examples/templates/template_liquid.rb +10 -10
  27. data/examples/templates/template_markaby.rb +13 -10
  28. data/examples/templates/template_remarkably.rb +59 -0
  29. data/examples/todolist/main.rb +1 -7
  30. data/examples/todolist/src/controller/main.rb +26 -13
  31. data/examples/todolist/src/element/page.rb +5 -0
  32. data/examples/whywiki/main.rb +1 -1
  33. data/lib/proto/main.rb +0 -8
  34. data/lib/proto/public/css/ramaze_error.css +12 -4
  35. data/lib/proto/public/error.zmr +6 -25
  36. data/lib/ramaze.rb +35 -245
  37. data/lib/ramaze/action.rb +21 -0
  38. data/lib/ramaze/adapter.rb +94 -29
  39. data/lib/ramaze/adapter/base.rb +57 -0
  40. data/lib/ramaze/adapter/mongrel.rb +12 -19
  41. data/lib/ramaze/adapter/webrick.rb +21 -20
  42. data/lib/ramaze/cache.rb +47 -3
  43. data/lib/ramaze/cache/memcached.rb +22 -0
  44. data/lib/ramaze/cache/yaml_store.rb +19 -0
  45. data/lib/ramaze/controller.rb +47 -271
  46. data/lib/ramaze/controller/error.rb +43 -0
  47. data/lib/ramaze/controller/render.rb +90 -0
  48. data/lib/ramaze/controller/resolve.rb +147 -0
  49. data/lib/ramaze/dispatcher.rb +41 -9
  50. data/lib/ramaze/dispatcher/file.rb +1 -1
  51. data/lib/ramaze/global.rb +73 -158
  52. data/lib/ramaze/global/dsl.rb +29 -0
  53. data/lib/ramaze/global/globalstruct.rb +90 -0
  54. data/lib/ramaze/helper.rb +1 -1
  55. data/lib/ramaze/helper/aspect.rb +39 -179
  56. data/lib/ramaze/helper/cache.rb +8 -9
  57. data/lib/ramaze/helper/cgi.rb +23 -0
  58. data/lib/ramaze/helper/file.rb +3 -0
  59. data/lib/ramaze/helper/inform.rb +3 -0
  60. data/lib/ramaze/helper/link.rb +56 -63
  61. data/lib/ramaze/helper/nitroform.rb +4 -0
  62. data/lib/ramaze/helper/redirect.rb +1 -1
  63. data/lib/ramaze/inform.rb +6 -2
  64. data/lib/ramaze/inform/analogger.rb +5 -1
  65. data/lib/ramaze/inform/hub.rb +1 -1
  66. data/lib/ramaze/inform/informing.rb +7 -0
  67. data/lib/ramaze/snippets/kernel/aquire.rb +2 -0
  68. data/lib/ramaze/snippets/kernel/constant.rb +2 -0
  69. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +2 -0
  70. data/lib/ramaze/snippets/object/traits.rb +4 -0
  71. data/lib/ramaze/snippets/openstruct/temp.rb +3 -0
  72. data/lib/ramaze/snippets/string/DIVIDE.rb +2 -0
  73. data/lib/ramaze/snippets/string/camel_case.rb +2 -0
  74. data/lib/ramaze/snippets/string/color.rb +2 -0
  75. data/lib/ramaze/snippets/string/each.rb +2 -0
  76. data/lib/ramaze/snippets/string/snake_case.rb +3 -0
  77. data/lib/ramaze/snippets/struct/fill.rb +8 -2
  78. data/lib/ramaze/snippets/struct/values_at.rb +16 -0
  79. data/lib/ramaze/snippets/symbol/to_proc.rb +3 -0
  80. data/lib/ramaze/sourcereload.rb +89 -0
  81. data/lib/ramaze/template.rb +21 -12
  82. data/lib/ramaze/template/amrita2.rb +6 -6
  83. data/lib/ramaze/template/erubis.rb +4 -9
  84. data/lib/ramaze/template/ezamar.rb +13 -57
  85. data/lib/ramaze/template/ezamar/element.rb +10 -12
  86. data/lib/ramaze/template/ezamar/engine.rb +40 -101
  87. data/lib/ramaze/template/ezamar/morpher.rb +3 -3
  88. data/lib/ramaze/template/haml.rb +3 -6
  89. data/lib/ramaze/template/liquid.rb +4 -9
  90. data/lib/ramaze/template/markaby.rb +16 -22
  91. data/lib/ramaze/template/remarkably.rb +28 -0
  92. data/lib/ramaze/tool/mime.rb +2 -0
  93. data/lib/ramaze/tool/record.rb +6 -0
  94. data/lib/ramaze/trinity/request.rb +44 -54
  95. data/lib/ramaze/trinity/response.rb +1 -1
  96. data/lib/ramaze/trinity/session.rb +15 -37
  97. data/lib/ramaze/version.rb +1 -1
  98. data/rake_tasks/gem.rake +2 -2
  99. data/rake_tasks/maintaince.rake +42 -1
  100. data/rake_tasks/spec.rake +45 -0
  101. data/spec/examples/caching.rb +1 -1
  102. data/spec/examples/simple.rb +1 -1
  103. data/spec/examples/templates/template_amrita2.rb +1 -0
  104. data/spec/examples/templates/template_erubis.rb +2 -1
  105. data/spec/examples/templates/template_ezamar.rb +1 -1
  106. data/spec/examples/templates/template_haml.rb +2 -1
  107. data/spec/examples/templates/template_liquid.rb +2 -1
  108. data/spec/examples/templates/template_markaby.rb +2 -1
  109. data/spec/examples/templates/template_remarkably.rb +22 -0
  110. data/spec/examples/todolist.rb +125 -0
  111. data/spec/helper.rb +2 -23
  112. data/spec/helper/minimal.rb +20 -0
  113. data/spec/helper/mock_http.rb +24 -30
  114. data/spec/helper/simple_http.rb +2 -2
  115. data/spec/helper/wrap.rb +6 -9
  116. data/spec/ramaze/adapter.rb +1 -1
  117. data/spec/ramaze/adapter/record.rb +31 -0
  118. data/spec/ramaze/cache.rb +41 -54
  119. data/spec/ramaze/controller.rb +121 -137
  120. data/spec/ramaze/controller/template/list.xhtml +1 -0
  121. data/spec/ramaze/controller/template/other/greet/other.xhtml +1 -0
  122. data/spec/ramaze/controller/template_resolving.rb +27 -3
  123. data/spec/ramaze/element.rb +11 -7
  124. data/spec/ramaze/error.rb +1 -1
  125. data/spec/ramaze/gestalt.rb +2 -0
  126. data/spec/ramaze/helper/aspect.rb +30 -21
  127. data/spec/ramaze/helper/auth.rb +1 -1
  128. data/spec/ramaze/helper/cache.rb +2 -1
  129. data/spec/ramaze/helper/form.rb +14 -11
  130. data/spec/ramaze/helper/link.rb +18 -41
  131. data/spec/ramaze/localize.rb +29 -2
  132. data/spec/ramaze/morpher.rb +23 -12
  133. data/spec/ramaze/params.rb +46 -24
  134. data/spec/ramaze/request.rb +6 -2
  135. data/spec/ramaze/store/yaml.rb +5 -0
  136. data/spec/ramaze/template.rb +22 -27
  137. data/spec/ramaze/template/amrita2.rb +1 -2
  138. data/spec/ramaze/template/erubis.rb +1 -1
  139. data/spec/ramaze/template/ezamar.rb +1 -2
  140. data/spec/ramaze/template/haml.rb +2 -2
  141. data/spec/ramaze/template/haml/with_vars.haml +1 -1
  142. data/spec/ramaze/template/liquid.rb +1 -1
  143. data/spec/ramaze/template/markaby.rb +1 -1
  144. data/spec/ramaze/template/remarkably.rb +56 -0
  145. data/spec/ramaze/template/remarkably/external.rem +8 -0
  146. data/spec/ramaze/template/remarkably/sum.rem +1 -0
  147. metadata +38 -63
  148. data/doc/README.html +0 -637
  149. data/doc/allison/LICENSE +0 -184
  150. data/doc/allison/README +0 -37
  151. data/doc/allison/allison.css +0 -299
  152. data/doc/allison/allison.gif +0 -0
  153. data/doc/allison/allison.js +0 -307
  154. data/doc/allison/allison.rb +0 -287
  155. data/doc/allison/cache/BODY +0 -588
  156. data/doc/allison/cache/CLASS_INDEX +0 -4
  157. data/doc/allison/cache/CLASS_PAGE +0 -1
  158. data/doc/allison/cache/FILE_INDEX +0 -4
  159. data/doc/allison/cache/FILE_PAGE +0 -1
  160. data/doc/allison/cache/FONTS +0 -1
  161. data/doc/allison/cache/FR_INDEX_BODY +0 -1
  162. data/doc/allison/cache/IMGPATH +0 -1
  163. data/doc/allison/cache/INDEX +0 -1
  164. data/doc/allison/cache/JAVASCRIPT +0 -307
  165. data/doc/allison/cache/METHOD_INDEX +0 -4
  166. data/doc/allison/cache/METHOD_LIST +0 -1
  167. data/doc/allison/cache/SRC_PAGE +0 -1
  168. data/doc/allison/cache/STYLE +0 -321
  169. data/doc/allison/cache/URL +0 -1
  170. data/doc/changes.txt +0 -3375
  171. data/doc/changes.xml +0 -3378
  172. data/examples/todolist/conf/benchmark.yaml +0 -35
  173. data/examples/todolist/conf/debug.yaml +0 -34
  174. data/examples/todolist/conf/live.yaml +0 -33
  175. data/examples/todolist/conf/silent.yaml +0 -31
  176. data/examples/todolist/conf/stage.yaml +0 -33
  177. data/examples/todolist/public/css/coderay.css +0 -105
  178. data/examples/todolist/public/css/ramaze_error.css +0 -42
  179. data/lib/proto/conf/benchmark.yaml +0 -21
  180. data/lib/proto/conf/debug.yaml +0 -21
  181. data/lib/proto/conf/live.yaml +0 -21
  182. data/lib/proto/conf/silent.yaml +0 -21
  183. data/lib/proto/conf/stage.yaml +0 -21
  184. data/lib/proto/public/css/coderay.css +0 -105
  185. data/lib/ramaze/http_status.rb +0 -66
  186. data/lib/ramaze/snippets/hash/keys_to_sym.rb +0 -19
  187. data/lib/ramaze/snippets/kernel/method.rb +0 -26
  188. data/lib/ramaze/snippets/method/name.rb +0 -22
  189. data/lib/ramaze/snippets/ramaze/autoreload.rb +0 -135
  190. data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +0 -65
  191. data/spec/all.rb +0 -32
  192. data/spec/ramaze/conf/locale_de.yaml +0 -6
  193. data/spec/ramaze/conf/locale_en.yaml +0 -6
  194. data/spec/ramaze/dependencies.rb +0 -16
  195. data/spec/ramaze/global.rb +0 -44
@@ -0,0 +1,29 @@
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
+ module Ramaze
5
+ CLIOption = Struct.new('CLIOption', :name, :default, :doc, :cli)
6
+ OPTIONS = {}
7
+ CLI_OPTIONS = []
8
+
9
+ module GlobalDSL
10
+ class << self
11
+ def option_dsl(&block)
12
+ instance_eval(&block)
13
+ end
14
+
15
+ def o(doc, options = {})
16
+ cli_given = options.has_key?(:cli)
17
+ cli = options.delete(:cli)
18
+ name, default = options.to_a.flatten
19
+
20
+ if cli_given
21
+ option = CLIOption.new(name, default, doc, cli)
22
+ CLI_OPTIONS << option
23
+ end
24
+
25
+ OPTIONS.merge!(options)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,90 @@
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
+ module Ramaze
5
+ class GlobalStruct < Struct.new('Global', *OPTIONS.keys)
6
+ ADAPTER_ALIAS = {
7
+ :webrick => :WEBrick,
8
+ :mongrel => :Mongrel,
9
+ :cgi => :CGI,
10
+ :fcgi => :Fcgi,
11
+ }
12
+
13
+ CACHE_ALIAS = {
14
+ :memcached => :MemcachedCache,
15
+ :memory => :MemoryCache,
16
+ :yaml => :YAMLStoreCache,
17
+ }
18
+
19
+ class << self
20
+ def setup options = {}
21
+ self.fill(options)
22
+ end
23
+ end
24
+
25
+ def startup(options = {})
26
+ options.each do |key, value|
27
+ if (method(key) rescue false)
28
+ self[key] = value
29
+ else
30
+ create_member(key, value)
31
+ end
32
+ end
33
+ end
34
+
35
+ def setup(hash = {})
36
+ hash.each do |key, value|
37
+ self.send("#{key}=", value)
38
+ end
39
+ yield(self) if block_given?
40
+ end
41
+
42
+ # Object wraps
43
+
44
+ def adapter
45
+ if internal = self[:adapter]
46
+ class_name = ADAPTER_ALIAS[internal.to_sym]
47
+ require("ramaze/adapter/"/class_name.to_s.downcase)
48
+ adapter = Ramaze::Adapter.const_get(class_name)
49
+ end
50
+ end
51
+
52
+ def cache
53
+ cache_name = self[:cache].to_sym
54
+ class_name = CACHE_ALIAS[cache_name] || cache_name
55
+ cache = Ramaze.const_get(class_name)
56
+ end
57
+
58
+ def ports
59
+ (port..(port + (spawn - 1)))
60
+ end
61
+
62
+ def sourcereload=(interval)
63
+ self[:sourcereload] = interval
64
+ sri = Thread.main[:sourcereload]
65
+ sri.interval = interval if sri
66
+ end
67
+
68
+ # External helpers
69
+
70
+ def values_at(*keys)
71
+ keys.map{|key| __send__(key)}
72
+ end
73
+
74
+ private # Internal helpers
75
+
76
+ def create_member key, value = nil
77
+ Inform.warn "Create #{key}=#{value.inspect} on Global"
78
+
79
+ @table ||= {}
80
+ key = key.to_sym
81
+
82
+ (class << self; self; end).class_eval do
83
+ define_method(key){ @table[key] }
84
+ define_method("#{key}="){|val| @table[key] = val }
85
+ end
86
+
87
+ @table[key] = value
88
+ end
89
+ end
90
+ end
@@ -23,7 +23,7 @@ module Ramaze
23
23
  def helper *syms
24
24
  syms.each do |sym|
25
25
  mod_name = sym.to_s.capitalize + 'Helper'
26
- require "ramaze/helper/#{sym}"
26
+ require("ramaze/helper/"/sym)
27
27
  include ::Ramaze.const_get(mod_name)
28
28
  extend ::Ramaze.const_get(mod_name)
29
29
  end
@@ -13,202 +13,62 @@ module Ramaze
13
13
  # want this feature it shouldn't have too large impact ;)
14
14
 
15
15
  module AspectHelper
16
-
17
- # define the trait[:aspects] for the class that includes us
18
- # also prepare hijacking of the :render method
19
-
20
16
  def self.included(klass)
21
- # if we haven't been included yet...
22
- unless defined?(Traits[klass][:aspects]) and Traits[klass][:aspects]
23
- klass.trait :aspects => {:pre => {}, :post => {}, :wrap => {}}
24
- unless defined?(klass.old_render)
25
- klass.class_eval do
26
- class << self
27
- include AspectHelperMixin
28
- alias_method :old_render, :render
29
- alias_method :render, :new_render
30
-
31
- public :render
32
- end
33
- end
34
- end
35
- end
17
+ klass.trait[:aspects] ||= { :before => {}, :after => {} }
36
18
  end
37
- end
38
-
39
- # This is the actual Module to be included into the Controller you call
40
- # helper :aspect
41
- # from.
42
- #
43
- # The reason for that is to avoid recursion of inclusion in AspectHelper
44
- # which does the aliasing and predefinition of the traits for the aspects.
45
19
 
46
- module AspectHelperMixin
47
20
  private
48
21
 
49
- # define pre-aspect which calls render(:your_pre_aspect)
50
- # and appends it on your default action
51
- # please note, that if you give can define
52
- # pre :all, :all_, :except => [:action1, :action2]
53
- # pre :all, :all_, :except => :action
54
- # however, due to the nature of this helper, only action that have been
55
- # defined so far are wrapped by the :all.
56
- # methods that are in the :except (which is not mandatory) are ignored.
57
- #
58
- # the notion :all_ is a nice reminder that it is a pre-wrapper, you don't
59
- # have to use the underscore, it's just my way to do it.
60
- #
61
- # Also, be careful, since :all will wrap other wraps that have been defined
62
- # so far as well.
63
- # Usually i don't think it's a good thing that order defines
64
- # behaviour, but in this case it gives you quite powerful control
65
- # over the whole process. Just watch out:
66
- # With great power comes great responsibility
67
- #
68
- # Example:
69
- # class FooController < Controller
70
- #
71
- # def index
72
- # 'foo'
73
- # end
74
- # pre :index, :_index
75
- #
76
- # def other
77
- # 'foo'
78
- # end
79
- # pre :all, :all_, :except => :index
80
- #
81
- # def _index
82
- # 'I will be put before your action'
83
- # end
84
- #
85
- # def _all
86
- # '<pre>'
87
- # end
88
- # end
89
-
90
- def pre(*opts)
91
- enwrap(:pre, *opts)
92
- end
93
- alias before pre
94
-
95
- # define post-aspect which calls render(:your_post_aspect)
96
- # and appends it on your default action
97
- # please note, that if you give can define
98
- # post :all, :all_, :except => [:action1, :action2]
99
- # post :all, :all_, :except => :action
100
- # however, due to the nature of this helper, only action that have been
101
- # defined so far are wrapped by the :all.
102
- # methods that are in the :except (which is not mandatory) are ignored.
103
- #
104
- # the notion :all_ is a nice reminder that it is a post-wrapper, you don't
105
- # have to use the underscore, it's just my way to do it.
106
- #
107
- # Also, be careful, since :all will wrap other wraps that have been defined
108
- # so far as well.
109
- # Usually i don't think it's a good thing that order defines
110
- # behaviour, but in this case it gives you quite powerful control
111
- # over the whole process. Just watch out:
112
- # With great power comes great responsibility
113
- #
114
- # Example:
115
- # class FooController < Controller
116
- #
117
- # def index
118
- # 'foo'
119
- # end
120
- # post :index, :index_
121
- #
122
- # def other
123
- # 'foo'
124
- # end
125
- # pre :all, :all_, :except => :index
126
- #
127
- # def index_
128
- # 'I will be put after your action'
129
- # end
130
- #
131
- # def all_
132
- # '</pre>'
133
- # end
134
- # end
135
-
136
- def post(*opts)
137
- enwrap(:post, *opts)
22
+ def before(*meths, &block)
23
+ aspects = trait[:aspects][:before]
24
+ meths.each do |meth|
25
+ aspects[meth.to_s] = block
26
+ end
138
27
  end
139
- alias after post
140
-
141
- # a shortcut that combines pre and post
142
- # same syntax as pre/post, just a linesaver
28
+ alias pre before
143
29
 
144
- def wrap(*opts)
145
- pre(*opts)
146
- post(*opts)
30
+ def before_all(&block)
31
+ meths = instance_methods(false)
32
+ before(*meths, &block)
147
33
  end
34
+ alias pre_all before_all
148
35
 
149
- # you shouldn't have to call this method directly
150
- # however, if you really, really want to:
151
- #
152
- # enwrap(:post, :index, :my_post_method, :except => :bar
153
-
154
- def enwrap(kind, key, meths, hash = {})
155
- wrapping =
156
- if key == :all
157
- instance_methods(false).map{|im| im.to_sym}
158
- else
159
- if ([] + key rescue nil)
160
- key.map{|k| k.to_sym}
161
- else
162
- [key.to_sym]
163
- end
164
- end
165
-
166
- if hash[:except]
167
- wrapping -= [hash[:except]].flatten.map{|m| m.to_sym}
168
- end
169
-
170
- wrapping.each do |meth|
171
- ancestral_trait[:aspects][kind][meth] = meths
36
+ def after(*meths, &block)
37
+ aspects = trait[:aspects][:after]
38
+ meths.each do |meth|
39
+ aspects[meth.to_s] = block
172
40
  end
173
41
  end
42
+ alias post after
174
43
 
175
- # find the post and pre actions for the current class
176
-
177
- def resolve_aspect(action)
178
- action = action.to_sym
179
- aspects = ancestral_trait[:aspects]
180
- {
181
- :pre => aspects[:pre][action],
182
- :post => aspects[:post][action]
183
- }
44
+ def after_all(&block)
45
+ meths = instance_methods(false)
46
+ after(*meths, &block)
184
47
  end
48
+ alias post_all after_all
185
49
 
186
- # this will be exchanged for the :render method which is aliased
187
- # to old_render
188
- # it just searches for post and pre wrappers, calls them
189
- # before/after your action and joins the results
190
-
191
- def new_render(action)
192
- arity_for = lambda{|meth| method(meth).arity rescue -1 }
193
- post, pre = resolve_aspect(action.method).values_at(:post, :pre)
194
-
195
- if pre
196
- arity = arity_for[pre].abs
197
- pre_action = resolve_action(pre, *action.params[0,arity])
198
- pre_content = old_render(pre_action)
199
- end
50
+ def wrap(*meths, &block)
51
+ before(*meths, &block)
52
+ after(*meths, &block)
53
+ end
200
54
 
201
- unless (pre_content.delete(:skip_next_aspects) rescue false)
202
- content = old_render(action)
55
+ def wrap_all(&block)
56
+ meths = instance_methods(false)
57
+ wrap(*meths, &block)
58
+ end
203
59
 
204
- if post
205
- arity = arity_for[post].abs
206
- post_action = resolve_action(post, *action.params[0,arity])
207
- post_content = old_render(post_action)
208
- end
209
- end
60
+ def before_process(action)
61
+ block = ancestral_trait[:aspects][:before][action.method]
62
+ before = action.controller.instance_eval(&block) if block
63
+ before
64
+ end
210
65
 
211
- [pre_content, content, post_content].join
66
+ def after_process(action)
67
+ block = ancestral_trait[:aspects][:after][action.method]
68
+ after = action.controller.instance_eval(&block) if block
69
+ after
212
70
  end
71
+
72
+ module_function :before_process, :after_process
213
73
  end
214
74
  end
@@ -2,15 +2,14 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
- module CacheHelper
6
-
7
- # Cache for single key/value pairs
8
-
9
- trait :value_cache => Global.cache.new
10
5
 
11
- # Cache for values returned from actions
6
+ # This helper is providing easy access to a couple of Caches to use for
7
+ # smaller amounts of data.
12
8
 
13
- trait :action_cache => Controller.trait[:action_cache]
9
+ module CacheHelper
10
+ def self.included(klass)
11
+ Cache.add(:value_cache) unless Cache::CACHES.has_key?(:value_cache)
12
+ end
14
13
 
15
14
  private
16
15
 
@@ -18,7 +17,7 @@ module Ramaze
18
17
  # for example heavy calculations or time-consuming queries.
19
18
 
20
19
  def value_cache
21
- ancestral_trait[:value_cache]
20
+ Cache.value_cache
22
21
  end
23
22
 
24
23
  # holds the values returned on the first call to a cached action.
@@ -38,7 +37,7 @@ module Ramaze
38
37
  # action_cache.delete_if{|key, value| key =~ /"index",/}
39
38
 
40
39
  def action_cache
41
- Controller.trait[:action_cache]
40
+ Cache.actions
42
41
  end
43
42
 
44
43
  # This refers to the class-trait of cached actions, you can
@@ -0,0 +1,23 @@
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
+ module Ramaze
5
+
6
+ # Shortcuts to some CGI methods
7
+
8
+ module CgiHelper
9
+ private
10
+
11
+ # shortcut for CGI.escape
12
+
13
+ def escape(*args)
14
+ CGI.escape(*args)
15
+ end
16
+
17
+ # shortcut for CGI.unescape
18
+
19
+ def unescape(*args)
20
+ CGI.escape(*args)
21
+ end
22
+ end
23
+ end
@@ -5,6 +5,9 @@ module Ramaze
5
5
  module FileHelper
6
6
  private
7
7
 
8
+ # Sets Content-Type to the mimetype of the file and opens the file you pass
9
+ # it, then throws :respond to finish off the request.
10
+
8
11
  def send_file(file, mime_type = Tool::MIME.type_for(file))
9
12
  response.header["Content-Type"] = mime_type
10
13
  response.body = File.open(file)
@@ -2,6 +2,9 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
+
6
+ # Easy access to Inform
7
+
5
8
  module InformHelper
6
9
 
7
10
  private