ramaze 0.3.5 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. data/Rakefile +5 -20
  2. data/bin/ramaze +0 -4
  3. data/doc/AUTHORS +5 -0
  4. data/doc/meta/announcement.txt +2 -1
  5. data/doc/tutorial/todolist.html +20 -21
  6. data/doc/tutorial/todolist.mkd +10 -9
  7. data/examples/blog/{src/controller.rb → controller/main.rb} +2 -0
  8. data/examples/blog/{src/model.rb → model/entry.rb} +0 -0
  9. data/examples/blog/spec/blog.rb +3 -3
  10. data/examples/blog/start.rb +2 -3
  11. data/examples/blog/view/edit.xhtml +17 -0
  12. data/examples/blog/view/index.xhtml +17 -0
  13. data/examples/blog/view/layout.xhtml +11 -0
  14. data/examples/blog/view/new.xhtml +16 -0
  15. data/examples/facebook.rb +15 -8
  16. data/examples/identity.rb +1 -1
  17. data/examples/memleak_detector.rb +1 -1
  18. data/examples/rammit/src/model.rb +1 -1
  19. data/examples/rapaste/controller/paste.rb +7 -7
  20. data/examples/rapaste/model/paste.rb +1 -3
  21. data/examples/rapaste/public/css/display.css +2 -1
  22. data/examples/rapaste/start.rb +2 -3
  23. data/examples/sourceview/sourceview.rb +1 -1
  24. data/examples/templates/template/external.tenjin +28 -0
  25. data/examples/templates/template_amrita2.rb +0 -3
  26. data/examples/templates/template_tenjin.rb +57 -0
  27. data/examples/todolist/spec/todolist.rb +13 -2
  28. data/examples/todolist/src/controller/main.rb +1 -1
  29. data/examples/todolist/template/index.xhtml +1 -1
  30. data/examples/wiktacular/spec/wiktacular.rb +18 -0
  31. data/examples/wiktacular/src/controller.rb +2 -2
  32. data/examples/wiktacular/src/model.rb +8 -2
  33. data/lib/proto/public/css/ramaze_error.css +4 -0
  34. data/lib/proto/public/dispatch.fcgi +11 -0
  35. data/lib/proto/spec/main.rb +1 -1
  36. data/lib/proto/start.ru +8 -0
  37. data/lib/proto/view/error.xhtml +2 -0
  38. data/lib/ramaze.rb +28 -5
  39. data/lib/ramaze/action.rb +9 -2
  40. data/lib/ramaze/action/render.rb +40 -24
  41. data/lib/ramaze/adapter.rb +10 -17
  42. data/lib/ramaze/adapter/base.rb +8 -12
  43. data/lib/ramaze/adapter/cgi.rb +14 -13
  44. data/lib/ramaze/adapter/ebb.rb +34 -0
  45. data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
  46. data/lib/ramaze/adapter/fcgi.rb +14 -14
  47. data/lib/ramaze/adapter/lsws.rb +15 -11
  48. data/lib/ramaze/adapter/mongrel.rb +2 -1
  49. data/lib/ramaze/adapter/scgi.rb +24 -0
  50. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
  51. data/lib/ramaze/adapter/thin.rb +4 -5
  52. data/lib/ramaze/adapter/webrick.rb +5 -5
  53. data/lib/ramaze/cache.rb +1 -1
  54. data/lib/ramaze/cache/memcached.rb +1 -1
  55. data/lib/ramaze/contrib.rb +70 -10
  56. data/lib/ramaze/contrib/auto_params.rb +1 -1
  57. data/lib/ramaze/contrib/email.rb +15 -15
  58. data/lib/ramaze/contrib/facebook.rb +2 -2
  59. data/lib/ramaze/contrib/facebook/facebook.rb +7 -4
  60. data/lib/ramaze/contrib/file_cache.rb +65 -0
  61. data/lib/ramaze/contrib/gettext.rb +56 -55
  62. data/lib/ramaze/contrib/profiling.rb +36 -0
  63. data/lib/ramaze/contrib/sequel_cache.rb +92 -0
  64. data/lib/ramaze/controller.rb +80 -47
  65. data/lib/ramaze/controller/error.rb +10 -5
  66. data/lib/ramaze/controller/resolve.rb +36 -48
  67. data/lib/ramaze/current.rb +70 -0
  68. data/lib/ramaze/{trinity → current}/request.rb +62 -15
  69. data/lib/ramaze/current/response.rb +19 -0
  70. data/lib/ramaze/{trinity → current}/session.rb +32 -110
  71. data/lib/ramaze/current/session/flash.rb +67 -0
  72. data/lib/ramaze/current/session/hash.rb +65 -0
  73. data/lib/ramaze/dispatcher.rb +1 -28
  74. data/lib/ramaze/dispatcher/action.rb +6 -3
  75. data/lib/ramaze/dispatcher/directory.rb +1 -1
  76. data/lib/ramaze/dispatcher/error.rb +26 -5
  77. data/lib/ramaze/dispatcher/file.rb +13 -2
  78. data/lib/ramaze/gestalt.rb +3 -1
  79. data/lib/ramaze/global.rb +6 -3
  80. data/lib/ramaze/global/globalstruct.rb +3 -1
  81. data/lib/ramaze/helper.rb +66 -20
  82. data/lib/ramaze/helper/aspect.rb +25 -17
  83. data/lib/ramaze/helper/auth.rb +4 -3
  84. data/lib/ramaze/helper/cache.rb +5 -4
  85. data/lib/ramaze/helper/cgi.rb +11 -9
  86. data/lib/ramaze/helper/flash.rb +28 -3
  87. data/lib/ramaze/helper/formatting.rb +1 -3
  88. data/lib/ramaze/helper/identity.rb +2 -3
  89. data/lib/ramaze/helper/inform.rb +7 -6
  90. data/lib/ramaze/helper/link.rb +15 -17
  91. data/lib/ramaze/helper/markaby.rb +2 -4
  92. data/lib/ramaze/helper/maruku.rb +1 -1
  93. data/lib/ramaze/helper/nitroform.rb +4 -4
  94. data/lib/ramaze/helper/pager.rb +4 -6
  95. data/lib/ramaze/helper/partial.rb +24 -21
  96. data/lib/ramaze/helper/redirect.rb +8 -5
  97. data/lib/ramaze/helper/{file.rb → sendfile.rb} +1 -3
  98. data/lib/ramaze/helper/sequel.rb +1 -3
  99. data/lib/ramaze/helper/stack.rb +1 -3
  100. data/lib/ramaze/helper/tagz.rb +19 -0
  101. data/lib/ramaze/helper/user.rb +63 -0
  102. data/lib/ramaze/inform.rb +2 -24
  103. data/lib/ramaze/log.rb +28 -0
  104. data/lib/ramaze/{inform → log}/analogger.rb +3 -3
  105. data/lib/ramaze/{inform → log}/growl.rb +2 -2
  106. data/lib/ramaze/{inform → log}/hub.rb +4 -6
  107. data/lib/ramaze/{inform → log}/informer.rb +4 -4
  108. data/lib/ramaze/{inform → log}/knotify.rb +2 -2
  109. data/lib/ramaze/log/logger.rb +22 -0
  110. data/lib/ramaze/{inform/informing.rb → log/logging.rb} +16 -16
  111. data/lib/ramaze/{inform → log}/syslog.rb +0 -0
  112. data/lib/ramaze/{inform → log}/xosd.rb +2 -2
  113. data/lib/ramaze/route.rb +64 -36
  114. data/lib/ramaze/snippets/array/put_within.rb +13 -0
  115. data/lib/ramaze/snippets/binding/locals.rb +13 -0
  116. data/lib/ramaze/snippets/kernel/__dir__.rb +10 -8
  117. data/lib/ramaze/snippets/kernel/aquire.rb +1 -1
  118. data/lib/ramaze/snippets/kernel/constant.rb +1 -1
  119. data/lib/ramaze/snippets/object/pretty.rb +6 -0
  120. data/lib/ramaze/snippets/object/scope.rb +11 -0
  121. data/lib/ramaze/snippets/object/thread_accessor.rb +5 -0
  122. data/lib/ramaze/snippets/ordered_set.rb +1 -1
  123. data/lib/ramaze/snippets/proc/locals.rb +11 -0
  124. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +44 -0
  125. data/lib/ramaze/snippets/string/esc.rb +29 -0
  126. data/lib/ramaze/snippets/string/start_with.rb +7 -0
  127. data/lib/ramaze/snippets/string/unindent.rb +6 -1
  128. data/lib/ramaze/snippets/struct/values_at.rb +1 -5
  129. data/lib/ramaze/sourcereload.rb +16 -14
  130. data/lib/ramaze/spec.rb +1 -0
  131. data/lib/ramaze/spec/helper.rb +11 -3
  132. data/lib/ramaze/spec/helper/browser.rb +25 -1
  133. data/lib/ramaze/spec/helper/pretty_output.rb +11 -11
  134. data/lib/ramaze/template.rb +5 -4
  135. data/lib/ramaze/template/amrita2.rb +2 -3
  136. data/lib/ramaze/template/ezamar/element.rb +2 -3
  137. data/lib/ramaze/template/ezamar/morpher.rb +1 -2
  138. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  139. data/lib/ramaze/template/haml.rb +5 -2
  140. data/lib/ramaze/template/markaby.rb +2 -0
  141. data/lib/ramaze/template/tagz.rb +79 -0
  142. data/lib/ramaze/template/tenjin.rb +34 -0
  143. data/lib/ramaze/tool/create.rb +0 -3
  144. data/lib/ramaze/tool/localize.rb +107 -105
  145. data/lib/ramaze/tool/mime.rb +0 -2
  146. data/lib/ramaze/trinity.rb +1 -26
  147. data/lib/ramaze/version.rb +1 -1
  148. data/lib/vendor/bacon.rb +47 -41
  149. data/rake_tasks/conf.rake +18 -0
  150. data/rake_tasks/darcs.rake +5 -0
  151. data/rake_tasks/maintenance.rake +37 -24
  152. data/rake_tasks/spec.rake +1 -1
  153. data/spec/contrib/auto_params.rb +3 -1
  154. data/spec/contrib/profiling.rb +26 -0
  155. data/spec/examples/templates/template_redcloth.rb +1 -1
  156. data/spec/examples/templates/template_tenjin.rb +28 -0
  157. data/spec/helper.rb +0 -1
  158. data/spec/ramaze/action/layout.rb +28 -0
  159. data/spec/ramaze/controller/actionless_templates.rb +32 -0
  160. data/spec/ramaze/controller/template/other_wrapper.xhtml +1 -0
  161. data/spec/ramaze/controller/template_resolving.rb +37 -0
  162. data/spec/ramaze/{trinity → current}/request.rb +12 -2
  163. data/spec/ramaze/current/session.rb +97 -0
  164. data/spec/ramaze/dispatcher/directory.rb +2 -1
  165. data/spec/ramaze/dispatcher/file.rb +8 -3
  166. data/spec/ramaze/dispatcher/public/file name.txt +1 -0
  167. data/spec/ramaze/gestalt.rb +11 -0
  168. data/spec/ramaze/helper/aspect.rb +28 -22
  169. data/spec/ramaze/helper/cgi.rb +2 -2
  170. data/spec/ramaze/helper/flash.rb +33 -15
  171. data/spec/ramaze/helper/formatting.rb +2 -2
  172. data/spec/ramaze/helper/link.rb +46 -18
  173. data/spec/ramaze/helper/pager.rb +8 -5
  174. data/spec/ramaze/helper/partial.rb +8 -1
  175. data/spec/ramaze/helper/template/recursive_local_ivars.xhtml +7 -0
  176. data/spec/ramaze/helper/user.rb +46 -0
  177. data/spec/ramaze/{inform → log}/informer.rb +0 -0
  178. data/spec/ramaze/{inform → log}/syslog.rb +1 -1
  179. data/spec/ramaze/request.rb +14 -10
  180. data/spec/ramaze/route.rb +23 -0
  181. data/spec/ramaze/template.rb +48 -1
  182. data/spec/ramaze/template/haml.rb +6 -16
  183. data/spec/ramaze/template/haml/locals.haml +2 -1
  184. data/spec/ramaze/template/tagz.rb +62 -0
  185. data/spec/ramaze/template/tagz/external.tagz +8 -0
  186. data/spec/ramaze/template/tagz/sum.tagz +1 -0
  187. data/spec/ramaze/template/tenjin.rb +49 -0
  188. data/spec/ramaze/template/tenjin/external.tenjin +1 -0
  189. data/spec/snippets/string/unindent.rb +15 -0
  190. metadata +509 -475
  191. data/doc/README.html +0 -729
  192. data/doc/changes.txt +0 -5757
  193. data/doc/changes.xml +0 -5759
  194. data/examples/blog/src/view.rb +0 -16
  195. data/examples/blog/template/edit.xhtml +0 -19
  196. data/examples/blog/template/index.xhtml +0 -19
  197. data/examples/blog/template/new.xhtml +0 -18
  198. data/examples/wiktacular/mkd/newpagename/current.mkd +0 -1
  199. data/examples/wiktacular/mkd/newpagename/current.mkd.bak +0 -1
  200. data/lib/ramaze/contrib/email.rb-darcs-backup0 +0 -81
  201. data/lib/ramaze/template/bijou.rb +0 -39
  202. data/lib/ramaze/trinity/response.rb +0 -32
  203. data/spec/ramaze/template/bijou.rb +0 -25
  204. data/spec/ramaze/trinity/session.rb +0 -29
