wee 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. data/ChangeLog +286 -0
  2. data/Features +185 -0
  3. data/doc/rdoc/classes/ActionView.html +107 -0
  4. data/doc/rdoc/classes/ActionView/Base.html +133 -0
  5. data/doc/rdoc/classes/Array.html +7 -59
  6. data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
  7. data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
  8. data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
  9. data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
  10. data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
  11. data/doc/rdoc/classes/Enumerable.html +6 -6
  12. data/doc/rdoc/classes/Hash.html +120 -0
  13. data/doc/rdoc/classes/Main.html +58 -34
  14. data/doc/rdoc/classes/Object.html +12 -12
  15. data/doc/rdoc/classes/OgScaffolder.html +165 -166
  16. data/doc/rdoc/classes/OgScaffolder/Editor.html +112 -112
  17. data/doc/rdoc/classes/String.html +7 -59
  18. data/doc/rdoc/classes/Struct.html +14 -14
  19. data/doc/rdoc/classes/Wee.html +70 -6
  20. data/doc/rdoc/classes/Wee/AbstractSession.html +502 -0
  21. data/doc/rdoc/classes/Wee/AnswerDecoration.html +11 -11
  22. data/doc/rdoc/classes/Wee/Application.html +139 -84
  23. data/doc/rdoc/classes/Wee/Brush.html +21 -18
  24. data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +90 -17
  25. data/doc/rdoc/classes/Wee/Brush/CheckboxTag.html +162 -0
  26. data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +7 -7
  27. data/doc/rdoc/classes/Wee/Brush/FormTag.html +41 -17
  28. data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
  29. data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
  30. data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +112 -86
  31. data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
  32. data/doc/rdoc/classes/Wee/Brush/HiddenInputTag.html +160 -0
  33. data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +15 -15
  34. data/doc/rdoc/classes/Wee/Brush/ImageTag.html +21 -21
  35. data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
  36. data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
  37. data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
  38. data/doc/rdoc/classes/Wee/Brush/RadioButtonTag.html +234 -0
  39. data/doc/rdoc/classes/Wee/Brush/RadioButtonTag/RadioGroup.html +207 -0
  40. data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +124 -28
  41. data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +7 -7
  42. data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
  43. data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +7 -7
  44. data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
  45. data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
  46. data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
  47. data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
  48. data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +48 -15
  49. data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +7 -7
  50. data/doc/rdoc/classes/Wee/CallbackRegistry.html +38 -38
  51. data/doc/rdoc/classes/Wee/CallbackStream.html +18 -18
  52. data/doc/rdoc/classes/Wee/CanvasMixin.html +225 -0
  53. data/doc/rdoc/classes/Wee/Component.html +202 -201
  54. data/doc/rdoc/classes/Wee/Component/OnAnswer.html +7 -7
  55. data/doc/rdoc/classes/Wee/ComponentDispatcher.html +289 -0
  56. data/doc/rdoc/classes/Wee/ComponentRunner.html +321 -0
  57. data/doc/rdoc/classes/Wee/Context.html +63 -3
  58. data/doc/rdoc/classes/Wee/Decoration.html +45 -45
  59. data/doc/rdoc/classes/Wee/Delegate.html +30 -30
  60. data/doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html +164 -0
  61. data/doc/rdoc/classes/Wee/ErrorResponse.html +16 -16
  62. data/doc/rdoc/classes/Wee/Examples.html +114 -0
  63. data/doc/rdoc/classes/Wee/Examples/Calculator.html +319 -0
  64. data/doc/rdoc/classes/Wee/Examples/Counter.html +289 -0
  65. data/doc/rdoc/classes/Wee/Examples/EditableCounter.html +210 -0
  66. data/doc/rdoc/classes/Wee/Examples/Window.html +346 -0
  67. data/doc/rdoc/classes/Wee/FastCGIAdaptor.html +227 -0
  68. data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
  69. data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
  70. data/doc/rdoc/classes/Wee/HtmlCanvasRenderer.html +1230 -0
  71. data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
  72. data/doc/rdoc/classes/Wee/IdGenerator.html +148 -0
  73. data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +27 -14
  74. data/doc/rdoc/classes/Wee/LoginDecoration.html +261 -0
  75. data/doc/rdoc/classes/Wee/Md5IdGenerator.html +14 -14
  76. data/doc/rdoc/classes/Wee/MessageBox.html +14 -14
  77. data/doc/rdoc/classes/Wee/Nitro.html +114 -0
  78. data/doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html +192 -0
  79. data/doc/rdoc/classes/Wee/Nitro/ControllerMixin.html +345 -0
  80. data/doc/rdoc/classes/Wee/Nitro/FormTag.html +155 -0
  81. data/doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html +178 -0
  82. data/doc/rdoc/classes/Wee/Page.html +4 -0
  83. data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
  84. data/doc/rdoc/classes/Wee/PagelessApplication.html +13 -11
  85. data/doc/rdoc/classes/Wee/PagelessComponentDriver.html +296 -0
  86. data/doc/rdoc/classes/Wee/PagelessRequest.html +52 -21
  87. data/doc/rdoc/classes/Wee/PagelessSession.html +130 -91
  88. data/doc/rdoc/classes/Wee/Pager.html +534 -0
  89. data/doc/rdoc/classes/Wee/Presenter.html +482 -298
  90. data/doc/rdoc/classes/Wee/Rails.html +114 -0
  91. data/doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html +192 -0
  92. data/doc/rdoc/classes/Wee/Rails/ControllerMixin.html +342 -0
  93. data/doc/rdoc/classes/Wee/Rails/FormTag.html +155 -0
  94. data/doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html +177 -0
  95. data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
  96. data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
  97. data/doc/rdoc/classes/Wee/Renderer.html +208 -0
  98. data/doc/rdoc/classes/Wee/RenderingContext.html +175 -3
  99. data/doc/rdoc/classes/Wee/Request.html +197 -46
  100. data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
  101. data/doc/rdoc/classes/Wee/Response.html +44 -43
  102. data/doc/rdoc/classes/Wee/Session.html +296 -402
  103. data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +14 -14
  104. data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
  105. data/doc/rdoc/classes/Wee/Utils.html +22 -22
  106. data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
  107. data/doc/rdoc/classes/Wee/ValueHolder.html +19 -19
  108. data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +72 -46
  109. data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
  110. data/doc/rdoc/created.rid +1 -1
  111. data/doc/rdoc/files/INSTALL.html +1 -1
  112. data/doc/rdoc/files/README.html +8 -12
  113. data/doc/rdoc/files/lib/cache/cache_rb.html +1 -1
  114. data/doc/rdoc/files/lib/wee/abstractsession_rb.html +108 -0
  115. data/doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html +108 -0
  116. data/doc/rdoc/files/lib/wee/adaptors/nitro_rb.html +101 -0
  117. data/doc/rdoc/files/lib/wee/adaptors/rails_rb.html +101 -0
  118. data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
  119. data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
  120. data/doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html +108 -0
  121. data/doc/rdoc/files/lib/wee/components/form_decoration_rb.html +1 -1
  122. data/doc/rdoc/files/lib/wee/components/login_decoration_rb.html +101 -0
  123. data/doc/rdoc/files/lib/wee/components/messagebox_rb.html +1 -1
  124. data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
  125. data/doc/rdoc/files/lib/wee/components/pager_rb.html +101 -0
  126. data/doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html +1 -1
  127. data/doc/rdoc/files/lib/wee/components_rb.html +4 -1
  128. data/doc/rdoc/files/lib/wee/continuation/core/component_rb.html +1 -1
  129. data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -1
  130. data/doc/rdoc/files/lib/wee/continuation_rb.html +1 -1
  131. data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
  132. data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
  133. data/doc/rdoc/files/lib/wee/core/componentrunner_rb.html +110 -0
  134. data/doc/rdoc/files/lib/wee/core/context_rb.html +101 -0
  135. data/doc/rdoc/files/lib/wee/core/decoration_rb.html +1 -1
  136. data/doc/rdoc/files/lib/wee/core/idgen_rb.html +101 -0
  137. data/doc/rdoc/files/lib/wee/core/page_rb.html +101 -0
  138. data/doc/rdoc/files/lib/wee/core/presenter_rb.html +1 -1
  139. data/doc/rdoc/files/lib/wee/core/renderer_rb.html +107 -0
  140. data/doc/rdoc/files/lib/wee/core/snapshot_rb.html +1 -1
  141. data/doc/rdoc/files/lib/wee/core/valueholder_rb.html +2 -2
  142. data/doc/rdoc/files/lib/wee/core_ext_rb.html +101 -0
  143. data/doc/rdoc/files/lib/wee/core_rb.html +7 -14
  144. data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +1 -1
  145. data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +1 -1
  146. data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +1 -1
  147. data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +1 -1
  148. data/doc/rdoc/files/lib/wee/databases/og_rb.html +1 -1
  149. data/doc/rdoc/files/lib/wee/examples/calculator_rb.html +107 -0
  150. data/doc/rdoc/files/lib/wee/examples/counter_rb.html +101 -0
  151. data/doc/rdoc/files/lib/wee/examples/editable_counter_rb.html +114 -0
  152. data/doc/rdoc/files/lib/wee/examples/window_rb.html +101 -0
  153. data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +1 -1
  154. data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +1 -1
  155. data/doc/rdoc/files/lib/wee/page_rb.html +1 -1
  156. data/doc/rdoc/files/lib/wee/pageless/application_rb.html +8 -1
  157. data/doc/rdoc/files/lib/wee/pageless/request_rb.html +1 -1
  158. data/doc/rdoc/files/lib/wee/pageless/session_rb.html +2 -1
  159. data/doc/rdoc/files/lib/wee/pageless_rb.html +1 -1
  160. data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
  161. data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +1 -1
  162. data/doc/rdoc/files/lib/wee/renderer/html/writer_rb.html +1 -1
  163. data/doc/rdoc/files/lib/wee/request_rb.html +5 -4
  164. data/doc/rdoc/files/lib/wee/requesthandler_rb.html +1 -1
  165. data/doc/rdoc/files/lib/wee/response_rb.html +2 -1
  166. data/doc/rdoc/files/lib/wee/session_rb.html +2 -3
  167. data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +1 -1
  168. data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +2 -2
  169. data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +1 -1
  170. data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +1 -1
  171. data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +1 -1
  172. data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +1 -1
  173. data/doc/rdoc/files/lib/wee/snapshot_ext_rb.html +1 -1
  174. data/doc/rdoc/files/lib/wee/template_rb.html +1 -1
  175. data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
  176. data/doc/rdoc/files/lib/wee/utils/cache_rb.html +1 -1
  177. data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
  178. data/doc/rdoc/files/lib/wee/utils_rb.html +1 -1
  179. data/doc/rdoc/files/lib/wee_rb.html +5 -3
  180. data/doc/rdoc/fr_class_index.html +34 -2
  181. data/doc/rdoc/fr_file_index.html +17 -1
  182. data/doc/rdoc/fr_method_index.html +464 -314
  183. data/examples/ajax/ajax.rb +1 -1
  184. data/examples/demo.rb +47 -0
  185. data/examples/{calendar.rb → demo/calendar.rb} +89 -97
  186. data/examples/{example.rb → demo/example.rb} +17 -97
  187. data/examples/dispatcher.rb +37 -0
  188. data/examples/draw.rb +14 -11
  189. data/examples/nitro/run.rb +42 -0
  190. data/examples/radio.rb +44 -0
  191. data/examples/test.rb +3 -27
  192. data/lib/wee.rb +15 -3
  193. data/lib/wee/adaptors/nitro.rb +154 -0
  194. data/lib/wee/adaptors/rails.rb +154 -0
  195. data/lib/wee/application.rb +22 -20
  196. data/lib/wee/components.rb +3 -0
  197. data/lib/wee/components/component_dispatcher.rb +46 -0
  198. data/lib/wee/components/login_decoration.rb +35 -0
  199. data/lib/wee/components/messagebox.rb +2 -2
  200. data/lib/wee/components/pager.rb +102 -0
  201. data/lib/wee/continuation/core/component.rb +13 -12
  202. data/lib/wee/continuation/session.rb +11 -19
  203. data/lib/wee/core.rb +8 -7
  204. data/lib/wee/core/component.rb +8 -28
  205. data/lib/wee/core/componentrunner.rb +73 -0
  206. data/lib/wee/core/context.rb +27 -0
  207. data/lib/wee/core/idgen.rb +5 -0
  208. data/lib/wee/core/page.rb +1 -0
  209. data/lib/wee/core/presenter.rb +10 -126
  210. data/lib/wee/core/renderer.rb +23 -0
  211. data/lib/wee/core_ext.rb +122 -0
  212. data/lib/wee/databases/og/scaffolder.rb +0 -1
  213. data/lib/wee/examples/calculator.rb +70 -0
  214. data/lib/wee/examples/counter.rb +33 -0
  215. data/lib/wee/examples/editable_counter.rb +31 -0
  216. data/{examples → lib/wee/examples}/window.rb +29 -23
  217. data/lib/wee/idgen/md5.rb +1 -1
  218. data/lib/wee/idgen/simple.rb +1 -1
  219. data/lib/wee/pageless/session.rb +2 -3
  220. data/lib/wee/renderer/html/brushes.rb +142 -22
  221. data/lib/wee/renderer/html/canvas.rb +57 -19
  222. data/lib/wee/response.rb +3 -2
  223. data/lib/wee/session.rb +10 -54
  224. data/lib/wee/skeleton/og/components/main.rb +5 -1
  225. data/lib/wee/skeleton/og/conf/db.rb +1 -1
  226. data/lib/wee/snapshot_ext.rb +4 -10
  227. data/lib/wee/template.rb +19 -5
  228. data/lib/wee/utils/helper.rb +2 -2
  229. metadata +90 -13
  230. data/examples/calculator.rb +0 -67
  231. data/lib/wee/context.rb +0 -2
