ramaze 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
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
data/doc/README CHANGED
@@ -49,6 +49,11 @@ Ramaze offers following features at the moment:
49
49
  CGI is the Common Gateway Interface and is one of the most basic ways
50
50
  to integrate into Webservers like Apache, Lighttpd or Nginx.
51
51
 
52
+ * FCGI
53
+
54
+ Improvment of CGI as it doesn't start up a new connection to Ramaze on
55
+ every request.
56
+
52
57
 
53
58
  * Templates
54
59
  * [Amrita2](http://amrita2.rubyforge.org/)
@@ -69,13 +74,18 @@ Ramaze offers following features at the moment:
69
74
  Liquid's syntax and parse model are inspired by Django templates, as well
70
75
  as PHP's smarty.
71
76
 
77
+ * [Remarkably](http://rubyforge.org/projects/remarkably)
78
+
79
+ Remarkably is a very tiny Markaby-like XML builder
80
+
72
81
  * [Markaby](http://code.whytheluckystiff.net/markaby/)
73
82
 
74
83
  Markaby means Markup as Ruby.
75
84
 
76
85
  * Ezamar
77
86
 
78
- A simple homage to [Nitro](http://nitroproject.org)s templating.
87
+ A simple homage to [Nitro](http://nitroproject.org)s templating, is shipped
88
+ together with Ramaze.
79
89
 
80
90
  * Cache
81
91
  * Hash
@@ -83,22 +93,81 @@ Ramaze offers following features at the moment:
83
93
  * MemCache
84
94
 
85
95
  * Helper
86
- * Aspect
87
- * Auth
88
- * Cache
89
- * Feed
90
- * Flash
91
- * Form
92
- * Link
93
- * OpenID
94
- * Redirect
95
- * Stack
96
+ * Active by default
97
+ * CGI
98
+
99
+ Shortcuts for escape/unescape of the CGI module.
100
+
101
+ * File
102
+
103
+ Helps you serving files from your Controller.
104
+
105
+ * Flash
106
+
107
+ Store a couple of values for one request associated with a session.
108
+
109
+ * Link
110
+
111
+ Easier linking to the various parts of your applications Controllers and
112
+ Actions.
113
+
114
+ * Redirect
115
+
116
+ Easy redirection.
117
+
118
+ * Optional
119
+ * Aspect
120
+
121
+ Allows you to wrap different Actions on your Controller with code.
122
+
123
+ * Auth
124
+
125
+ Simple way to add basic authentication.
126
+
127
+ * Cache
128
+
129
+ Easy caching Actions and values.
130
+
131
+ * Feed
132
+
133
+ Programmatically generate feeds from any Class.
134
+
135
+ * Form
136
+
137
+ In development, help appreciated.
138
+
139
+ * Identity
140
+
141
+ For ease of use of the OpenID authentication mechanism.
142
+
143
+ * Inform
144
+
145
+ Wrapping the functionality of Ramazes logging facilities.
146
+
147
+ * Markaby
148
+
149
+ Allows you to use Markaby in your Controller without having it as the
150
+ default templating engine.
151
+
152
+ * Nitroform
153
+
154
+ Hooks up on nitros form builder to help you creating forms from Og
155
+ objects.
156
+
157
+ * OpenID
158
+
159
+ Authentication via OpenID made easy.
160
+
161
+ * Stack
162
+
163
+ Allows you to use a call/answer mechanism for things like redirection to the
164
+ site a user entered login-forms from.
96
165
 
97
166
  * Various
98
167
  * Sessions
99
168
  * Global configuration system
100
169
  * Simple request/response handling
101
- * Custom Error-handling
170
+ * Custom sophisticated Error-handling
102
171
 
103
172
 
104
173
  = Basic Principles
@@ -170,7 +239,6 @@ There are some basic principles that Ramaze tries to follow:
170
239
  $ gem install ramaze
171
240
 
172
241
  in case you have RubyGems installed.
173
- (this will work as soon as I have registered on RubyForge ;)
174
242
 
175
243
 
176
244
  * via darcs
@@ -1,17 +1,62 @@
1
- This is a one-time post to announce the creation of the Ramaze project, an open
2
- source web framework with the aim to be light and modular.
3
- Ramaze is already relatively stable and we decided that it is time to give it
4
- broader exposure to find new users and contributors.
1
+ This time we are proud to announce Version 0.1.2 of the Ramaze framework, an
2
+ open source web framework with the aim to be light and modular.
3
+
4
+ Since the 0.1.0 release we have made a lot of progress and the overall API has
5
+ mostly settled down. An extensive set of tests is covering almost every detail
6
+ of the implementation and usage.
7
+
8
+ It is developed by by several people and already in production-use at some
9
+ companies.
10
+
5
11
 
6
12
  Home page: http://ramaze.rubyforge.org
7
13
  IRC: #ramaze on irc.freenode.net
8
14
 
15
+
16
+ New Features in Version 0.1.2: ( review and remove unimportant stuff )
17
+
18
+ - Restructuring of Ramaze internals, featuring a cleaner overall layout.
19
+
20
+ - Add Ramaze::Record to easily record requests fitting particular patterns.
21
+
22
+ - Support for the Remarkably templating engine.
23
+
24
+ - Adapted for Rack 0.2
25
+
26
+ - Easier caching.
27
+
28
+ - replacing autoreload with the almighty SourceReload.
29
+
30
+ - tiny DSL for settings.
31
+
32
+ - Global is now a Struct, no OpenStruct.
33
+
34
+ - Default logger is now LogHub with Inform
35
+
36
+ - Lightweight error-page.
37
+
38
+ - Central API for caches.
39
+
40
+ - Reviewed and largely improved tutorial and examples.
41
+
42
+ - Even less patches to the Ruby core, mostly for compatibility with the
43
+ upcoming Ruby 1.9 and tested with older versions down to 1.8.2.
44
+
45
+ - Largely improved Spec-framework for any kind of web-application.
46
+
47
+ - Through some benchmarking and refactoring the overall speed has improved
48
+ around the factor 2.
49
+
50
+ A complete Changelog is available at [ insert URL ]
51
+
52
+
9
53
  Features:
10
54
  - Builds on top of the recently released Rack library, which provides easy use
11
55
  of adapters like Mongrel, WEBrick, CGI or FCGI.
12
56
 
13
57
  - Supports a wide range of templating-engines like:
14
- Amrita2, Erubis, HAML, Liquid, Markaby and its own engine called Ezamar.
58
+ Amrita2, Erubis, HAML, Liquid, Markaby, Remarkably and its own engine
59
+ called Ezamar.
15
60
 
16
61
  - Highly modular structure, you can just use the parts you like. This also
17
62
  means that it's very simple to add your own customizations.
@@ -36,9 +81,7 @@ Features planned:
36
81
  - Unified FormHelper for ORMs, making the framework mostly independent of the
37
82
  underlying model.
38
83
 
39
- - Improved configuration system, providing an way to totally change options
40
- during runtime and link that with the CLI-parameter automatically.
41
-
84
+ - Support for distributed deployment over DRb.
42
85
 
43
86
  For more information please come to http://ramaze.rubyforge.org or ask directly
44
87
  on IRC (irc://irc.freenode.net/#ramaze)
@@ -6,10 +6,8 @@ This chapter covers how to do configuration in Ramaze for your application.
6
6
  The object holding most configuration is called Global. It resides in the Ramaze
7
7
  module/name space.
8
8
 
9
- Global is a subclass of OpenStruct and behaves mostly like it, so you can assign
10
- your own key/value pairs to do your own configuration. Just ensure you don't
11
- change key/value pairs by accident that Ramaze itself uses (doing it intentional
12
- is OK of course).
9
+ Global is an instance of GlobalStruct, which itself is an instance of Struct.
10
+ There have been some changes to it to suit its purpose.
13
11
 
14
12
  Before covering some of the available options let us see how to actually use it.
15
13
 
@@ -20,17 +18,15 @@ Global with Ramaze so it is written Ramaze::Global.
20
18
 
21
19
  #### Basic assignment:
22
20
 
23
- Global.ports = (7000..7010)
21
+ Global.spawn = 10
24
22
 
25
- if you do that before calling Ramaze::start Ramaze will spawn one server on each
26
- port in that Range. The first value of this Range is also assigned to
27
- Global.port during the startup procedure.
23
+ if you do that before calling Ramaze::start Ramaze will spawn the given number of servers.
28
24
 
29
25
 
30
26
  #### Multiple assignment:
31
27
 
32
28
  Global.setup :adapter => :mongrel,
33
- :cache => MemcachedCache
29
+ :cache => :memcached
34
30
 
35
31
  So you can pass a Hash of all the options you want to change.
36
32
  In this case you would use Mongrel as the adapter and use memcached for your
@@ -61,24 +57,24 @@ useful to quickly test some configuration.
61
57
 
62
58
  ### Global options
63
59
 
64
- Since this document is especially prone to be outdated at times make sure you
65
- check lib/ramaze/global.rb in case you run into trouble, we will try to keep at
66
- least the RDocs up to date. This update is from 2007/04/16.
67
-
68
60
  This listing is here to provide you with descriptions of the most common
69
61
  configurations in alphabetical order per section showing the default value next
70
62
  to the key.
71
63
 
64
+ This chapter has been shrunk a lot to cover only essentials, please look at
65
+ lib/ramaze/global.rb to see all available options.
66
+
67
+ Date of last update: 2007-05-20
72
68
 
73
69
  #### General Configuration:
74
70
 
75
- :autoreload => 5
71
+ :sourcereload => 3
76
72
 
77
- Autoreload is a nifty mechanism that takes advantage of the dynamics of Ruby,
73
+ SourceReload is a nifty mechanism that takes advantage of the dynamics of Ruby,
78
74
  it's basically a Thread that runs in the background and polls for files in the
79
75
  application and framework that have changed (using mtime). The value specifies
80
- roughly how fast your changes are going to be loaded and should be a usual
81
- Fixnum.
76
+ roughly how fast your changes are going to be loaded and should be a number.
77
+ If you set this to false, it will not start.
82
78
 
83
79
 
84
80
  :adapter => :webrick
@@ -91,19 +87,13 @@ additional libraries to be installed, webrick and cgi run out of the box.
91
87
  Generally the most supported and recommended for deployment is Mongrel.
92
88
 
93
89
 
94
- :backtrace_size => 10
95
-
96
- This option doesn't have a large impact and is most likely left on its default
97
- value, it controls how long the backtrace shown in your log and on the error
98
- page should be.
99
-
100
-
101
- :cache => MemoryCache
90
+ :cache => :memory
102
91
 
92
+ Possible: :memory, :memcached, :yaml
103
93
  The cache is one of the more important things for deployment, the default for
104
94
  this is MemoryCache, a simple Hash.
105
- The class you specify here is used throughout Ramaze to cache various things,
106
- like sessions, page- and value-caching.
95
+ What you specify here will be used by Ramaze::Cache and is used throughout
96
+ Ramaze to cache various things, like sessions, page- and value-caching.
107
97
  Included in Ramaze are the MemoryCache and YAMLStoreCache, after you install
108
98
  'memcached' you can also use the much more performant MemcachedCache that also
109
99
  makes it easy to use the same cache between different applications (sharing
@@ -140,13 +130,6 @@ Tell the adapter where it accepts requests from, 0.0.0.0 says that every
140
130
  IP will be accepted, 127.0.0.1 would accept only requests from loopback.
141
131
 
142
132
 
143
- :logger => Ramaze::Informer
144
-
145
- The logger is used during startup to set Ramaze::Inform, you may set this
146
- to Ramaze::Syslog or in case you have 'analogger' installed, you can use
147
- Ramaze::Analogger.
148
-
149
-
150
133
  :mapping => {}
151
134
 
152
135
  This is a very central and special setting, it contains key/value pairs
@@ -18,10 +18,40 @@ limitations and features are.
18
18
  Ramaze is also the main module or so-called namespace that the framework lives
19
19
  in. It has
20
20
 
21
- startup
22
- shutdown
23
- initial tasks
24
- exiting tasks
21
+ Tasks on require
22
+
23
+ * Inform
24
+ * LogHub.new(Informer)
25
+ * Global
26
+ * GlobalStruct.new
27
+
28
+
29
+ Tasks on startup
30
+
31
+ * Global.startup
32
+ * passed options to Ramaze.start
33
+ * CLI options from bin/ramaze (treat as passed.merge)
34
+ * Global options set before startup (fake Global?)
35
+
36
+ * Controller.startup
37
+ * mapping of all subclassed Controller
38
+ * validation of mapping
39
+ * validation of template_root
40
+
41
+ * Adapter.startup
42
+ * interpret Global.adapter
43
+ * add every created adapter to Global.adapters
44
+
45
+ * SourceReload.startup
46
+ * start with Global.reload_interval
47
+ * assign Global.sourcereload
48
+
49
+
50
+ Tasks on shutdown
51
+
52
+ * Adapter.shutdown (iterates Global.adapters)
53
+ * Inform.shutdown (iterates all in LogHub)
54
+
25
55
 
26
56
 
27
57
  #### Global configuration
@@ -0,0 +1,131 @@
1
+ = Explanation of the changes of patch 1110-1111
2
+
3
+ What this patch is all about.
4
+ Due to a general cleanup and preparation for further extension there has been a
5
+ lot of moving of code into more appropriate positions.
6
+ Another goal was the reimplementation of Global, away from OpenStruct to the
7
+ faster Struct.
8
+ Some smaller improvments will follow on both areas, but as with the last
9
+ Controller refactoring, this aimed to be finished as soon as possible to get
10
+ Ramaze bulletproof again before the next release.
11
+
12
+
13
+ == Ramaze
14
+ === What happened to the module
15
+
16
+ The whole module has now only two methods, :startup and :shutdown
17
+
18
+ startup sends .startup to the classes in
19
+ Ramaze.trait[:essentials]
20
+ shutdown sends .shutdown to these classes.
21
+
22
+ Other methods changed:
23
+
24
+ force_start
25
+ removed -> not used anywhere and easily done with a passed option.
26
+
27
+ execute
28
+ removed -> there may be a replacement coming though.
29
+
30
+ kill_threads
31
+ delegated -> this is handled over the shutdown of the responsible classes now.
32
+
33
+ setup_controllers
34
+ delegated -> has been moved to Controller::startup
35
+
36
+ init_sourcereload
37
+ delegated -> moved to SourceReload::startup
38
+
39
+ init_global
40
+ delegated -> moved to Global::startup
41
+
42
+ init_adapter, run_adapter, test_connections, connection_possible
43
+ delegated -> moved to Adapter::startup
44
+
45
+ require_adapter
46
+ delegated -> is now the mask Global.adapter
47
+
48
+ parse_port
49
+ delegated -> is now the mask Global.ports
50
+
51
+
52
+ == Global
53
+ === New functionality and layout
54
+
55
+ Global is now a Struct instead of an OpenStruct, which means two things:
56
+ The general API is hardened now, assigning new accessors is not as simple as
57
+ just setting them via method_missing anymore.
58
+ The GlobalStruct::DEFAULT hash defines what contents the Struct has.
59
+ This has on one hand a improved performance, on the other hand it unifies the
60
+ API for further versions, collecting the setting of Global accessors into one
61
+ place.
62
+ We could add method_missing in further revisions if need arises.
63
+ The other important improvement is the masking of internals of Global. This means
64
+ that we can now define a method over the internal value and present something
65
+ different than it actually contains. Also hooks on setting a value are now
66
+ possible.
67
+
68
+ Controller.trait[:ramaze_public] has moved here as Global.public_root to match
69
+ the Controller.public_root setting.
70
+
71
+
72
+ == Controller
73
+ === template_root and public_root
74
+
75
+ These are no traits anymore. Now the resolution of templates should be a little
76
+ bit faster, but more importantly they will give you a warning when setting a
77
+ path that does not exist.
78
+ To remove the 'self.' boilerplate they take an optional argument and act as
79
+ getter only if no argument is given.
80
+
81
+
82
+ == Cache
83
+ === Unified API for new Caches
84
+
85
+ We now take advantage of the ages-old idea of having a unified Ramaze::Cache to
86
+ spawn new instances of caches instead of relying on Global.cache.new which posed
87
+ many problems with configuring them.
88
+ To retrieve a new cache, simply use Cache.new now, setting Global.cache will
89
+ define which class is used for this. You can set strings/symbols like :memory,
90
+ :memcached or :yaml.
91
+
92
+ Cache also specifies a unified API, at the moment consisting of:
93
+ #[](key), #[]=(key, value), #clear, #delete(*keys)
94
+
95
+ To make interacting easier, all keys are stored/retrieved as strings
96
+ automatically so you can use either symbols or strings to access values.
97
+
98
+
99
+ == Adapter
100
+ === Adapter::( startup | shutdown )
101
+
102
+ The stuff from Ramaze has moved here, it basically still works the same way.
103
+ However, we are now wrapping less threads around one adapter, which may or may
104
+ not affect performance.
105
+
106
+
107
+ == Request
108
+ === Outsourcing of methods to Rack
109
+
110
+ Following methods have been moved to the latest version of Rack:
111
+ #fullpath #[](key), #[]=(key, value), #values_at(*keys), #referer/#referer
112
+
113
+ === Change from module to subclass
114
+
115
+ == Response
116
+ === Change from module to subclass
117
+
118
+ Same as Request
119
+
120
+
121
+ == STATUS_CODE
122
+ === Usage of Rack::Utils::HTTP_STATUS_CODES
123
+
124
+ We are now using the hash from Rack, assigned to Ramaze::STATUS_CODE and have
125
+ removed ramaze/http_status.rb
126
+ The major change is that the keys are now strings like
127
+ "Not Found" or "Internal Server Error". Most of the time guessing will work.
128
+
129
+
130
+ == Informing
131
+ === Added #debug? for WEBrick, set to false.