@@ -1,16 +0,0 @@
1
- class Blog < Ezamar::Element
2
- def render
3
- %(
4
- <html>
5
- <head>
6
- <title>bl_Og</title>
7
- <link rel="stylesheet" href="/styles/blog.css" type="text/css"/>
8
- </head>
9
- <body>
10
- <h1>#{@title}</h1>
11
- #{content}
12
- </body>
13
- </html>
14
- )
15
- end
16
- end
@@ -1,19 +0,0 @@
1
- <Blog title="bl_Og">
2
- <h2>Editing entry</h2>
3
- <div id="entries">
4
- <div class="entry">
5
- <form method="post" action="#{R self,:save}">
6
- <input name="id" type="hidden" value="#{@entry.id}"/>
7
- <div class="header">
8
- <div class="title">
9
- <input name="title" type="text" value="#{@entry.title}"/>
10
- </div>
11
- </div>
12
- <div class="content">
13
- <textarea name="content">#{@entry.content}</textarea>
14
- </div>
15
- <input type="submit" value="Update Entry"/>
16
- </form>
17
- </div>
18
- </div>
19
- </Blog>
@@ -1,19 +0,0 @@
1
- <Blog title="bl_Og">
2
- <div id="actions">#{A 'new entry', :href => Rs(:new)}</div>
3
- <div id="entries">
4
- <?r @entries.each do |entry| ?>
5
- <div class="entry">
6
- <div class="header">
7
- <div class="title">#{entry.title}</div>
8
- <div class="created">Created: #{entry.created}</div>
9
- <ul>
10
- <li>#{A 'edit', :href => Rs(:edit, entry.id)}</li>
11
- <li>#{A 'delete', :href => Rs(:delete, entry.id)}</li>
12
- </ul>
13
- </div>
14
- <div class="content">#{entry.content}</div>
15
- <div class="updated">Last updated: #{entry.updated}</div>
16
- </div>
17
- <?r end ?>
18
- </div>
19
- </Blog>
@@ -1,18 +0,0 @@
1
- <Blog title="bl_Og">
2
- <h2>New entry</h2>
3
- <div id="entries">
4
- <div class="entry">
5
- <form method="post" action="#{R self,:create}">
6
- <div class="header">
7
- <div class="title">
8
- <input name="title" type="text" value=""/>
9
- </div>
10
- </div>
11
- <div class="content">
12
- <textarea name="content"></textarea>
13
- </div>
14
- <input type="submit" value="Add Entry"/>
15
- </form>
16
- </div>
17
- </div>
18
- </Blog>
@@ -1,81 +0,0 @@
1
- # EmailHelper can be used as a simple way to send basic e-mails from your app.
2
- #
3
- # Usage:
4
- #
5
- # require 'ramaze/contrib/email'
6
- #
7
- # # Set the required traits:
8
- # EmailHelper.trait[ :smtp_server ] = 'smtp.your-isp.com'
9
- # EmailHelper.trait[ :smtp_helo_domain ] = "originating-server.com"
10
- # EmailHelper.trait[ :smtp_username ] = 'username'
11
- # EmailHelper.trait[ :smtp_password ] = 'password'
12
- # EmailHelper.trait[ :sender_address ] = 'no-reply@your-domain.com'
13
- #
14
- # # Optionally, set some other traits:
15
- # EmailHelper.trait[ :smtp_auth_type ] = :login
16
- # EmailHelper.trait[ :bcc_addresses ] = [ 'admin@your-domain.com' ]
17
- # EmailHelper.trait[ :sender_full ] = 'MailBot <no-reply@your-domain.com>'
18
- # EmailHelper.trait[ :id_generator ] = lambda { "<#{Time.now.to_i}@your-domain.com>" }
19
- # EmailHelper.trait[ :subject_prefix ] = "[SiteName]"
20
- #
21
- # To send an e-mail:
22
- #
23
- # EmailHelper.send(
24
- # "foo@foobarmail.com",
25
- # "Your fooness",
26
- # "Hey, you are very fooey!"
27
- # )
28
-
29
- require 'net/smtp'
30
-
31
- module Ramaze
32
- class EmailHelper
33
- # Required to be set
34
- trait :smtp_server => 'smtp.your-isp.com'
35
- trait :smtp_helo_domain => 'your.helo.domain.com'
36
- trait :smtp_username => 'no-username-set'
37
- trait :smtp_password => ''
38
- trait :sender_address => 'no-reply@your-domain.com'
39
-
40
- # Optionally set
41
- trait :smtp_port => 25
42
- trait :smtp_auth_type => :login
43
- trait :bcc_addresses => []
44
- trait :sender_full => nil
45
- trait :id_generator => lambda { "<" + Time.now.to_i.to_s + "@" + trait[ :smtp_helo_domain ] + ">" }
46
- trait :subject_prefix => ""
47
-
48
- class << self
49
- def send(recipient, subject, message)
50
- {:recipient => recipient, :subject => subject, :message => message}.each do |k,v|
51
- raise(ArgumentError, "EmailHelper error: Missing or invalid #{k}: #{v.inspect}")
52
- end
53
- sender = trait[:sender_full] || "#{trait[:sender_address]} <#{trait[:sender_address]}>"
54
- subject = [trait[:subject_prefix], subject].join(' ').strip
55
- id = trait[:id_generator].call
56
- email = %{From: #{sender}
57
- To: <#{recipient}>
58
- Date: #{Time.now.rfc2822}
59
- Subject: #{subject}
60
- Message-Id: #{id}
61
-
62
- #{message}
63
- }
64
-
65
- send_smtp(email)
66
- end
67
-
68
- def send_smtp(email, recipient, subject, message)
69
- options = trait.values_at(:smtp_server, :smtp_port, :smtp_helo_domain,
70
- :smtp_username, :smtp_password, :smtp_auth_type)
71
- Net::SMTP.start(*options) do |smtp|
72
- smtp.send_message(email, sender_address, Array[recipient, *bcc_addresses])
73
- Inform.info "E-mail sent to #{recipient} - '#{subject}'"
74
- end
75
- rescue => e
76
- Inform.error "Failed to send e-mail to #{recipient}"
77
- Inform.error e
78
- end
79
- end
80
- end
81
- end
@@ -1,39 +0,0 @@
1
- # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
- # All files in this distribution are subject to the terms of the Ruby license.
3
-
4
- require 'bijou'
5
-
6
- module Ramaze
7
- module Template
8
-
9
- # Is responsible for compiling a template using the Bijou templating engine.
10
- # Can be found at: http://bijou.rubyforge.org/
11
-
12
- class Bijou < Template
13
-
14
- ENGINES[self] = %w[ bijou rbb ]
15
-
16
- class << self
17
-
18
- # Transform via Haml templating engine
19
-
20
- def transform action
21
- compiled = wrap_compile(action)
22
- context = ::Bijou::Context.new(::Bijou::Config.new)
23
- # context.container_callback = method(:container_callback)
24
- # context.component_callback = method(:component_callback)
25
- ::Bijou::Processor.execute(context, compiled, 'GeneralView', {})
26
- end
27
-
28
- # Instantiates Haml::Engine with the template and haml_options trait from
29
- # the controller.
30
-
31
- def compile(action, template)
32
- parser = ::Bijou::Parser.new
33
- parser.parse('GeneralView', template)
34
- end
35
- end
36
- end
37
- end
38
- end
39
-
@@ -1,32 +0,0 @@
1
- # Copyright (c) 2008 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
- # Subclassing Rack::Response for our own purposes.
7
- class Response < ::Rack::Response
8
- # build a response, default values are from the current response.
9
-
10
- def build body = body, status = status, head = header
11
- Dispatcher.set_cookie if Global.sessions
12
-
13
- head.each do |key, value|
14
- self[key] = value
15
- end
16
-
17
- self.body, self.status = body, status
18
- self
19
- end
20
-
21
- class << self
22
-
23
- # get the current response out of Thread.current[:response]
24
- #
25
- # You can call this from everywhere with Ramaze::Response.current
26
-
27
- def current
28
- Thread.current[:response]
29
- end
30
- end
31
- end
32
- end
@@ -1,25 +0,0 @@
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 'spec/helper'
5
-
6
- class TCTemplateController < Ramaze::Controller
7
- map :/
8
- template_root __DIR__/:ezamar
9
- engine :Bijou
10
-
11
- def hello
12
- "<% planet = 'World' %>
13
- Hello, <%= planet %>!"
14
- end
15
- end
16
-
17
-
18
- describe "Bijou" do
19
- behaves_like 'http'
20
- ramaze
21
-
22
- it "hello world" do
23
- get('/hello').body.strip.should == 'Hello, World!'
24
- end
25
- end
@@ -1,29 +0,0 @@
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 'spec/helper'
5
-
6
- class TrinitySessionController < Ramaze::Controller
7
- map :/
8
-
9
- def index
10
- "nothing"
11
- end
12
- end
13
-
14
- describe "Session" do
15
- behaves_like 'http'
16
- ramaze :sessions => false
17
-
18
- it 'should work without sessions' do
19
- class Ramaze::Session
20
- remove_const :IP_COUNT_LIMIT
21
- const_set(:IP_COUNT_LIMIT, 2)
22
- end
23
- (Ramaze::Session::IP_COUNT_LIMIT + 2).times do
24
- r = get('/')
25
- r.body.should == "nothing"
26
- r.headers.should == {'Content-Type' => 'text/html'}
27
- end
28
- end
29
- end