@@ -1,4 +1,5 @@
1
1
  require 'time'
2
+ require 'cgi'
2
3
 
3
4
  class Wee::Response
4
5
  DEFAULT_HEADER = {}.freeze
@@ -77,8 +78,8 @@ class Wee::ErrorResponse < Wee::Response
77
78
 
78
79
  def render(c)
79
80
  c << "<html><head><title>Error occured</title></head><body>"
80
- c << "<p>#{ @exception }"
81
- c << @exception.backtrace.join("<br/>")
81
+ c << "<p>#{ CGI.escapeHTML(@exception.inspect) }<br/>"
82
+ c << @exception.backtrace.map{|s| CGI.escapeHTML(s)}.join("<br/>")
82
83
  c << "</p>"
83
84
  c << "</body></html>"
84
85
  end
@@ -1,9 +1,8 @@
1
1
  require 'wee/abstractsession'
2
- require 'wee/page'
3
2
 
4
3
  class Wee::Session < Wee::AbstractSession
5
4
 
6
- attr_accessor :root_component
5
+ attr_accessor :component_runner
7
6
  attr_accessor :page_store
8
7
 
9
8
  def initialize(&block)
@@ -26,10 +25,10 @@ class Wee::Session < Wee::AbstractSession
26
25
 
27
26
  with_session do
28
27
  block.call(self) if block
29
- raise ArgumentError, "No root component specified" if @root_component.nil?
28
+ raise ArgumentError, "No component runner specified" if @component_runner.nil?
30
29
  raise ArgumentError, "No page_store specified" if @page_store.nil?
31
30
 
32
- @initial_snapshot = snapshot()
31
+ @initial_snapshot = @component_runner.snapshot
33
32
  end
34
33
  end
35
34
 
@@ -102,61 +101,26 @@ class Wee::Session < Wee::AbstractSession
102
101
  # new page view.
103
102
 
104
103
  callback_stream = Wee::CallbackStream.new(@page.callbacks, @context.request.fields)
105
- send_response = invoke_callbacks(callback_stream)
104
+ premature_response = @component_runner.process_callbacks(callback_stream)
106
105
 
107
106
  post_callbacks_hook()
108
107
 
109
- if send_response
108
+ if premature_response
110
109
  # replace existing page with new snapshot
111
- @page.snapshot = self.snapshot
110
+ @page.snapshot = @component_runner.snapshot
112
111
  @page_store[@context.request.page_id] = @page
113
112
  @snapshot_page_id = @context.request.page_id
114
113
 
115
114
  # and send response
116
- set_response(@context, send_response)
115
+ set_response(@context, premature_response)
117
116
  else
118
117
  handle_new_page_view(@context)
119
118
  end
120
119
  end
121
120
 
122
- # This method triggers two tree traversals of process_callbacks on the root
123
- # component. First, all input callbacks are invoked, then in the second
124
- # traversal, the first found action callback is invoked (there's only ever
125
- # one per request) and then the traversal is stopped
126
- #
127
- # NOTE: Input callbacks should never call other components!
128
- #
129
- # Returns nil or send_response in case of a premature response.
130
-
131
- def invoke_callbacks(callback_stream)
132
- if callback_stream.all_of_type(:action).size > 1
133
- raise "Not allowed to specify more than one action callback"
134
- end
135
-
136
- send_response = catch(:wee_send_response) {
137
- catch(:wee_back_to_session) {
138
- # invoke input callbacks
139
- @root_component.process_callbacks_chain {|this|
140
- callback_stream.with_callbacks_for(this, :input) { |callback, value|
141
- callback.call(value)
142
- }
143
- }
144
-
145
- # invoke first found action callback. only the first action callback is invoked.
146
- @root_component.process_callbacks_chain {|this|
147
- callback_stream.with_callbacks_for(this, :action) { |callback, value|
148
- callback.call
149
- throw :wee_back_to_session
150
- }
151
- }
152
- }
153
- nil
154
- }
155
- end
156
-
157
121
  def handle_new_page_view(context, snapshot=nil)
158
122
  new_page_id = @idgen.next.to_s
159
- new_page = create_page(snapshot || self.snapshot())
123
+ new_page = create_page(snapshot || @component_runner.snapshot)
160
124
  @page_store[new_page_id] = new_page
161
125
  @snapshot_page_id = new_page_id
162
126
  redirect_url = context.request.build_url(:page_id => new_page_id)
@@ -166,9 +130,8 @@ class Wee::Session < Wee::AbstractSession
166
130
  def respond(context, callbacks)
167
131
  pre_respond_hook
168
132
  set_response(context, Wee::GenericResponse.new('text/html', ''))
169
-
170
- rctx = Wee::RenderingContext.new(context.request, context.response, callbacks, Wee::HtmlWriter.new(context.response.content))
171
- @root_component.do_render_chain(rctx)
133
+ rctx = Wee::RenderingContext.new(context, callbacks, Wee::HtmlWriter.new(context.response.content))
134
+ @component_runner.render(rctx)
172
135
  end
173
136
 
174
137
  def pre_respond_hook
@@ -177,13 +140,6 @@ class Wee::Session < Wee::AbstractSession
177
140
  def post_callbacks_hook
178
141
  end
179
142
 
180
- # Take a snapshot of the root component and return it.
181
-
182
- def snapshot
183
- @root_component.backtrack_state_chain(snap = Wee::Snapshot.new)
184
- return snap.freeze
185
- end
186
-
187
143
  # Return a new Wee::Page object with the given snapshot assigned.
188
144
 
189
145
  def create_page(snapshot)
@@ -2,7 +2,11 @@ class Main < Wee::Component
2
2
 
3
3
  def initialize
4
4
  super()
5
- @scaffolder = add_child OgScaffolder.new(Recipe)
5
+ @scaffolder = OgScaffolder.new(Recipe)
6
+ end
7
+
8
+ def children
9
+ [@scaffolder]
6
10
  end
7
11
 
8
12
  # --------------------------------------------
@@ -1,7 +1,7 @@
1
1
  DB_CONFIG = {
2
2
  :address => 'localhost',
3
3
  :database => '%%db%%',
4
- :backend => 'psql',
4
+ :adapter => 'psql',
5
5
  :user => '%%user%%',
6
6
  :password => '',
7
7
  :connection_count => 10
@@ -14,7 +14,7 @@ class Object
14
14
  end
15
15
  end
16
16
 
17
- class Array
17
+ module Wee::DupReplaceSnapshotMixin
18
18
  def take_snapshot
19
19
  dup
20
20
  end
@@ -24,15 +24,9 @@ class Array
24
24
  end
25
25
  end
26
26
 
27
- class String
28
- def take_snapshot
29
- dup
30
- end
31
-
32
- def restore_snapshot(snap)
33
- replace(snap)
34
- end
35
- end
27
+ class Array; include Wee::DupReplaceSnapshotMixin end
28
+ class String; include Wee::DupReplaceSnapshotMixin end
29
+ class Hash; include Wee::DupReplaceSnapshotMixin end
36
30
 
37
31
  class Struct
38
32
  def take_snapshot
@@ -7,6 +7,12 @@ class Wee::Presenter
7
7
  "lookup_property(#{ hash[:property].inspect })"
8
8
  elsif hash.has_key?(:file)
9
9
  hash[:file].inspect
10
+ elsif hash.has_key?(:local)
11
+ # like file, but use relative to current path
12
+
13
+ caller_path = caller.first.sub(/:\d+$/, "")
14
+
15
+ File.join(File.dirname(caller_path), hash[:local]).inspect
10
16
  else
11
17
  caller_path = caller.first.sub(/:\d+$/, "")
12
18
  basename = caller_path[0, caller_path.rindex(".rb")]
@@ -19,10 +25,18 @@ class Wee::Presenter
19
25
  end.inspect
20
26
  end
21
27
 
22
- class_eval %{
23
- def #{ method }
24
- r.template(#{ file_code })
25
- end
26
- }
28
+ if hash[:r_as_param]
29
+ class_eval %{
30
+ def #{ method }(r)
31
+ r.template(#{ file_code })
32
+ end
33
+ }
34
+ else
35
+ class_eval %{
36
+ def #{ method }
37
+ r.template(#{ file_code })
38
+ end
39
+ }
40
+ end
27
41
  end
28
42
  end
@@ -34,9 +34,9 @@ module Wee::Utils
34
34
  app.default_request_handler {
35
35
  options[:session].new {|sess|
36
36
  if component
37
- sess.root_component = component.new
37
+ sess.component_runner = Wee::ComponentRunner.new(component.new)
38
38
  else
39
- sess.root_component = block.call
39
+ sess.component_runner = Wee::ComponentRunner.new(block.call)
40
40
  end
41
41
  if sess.respond_to?(:page_store=)
42
42
  # This is so that you can use a Pageless session, which does not have
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.6
2
+ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: wee
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.0
7
- date: 2005-04-04
6
+ version: 0.9.0
7
+ date: 2005-07-12
8
8
  summary: Wee is a framework for building highly dynamic web applications.
9
9
  require_paths:
10
10
  - lib
@@ -33,6 +33,7 @@ files:
33
33
  - bin
34
34
  - benchmark
35
35
  - examples
36
+ - Features
36
37
  - Rakefile
37
38
  - wee.gemspec
38
39
  - TODO
@@ -93,6 +94,7 @@ files:
93
94
  - doc/rdoc/files/lib/wee/component_rb.html
94
95
  - doc/rdoc/files/lib/wee/template_rb.html
95
96
  - doc/rdoc/files/lib/wee/page_rb.html
97
+ - doc/rdoc/files/lib/wee/examples
96
98
  - doc/rdoc/files/lib/wee/component_ext_rb.html
97
99
  - doc/rdoc/files/lib/wee/components_rb.html
98
100
  - doc/rdoc/files/lib/wee/core_rb.html
@@ -113,16 +115,26 @@ files:
113
115
  - doc/rdoc/files/lib/wee/decoration_rb.html
114
116
  - doc/rdoc/files/lib/wee/stuff_rb.html
115
117
  - doc/rdoc/files/lib/wee/request_rb.html
118
+ - doc/rdoc/files/lib/wee/core_ext_rb.html
119
+ - doc/rdoc/files/lib/wee/abstractsession_rb.html
116
120
  - doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html
117
121
  - doc/rdoc/files/lib/wee/components/form_decoration_rb.html
118
122
  - doc/rdoc/files/lib/wee/components/messagebox_rb.html
119
123
  - doc/rdoc/files/lib/wee/components/page_decoration_rb.html
124
+ - doc/rdoc/files/lib/wee/components/component_dispatcher_rb.html
125
+ - doc/rdoc/files/lib/wee/components/login_decoration_rb.html
126
+ - doc/rdoc/files/lib/wee/components/pager_rb.html
127
+ - doc/rdoc/files/lib/wee/core/componentrunner_rb.html
120
128
  - doc/rdoc/files/lib/wee/core/valueholder_rb.html
121
129
  - doc/rdoc/files/lib/wee/core/callback_rb.html
122
130
  - doc/rdoc/files/lib/wee/core/snapshot_rb.html
123
131
  - doc/rdoc/files/lib/wee/core/component_rb.html
124
132
  - doc/rdoc/files/lib/wee/core/decoration_rb.html
125
133
  - doc/rdoc/files/lib/wee/core/presenter_rb.html
134
+ - doc/rdoc/files/lib/wee/core/context_rb.html
135
+ - doc/rdoc/files/lib/wee/core/idgen_rb.html
136
+ - doc/rdoc/files/lib/wee/core/renderer_rb.html
137
+ - doc/rdoc/files/lib/wee/core/page_rb.html
126
138
  - doc/rdoc/files/lib/wee/pageless/application_rb.html
127
139
  - doc/rdoc/files/lib/wee/pageless/session_rb.html
128
140
  - doc/rdoc/files/lib/wee/pageless/request_rb.html
@@ -138,6 +150,9 @@ files:
138
150
  - doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html
139
151
  - doc/rdoc/files/lib/wee/rendering/html/writer_rb.html
140
152
  - doc/rdoc/files/lib/wee/adaptors/webrick_rb.html
153
+ - doc/rdoc/files/lib/wee/adaptors/fastcgi_rb.html
154
+ - doc/rdoc/files/lib/wee/adaptors/rails_rb.html
155
+ - doc/rdoc/files/lib/wee/adaptors/nitro_rb.html
141
156
  - doc/rdoc/files/lib/wee/skeleton/og
142
157
  - doc/rdoc/files/lib/wee/skeleton/simple
143
158
  - doc/rdoc/files/lib/wee/skeleton/og/models
@@ -161,6 +176,10 @@ files:
161
176
  - doc/rdoc/files/lib/wee/utils/autoreload_rb.html
162
177
  - doc/rdoc/files/lib/wee/utils/helper_rb.html
163
178
  - doc/rdoc/files/lib/wee/utils/cache_rb.html
179
+ - doc/rdoc/files/lib/wee/examples/calculator_rb.html
180
+ - doc/rdoc/files/lib/wee/examples/counter_rb.html
181
+ - doc/rdoc/files/lib/wee/examples/window_rb.html
182
+ - doc/rdoc/files/lib/wee/examples/editable_counter_rb.html
164
183
  - doc/rdoc/files/lib/cache/cache_rb.html
165
184
  - doc/rdoc/classes/Wee
166
185
  - doc/rdoc/classes/OgScaffolder
@@ -178,6 +197,9 @@ files:
178
197
  - doc/rdoc/classes/String.html
179
198
  - doc/rdoc/classes/Object.html
180
199
  - doc/rdoc/classes/Recipe.html
200
+ - doc/rdoc/classes/ActionView.html
201
+ - doc/rdoc/classes/Hash.html
202
+ - doc/rdoc/classes/ActionView
181
203
  - doc/rdoc/classes/Wee/Utils
182
204
  - doc/rdoc/classes/Wee/Component
183
205
  - doc/rdoc/classes/Wee/StateRegistry
@@ -225,6 +247,24 @@ files:
225
247
  - doc/rdoc/classes/Wee/PagelessSession.html
226
248
  - doc/rdoc/classes/Wee/ErrorResponse.html
227
249
  - doc/rdoc/classes/Wee/Md5IdGenerator.html
250
+ - doc/rdoc/classes/Wee/Nitro
251
+ - doc/rdoc/classes/Wee/Nitro.html
252
+ - doc/rdoc/classes/Wee/Rails
253
+ - doc/rdoc/classes/Wee/CanvasMixin.html
254
+ - doc/rdoc/classes/Wee/Rails.html
255
+ - doc/rdoc/classes/Wee/Examples
256
+ - doc/rdoc/classes/Wee/ComponentDispatcher.html
257
+ - doc/rdoc/classes/Wee/DupReplaceSnapshotMixin.html
258
+ - doc/rdoc/classes/Wee/Examples.html
259
+ - doc/rdoc/classes/Wee/ComponentRunner.html
260
+ - doc/rdoc/classes/Wee/IdGenerator.html
261
+ - doc/rdoc/classes/Wee/Renderer.html
262
+ - doc/rdoc/classes/Wee/Pager.html
263
+ - doc/rdoc/classes/Wee/FastCGIAdaptor.html
264
+ - doc/rdoc/classes/Wee/LoginDecoration.html
265
+ - doc/rdoc/classes/Wee/PagelessComponentDriver.html
266
+ - doc/rdoc/classes/Wee/AbstractSession.html
267
+ - doc/rdoc/classes/Wee/HtmlCanvasRenderer.html
228
268
  - doc/rdoc/classes/Wee/Utils/LRUCache.html
229
269
  - doc/rdoc/classes/Wee/Component/OnAnswer.html
230
270
  - doc/rdoc/classes/Wee/StateRegistry/Snapshot.html
@@ -254,11 +294,28 @@ files:
254
294
  - doc/rdoc/classes/Wee/Brush/JavascriptTag.html
255
295
  - doc/rdoc/classes/Wee/Brush/SelectOptionTag.html
256
296
  - doc/rdoc/classes/Wee/Brush/AnchorTag.html
297
+ - doc/rdoc/classes/Wee/Brush/RadioButtonTag
257
298
  - doc/rdoc/classes/Wee/Brush/SelectListTag.html
258
299
  - doc/rdoc/classes/Wee/Brush/TextAreaTag.html
259
300
  - doc/rdoc/classes/Wee/Brush/ImageButtonTag.html
260
301
  - doc/rdoc/classes/Wee/Brush/TableRowTag.html
302
+ - doc/rdoc/classes/Wee/Brush/HiddenInputTag.html
303
+ - doc/rdoc/classes/Wee/Brush/CheckboxTag.html
304
+ - doc/rdoc/classes/Wee/Brush/RadioButtonTag.html
261
305
  - doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html
306
+ - doc/rdoc/classes/Wee/Brush/RadioButtonTag/RadioGroup.html
307
+ - doc/rdoc/classes/Wee/Nitro/ControllerClassMixin.html
308
+ - doc/rdoc/classes/Wee/Nitro/ControllerMixin.html
309
+ - doc/rdoc/classes/Wee/Nitro/FormTag.html
310
+ - doc/rdoc/classes/Wee/Nitro/HtmlCanvasRenderer.html
311
+ - doc/rdoc/classes/Wee/Rails/ControllerClassMixin.html
312
+ - doc/rdoc/classes/Wee/Rails/ControllerMixin.html
313
+ - doc/rdoc/classes/Wee/Rails/FormTag.html
314
+ - doc/rdoc/classes/Wee/Rails/HtmlCanvasRenderer.html
315
+ - doc/rdoc/classes/Wee/Examples/EditableCounter.html
316
+ - doc/rdoc/classes/Wee/Examples/Calculator.html
317
+ - doc/rdoc/classes/Wee/Examples/Window.html
318
+ - doc/rdoc/classes/Wee/Examples/Counter.html
262
319
  - doc/rdoc/classes/OgScaffolder/Editor.html
263
320
  - doc/rdoc/classes/Cache/Strategy
264
321
  - doc/rdoc/classes/Cache/StorageCache.html
@@ -273,6 +330,7 @@ files:
273
330
  - doc/rdoc/classes/Cache/Strategy/LRU/Item.html
274
331
  - doc/rdoc/classes/Cache/Strategy/Unbounded/Item.html
275
332
  - doc/rdoc/classes/Cache/Strategy/LFU/Item.html
333
+ - doc/rdoc/classes/ActionView/Base.html
276
334
  - lib/wee
277
335
  - lib/cache
278
336
  - lib/wee.rb
@@ -286,10 +344,10 @@ files:
286
344
  - lib/wee/renderer
287
345
  - lib/wee/continuation
288
346
  - lib/wee/adaptors
347
+ - lib/wee/examples
289
348
  - lib/wee/requesthandler.rb
290
349
  - lib/wee/snapshot_ext.rb
291
350
  - lib/wee/session.rb
292
- - lib/wee/context.rb
293
351
  - lib/wee/components.rb
294
352
  - lib/wee/request.rb
295
353
  - lib/wee/core.rb
@@ -297,9 +355,10 @@ files:
297
355
  - lib/wee/response.rb
298
356
  - lib/wee/utils.rb
299
357
  - lib/wee/pageless.rb
300
- - lib/wee/template.rb
301
- - lib/wee/abstractsession.rb
302
358
  - lib/wee/continuation.rb
359
+ - lib/wee/core_ext.rb
360
+ - lib/wee/abstractsession.rb
361
+ - lib/wee/template.rb
303
362
  - lib/wee/page.rb
304
363
  - lib/wee/skeleton/og
305
364
  - lib/wee/skeleton/simple
@@ -315,9 +374,12 @@ files:
315
374
  - lib/wee/skeleton/simple/run.rb
316
375
  - lib/wee/skeleton/simple/README
317
376
  - lib/wee/skeleton/simple/components/main.rb
318
- - lib/wee/components/page_decoration.rb
377
+ - lib/wee/components/login_decoration.rb
319
378
  - lib/wee/components/messagebox.rb
379
+ - lib/wee/components/pager.rb
320
380
  - lib/wee/components/wrapper_decoration.rb
381
+ - lib/wee/components/page_decoration.rb
382
+ - lib/wee/components/component_dispatcher.rb
321
383
  - lib/wee/components/form_decoration.rb
322
384
  - lib/wee/idgen/simple.rb
323
385
  - lib/wee/idgen/md5.rb
@@ -330,9 +392,14 @@ files:
330
392
  - lib/wee/core/component.rb
331
393
  - lib/wee/core/snapshot.rb
332
394
  - lib/wee/core/decoration.rb
395
+ - lib/wee/core/context.rb
396
+ - lib/wee/core/idgen.rb
397
+ - lib/wee/core/renderer.rb
398
+ - lib/wee/core/componentrunner.rb
333
399
  - lib/wee/core/presenter.rb
334
400
  - lib/wee/core/valueholder.rb
335
401
  - lib/wee/core/callback.rb
402
+ - lib/wee/core/page.rb
336
403
  - lib/wee/utils/autoreload.rb
337
404
  - lib/wee/utils/helper.rb
338
405
  - lib/wee/utils/cache.rb
@@ -348,6 +415,12 @@ files:
348
415
  - lib/wee/continuation/core/component.rb
349
416
  - lib/wee/adaptors/fastcgi.rb
350
417
  - lib/wee/adaptors/webrick.rb
418
+ - lib/wee/adaptors/rails.rb
419
+ - lib/wee/adaptors/nitro.rb
420
+ - lib/wee/examples/calculator.rb
421
+ - lib/wee/examples/counter.rb
422
+ - lib/wee/examples/window.rb
423
+ - lib/wee/examples/editable_counter.rb
351
424
  - lib/cache/cache.rb
352
425
  - bin/wee
353
426
  - benchmark/Centrino1300
@@ -363,19 +436,23 @@ files:
363
436
  - benchmark/Centrino600/result.2000.counter.render
364
437
  - benchmark/Centrino600/result.2000.filehandler
365
438
  - examples/ajax
366
- - examples/og-test.rb
439
+ - examples/demo
440
+ - examples/nitro
441
+ - examples/radio.rb
367
442
  - examples/draw.rb
368
443
  - examples/hw.rb
369
- - examples/test.rb
370
444
  - examples/live-update.rb
371
- - examples/window.rb
445
+ - examples/test.rb
446
+ - examples/og-test.rb
447
+ - examples/demo.rb
372
448
  - examples/cc.rb
449
+ - examples/dispatcher.rb
373
450
  - examples/ObjectSpaceBrowser.rb
374
- - examples/calculator.rb
375
- - examples/calendar.rb
376
- - examples/example.rb
377
451
  - examples/ajax/ajax.rb
378
452
  - examples/ajax/ajax.js
453
+ - examples/demo/calendar.rb
454
+ - examples/demo/example.rb
455
+ - examples/nitro/run.rb
379
456
  test_files: []
380
457
  rdoc_options: []
381
458
  extra_rdoc_files: []