ramaze 0.3.0 → 0.3.5

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 (122) hide show
  1. data/Rakefile +3 -2
  2. data/bin/ramaze +9 -3
  3. data/doc/AUTHORS +6 -2
  4. data/doc/CHANGELOG +272 -66
  5. data/doc/GPL +12 -13
  6. data/doc/README.html +729 -0
  7. data/doc/changes.txt +5757 -0
  8. data/doc/changes.xml +5759 -0
  9. data/doc/meta/announcement.txt +48 -39
  10. data/doc/tutorial/todolist.mkd +10 -12
  11. data/examples/blog/start.rb +1 -0
  12. data/examples/caching.rb +1 -0
  13. data/examples/element.rb +3 -0
  14. data/examples/hello.rb +1 -3
  15. data/examples/identity.rb +5 -8
  16. data/examples/layout.rb +1 -0
  17. data/examples/linking.rb +1 -0
  18. data/examples/memleak_detector.rb +1 -0
  19. data/examples/nitro_form.rb +1 -0
  20. data/examples/rammit/start.rb +1 -0
  21. data/examples/rapaste/Rakefile +7 -0
  22. data/examples/rapaste/{src/controller.rb → controller/paste.rb} +28 -3
  23. data/examples/rapaste/{src/model.rb → model/paste.rb} +0 -4
  24. data/examples/rapaste/public/css/display.css +17 -0
  25. data/examples/rapaste/spec/rapaste.rb +2 -2
  26. data/examples/rapaste/start.rb +9 -4
  27. data/examples/rapaste/{template → view}/copy.xhtml +0 -0
  28. data/examples/rapaste/{template → view}/index.xhtml +0 -0
  29. data/examples/rapaste/{template → view}/layout.xhtml +3 -0
  30. data/examples/rapaste/{template → view}/list.xhtml +4 -3
  31. data/examples/rapaste/view/search.xhtml +41 -0
  32. data/examples/rapaste/{template → view}/view.xhtml +0 -0
  33. data/examples/simple.rb +3 -3
  34. data/examples/templates/template/external.amrita +9 -9
  35. data/examples/templates/template/external.redcloth +19 -0
  36. data/examples/templates/template_amrita2.rb +40 -7
  37. data/examples/templates/template_erubis.rb +3 -3
  38. data/examples/templates/template_ezamar.rb +1 -3
  39. data/examples/templates/template_haml.rb +1 -3
  40. data/examples/templates/template_liquid.rb +3 -3
  41. data/examples/templates/template_markaby.rb +1 -3
  42. data/examples/templates/template_nagoro.rb +1 -3
  43. data/examples/templates/template_redcloth.rb +59 -0
  44. data/examples/templates/template_remarkably.rb +1 -3
  45. data/examples/templates/template_xslt.rb +1 -4
  46. data/examples/todolist/src/controller/main.rb +1 -1
  47. data/examples/todolist/start.rb +1 -2
  48. data/examples/upload/start.rb +19 -0
  49. data/examples/upload/view/index.xhtml +25 -0
  50. data/examples/whywiki/start.rb +1 -3
  51. data/examples/wikore/start.rb +3 -0
  52. data/examples/wiktacular/mkd/newpagename/current.mkd +1 -0
  53. data/examples/wiktacular/mkd/newpagename/current.mkd.bak +1 -0
  54. data/examples/wiktacular/start.rb +1 -0
  55. data/lib/proto/controller/main.rb +0 -3
  56. data/lib/proto/public/js/jquery.js +106 -93
  57. data/lib/proto/spec/main.rb +2 -5
  58. data/lib/proto/start.rb +0 -3
  59. data/lib/ramaze.rb +3 -2
  60. data/lib/ramaze/action.rb +6 -10
  61. data/lib/ramaze/adapter/lsws.rb +19 -0
  62. data/lib/ramaze/contrib/email.rb +84 -0
  63. data/lib/ramaze/contrib/email.rb-darcs-backup0 +81 -0
  64. data/lib/ramaze/contrib/gettext.rb +1 -0
  65. data/lib/ramaze/contrib/gettext/parser.rb +46 -0
  66. data/lib/ramaze/contrib/route.rb +3 -36
  67. data/lib/ramaze/controller.rb +4 -6
  68. data/lib/ramaze/controller/resolve.rb +28 -1
  69. data/lib/ramaze/dispatcher.rb +1 -1
  70. data/lib/ramaze/dispatcher/file.rb +17 -0
  71. data/lib/ramaze/global/globalstruct.rb +7 -4
  72. data/lib/ramaze/helper/auth.rb +1 -1
  73. data/lib/ramaze/helper/identity.rb +25 -15
  74. data/lib/ramaze/helper/link.rb +29 -8
  75. data/lib/ramaze/helper/maruku.rb +7 -0
  76. data/lib/ramaze/helper/partial.rb +25 -10
  77. data/lib/ramaze/route.rb +56 -0
  78. data/lib/ramaze/snippets/metaid.rb +17 -0
  79. data/lib/ramaze/spec/helper.rb +0 -2
  80. data/lib/ramaze/spec/helper/mock_http.rb +6 -0
  81. data/lib/ramaze/spec/helper/pretty_output.rb +5 -1
  82. data/lib/ramaze/store/default.rb +3 -1
  83. data/lib/ramaze/template.rb +1 -1
  84. data/lib/ramaze/template/amrita2.rb +21 -15
  85. data/lib/ramaze/template/bijou.rb +39 -0
  86. data/lib/ramaze/template/builder.rb +28 -0
  87. data/lib/ramaze/template/redcloth.rb +24 -0
  88. data/lib/ramaze/template/sass.rb +3 -1
  89. data/lib/ramaze/tool/create.rb +2 -1
  90. data/lib/ramaze/tool/localize.rb +6 -1
  91. data/lib/ramaze/trinity/request.rb +8 -0
  92. data/lib/ramaze/trinity/session.rb +8 -5
  93. data/lib/ramaze/version.rb +1 -1
  94. data/rake_tasks/gem.rake +0 -1
  95. data/rake_tasks/maintenance.rake +4 -1
  96. data/spec/contrib/route.rb +14 -63
  97. data/spec/examples/linking.rb +2 -2
  98. data/spec/examples/templates/template_redcloth.rb +28 -0
  99. data/spec/ramaze/controller/subclass.rb +21 -0
  100. data/spec/ramaze/dispatcher/file.rb +31 -0
  101. data/spec/ramaze/helper/link.rb +46 -0
  102. data/spec/ramaze/helper/partial.rb +22 -1
  103. data/spec/ramaze/helper/template/locals.xhtml +1 -0
  104. data/spec/ramaze/helper/template/recursive_locals.xhtml +7 -0
  105. data/spec/ramaze/params.rb +8 -0
  106. data/spec/ramaze/request.rb +14 -0
  107. data/spec/ramaze/route.rb +107 -0
  108. data/spec/ramaze/session.rb +4 -2
  109. data/spec/ramaze/template/amrita2.rb +21 -7
  110. data/spec/ramaze/template/amrita2/external.amrita +6 -0
  111. data/spec/ramaze/template/amrita2/sum.amrita +1 -1
  112. data/spec/ramaze/template/bijou.rb +25 -0
  113. data/spec/ramaze/template/builder.rb +55 -0
  114. data/spec/ramaze/template/builder/external.rxml +3 -0
  115. data/spec/ramaze/template/haml.rb +15 -0
  116. data/spec/ramaze/template/haml/locals.haml +1 -0
  117. data/spec/ramaze/template/redcloth.rb +38 -0
  118. data/spec/ramaze/template/redcloth/external.redcloth +1 -0
  119. metadata +472 -442
  120. data/examples/rapaste/rapaste.sqlite +0 -0
  121. data/spec/ramaze/template/amrita2/data.amrita +0 -6
  122. data/spec/ramaze/template/amrita2/index.amrita +0 -1
@@ -7,9 +7,10 @@
7
7
  <div class="item">
8
8
  <div class="item_meta">
9
9
  <a href="/#{paste.id}">
10
- <span class="syntax">#{paste.syntax_name}</span>
11
- <span class="created">created #{time_diff(paste.created)} ago</span>
12
- </a>
10
+ <span class="paste_id">#{paste.id}</span>
11
+ <span class="syntax">#{paste.syntax_name}</span>
12
+ <span class="created">created #{time_diff(paste.created)} ago</span>
13
+ </a>
13
14
  </div>
14
15
  <div class="fragment">#{paste.text_fragment(@style)}</div>
15
16
  <?r if paste.lines[11,1] ?>
@@ -0,0 +1,41 @@
1
+ <?r if @pastes ?>
2
+
3
+ <h3>Search Results</h3>
4
+
5
+ <?r if @pastes.empty? ?>
6
+ <div>
7
+ No pastes matched your search criteria.
8
+ </div>
9
+ <?r if Paste.empty? ?>
10
+ <p class="list_empty">
11
+ There are no pastes at all yet! Go on and <a href="#{Rs(:/)}">Add one</a>.
12
+ </p>
13
+ <?r end ?>
14
+ <?r else ?>
15
+
16
+ <div id="list_head">
17
+ Total search results: #{@pastes.size}
18
+ <?r if @hit_limit ?>(maximum)<?r end ?>
19
+ </div>
20
+ <div class="list">
21
+ <?r @pastes.each do |paste| ?>
22
+ <div class="item">
23
+ <div class="item_meta">
24
+ <a href="/#{paste.id}">
25
+ <span class="syntax">#{paste.syntax_name}</span>
26
+ <span class="created">created #{time_diff(paste.created)} ago</span>
27
+ </a>
28
+ </div>
29
+ <div class="fragment">#{paste.text_fragment(@style)}</div>
30
+ <?r if paste.lines[11,1] ?>
31
+ <div class="more"><a href="/#{paste.id}">more...</a></div>
32
+ <?r else ?>
33
+ <div class="more"><a href="/#{paste.id}">show...</a></div>
34
+ <?r end ?>
35
+ </div>
36
+ <?r end ?>
37
+ </table>
38
+
39
+ <?r end ?>
40
+
41
+ <?r end ?>
File without changes
data/examples/simple.rb CHANGED
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  # A very simple little application, you can simply run it and
@@ -54,3 +52,5 @@ class OtherController < Ramaze::Controller
54
52
  "Hello, World from #{self.class.name}"
55
53
  end
56
54
  end
55
+
56
+ Ramaze.start
@@ -3,17 +3,17 @@
3
3
  <title>Template::Amrita2 external</title>
4
4
  </head>
5
5
  <body>
6
- <h1 id="title">Title</h1>
7
- <a id="link_home">Home</a>
6
+ <h1 am:src="title" />
7
+ <%= link_home %>
8
8
  <p>
9
9
  Here you can pass some stuff if you like, parameters are just passed like this:<br />
10
- <a id="link_one"></a><br />
11
- <a id="link_two"></a><br />
12
- <a id="link_three"></a>
10
+ <%= link_one %><br />
11
+ <%= link_two %><br />
12
+ <%= link_three %>
13
13
  </p>
14
- <div id="args">
15
- *args
16
- </div>
17
- <div id="inspect_parameters"></div>
14
+ <<div<
15
+ <<:args<
16
+ <span><%= $_ %></span>
17
+ <%= inspect_parameters %>
18
18
  </body>
19
19
  </html>
@@ -0,0 +1,19 @@
1
+ h1. The <%= @place %> Template for RedCloth
2
+
3
+ "Home":<%= Rs(:/) %>
4
+
5
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
6
+ "<%= @place %>/one":<%= Rs(@place, :one) %><br />
7
+ "<%= @place %>/two/three":<%= Rs(@place, :two, :three) %><br />
8
+ "<%= @place %>/one?foo=bar":<%= Rs(@place, :foo => :bar) %>
9
+
10
+ The arguments you have passed to this action are:<br />
11
+ <% if @args.empty? %>
12
+ none
13
+ <% else %>
14
+ <% @args.each do |arg| %>
15
+ <span><%= arg %></span>
16
+ <% end %>
17
+ <% end %>
18
+
19
+ <%= request.params.inspect %>
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  # TODO:
@@ -10,10 +8,45 @@ class MainController < Ramaze::Controller
10
8
  template_root __DIR__/:template
11
9
  engine :Amrita2
12
10
 
11
+ def index
12
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
13
+ end
14
+
15
+ def internal(*args)
16
+ @data = binding
17
+ @place = :internal
18
+ <<__AMRITA2__
19
+ <html>
20
+ <head>
21
+ <title>Template::Amrita2 external</title>
22
+ </head>
23
+ <body>
24
+ <h1 am:src="title" />
25
+ <%= link_home %>
26
+ <p>
27
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
28
+ <%= link_one %><br />
29
+ <%= link_two %><br />
30
+ <%= link_three %>
31
+ </p>
32
+ <<div<
33
+ <<:args<
34
+ <span><%= $_ %></span>
35
+ <%= inspect_parameters %>
36
+ </body>
37
+ </html>
38
+ __AMRITA2__
39
+ end
40
+
41
+ def external(*args)
42
+ @data = binding
43
+ @place = :external
44
+ end
45
+
13
46
  private
14
47
 
15
48
  def title
16
- "The external Template for Amrita2"
49
+ "The #{@place} Template for Amrita2"
17
50
  end
18
51
 
19
52
  def link_home
@@ -21,15 +54,15 @@ class MainController < Ramaze::Controller
21
54
  end
22
55
 
23
56
  def link_one
24
- A('/external/one', :href => Rs(:external, :one))
57
+ A("/#{@place}/one", :href => Rs(@place, :one))
25
58
  end
26
59
 
27
60
  def link_two
28
- A("/external/one/two/three", :href => Rs(:external, :one, :two, :three))
61
+ A("/#{@place}/one/two/three", :href => Rs(@place, :one, :two, :three))
29
62
  end
30
63
 
31
64
  def link_three
32
- A("/external?foo=bar", :href => Rs(:external, :one, :foo => :bar))
65
+ A("/#{@place}?foo=bar", :href => Rs(@place, :one, :foo => :bar))
33
66
  end
34
67
 
35
68
  def inspect_parameters
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -51,3 +49,5 @@ class MainController < Ramaze::Controller
51
49
  @place = :external
52
50
  end
53
51
  end
52
+
53
+ Ramaze.start
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -63,3 +61,5 @@ class MainController < Ramaze::Controller
63
61
  @hash = liquid_hash(:external, *args)
64
62
  end
65
63
  end
64
+
65
+ Ramaze.start
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'ramaze'
3
+
4
+ class MainController < Ramaze::Controller
5
+ template_root __DIR__/:template
6
+ engine :RedCloth
7
+ layout :layout
8
+
9
+ def index
10
+ @place = :home
11
+ %{ #{A 'Home', :href => :/} | #{A(:internal)} | #{A(:external)} }
12
+ end
13
+
14
+ def internal(*args)
15
+ @place = :internal
16
+ @args = args
17
+ <<__REDCLOTH__
18
+ h1. The <%= @place %> Template for RedCloth
19
+
20
+ "Home":<%= Rs(:/) %>
21
+
22
+ Here you can pass some stuff if you like, parameters are just passed like this:<br />
23
+ "<%= @place %>/one":<%= Rs(@place, :one) %><br />
24
+ "<%= @place %>/two/three":<%= Rs(@place, :two, :three) %><br />
25
+ "<%= @place %>/one?foo=bar":<%= Rs(@place, :one, :foo => :bar) %>
26
+
27
+ The arguments you have passed to this action are:<br />
28
+ <% if @args.empty? %>
29
+ none
30
+ <% else %>
31
+ <% @args.each do |arg| %>
32
+ <span><%= arg %></span>
33
+ <% end %>
34
+ <% end %>
35
+
36
+ <%= request.params.inspect %>
37
+ __REDCLOTH__
38
+ end
39
+
40
+ def external(*args)
41
+ @place = :external
42
+ @args = args
43
+ end
44
+
45
+ def layout
46
+ <<__HTML__
47
+ <html>
48
+ <head>
49
+ <title>Template::RedCloth <%= @place %></title>
50
+ </head>
51
+ <body>
52
+ #{@content}
53
+ </body>
54
+ </html>
55
+ __HTML__
56
+ end
57
+ end
58
+
59
+ Ramaze.start
@@ -1,6 +1,4 @@
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
-
1
+ require 'rubygems'
4
2
  require 'ramaze'
5
3
 
6
4
  class MainController < Ramaze::Controller
@@ -1,7 +1,4 @@
1
- # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
- # Copyright (c) 2007 Stephan Maka stephan@spaceboyz.net
3
- # All files in this distribution are subject to the terms of the Ruby license.
4
-
1
+ require 'rubygems'
5
2
  require 'ramaze'
6
3
  require 'ramaze/gestalt'
7
4
 
@@ -8,7 +8,7 @@
8
8
  # map '/otherurl'
9
9
  # this will force the controller to be mounted on: /otherurl
10
10
 
11
- class MainController < Controller
11
+ class MainController < Ramaze::Controller
12
12
 
13
13
  def index
14
14
  @tasks = []
@@ -1,10 +1,9 @@
1
1
  # Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
+ require 'rubygems'
4
5
  require 'ramaze'
5
6
 
6
- include Ramaze
7
-
8
7
  require 'src/controller/main'
9
8
  require 'src/element/page'
10
9
  require 'src/model'
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'ramaze'
3
+
4
+ class MainController < Ramaze::Controller
5
+ def index
6
+ return unless request.post?
7
+ @inspection = h(request.params.pretty_inspect)
8
+ tempfile, filename, @type =
9
+ request[:file].values_at(:tempfile, :filename, :type)
10
+ @extname, @basename = File.extname(filename), File.basename(filename)
11
+ @file_size = tempfile.size
12
+
13
+ FileUtils.move(tempfile.path, Ramaze::Global.public_root/@basename)
14
+
15
+ @is_image = @type.split('/').first == 'image'
16
+ end
17
+ end
18
+
19
+ Ramaze.start
@@ -0,0 +1,25 @@
1
+ <html>
2
+
3
+ <body>
4
+ <form method="POST" enctype="multipart/form-data">
5
+ Upload file: <input type="file" name="file" /><br />
6
+ <input type="submit" name="submit" value="Submit" />
7
+ </form>
8
+
9
+ <?r if @inspection ?>
10
+ <h3>#{@basename}</h3>
11
+ File size: #{@file_size} bytes
12
+
13
+ <?r if @is_image ?>
14
+ <h4>Uploaded Image</h4>
15
+ <img src="#{@basename}" alt="Uploaded Image"/><br/>
16
+ <?r else ?>
17
+ <p>You uploaded a #{@type} file. Upload an image file to see it here.</p>
18
+ <?r end ?>
19
+
20
+ <h4>request.params.inspect:</h4>
21
+ <pre>#{@inspection}</pre>
22
+ <?r end ?>
23
+ </body>
24
+
25
+ </html>
@@ -1,8 +1,6 @@
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
1
  # written as an example of how to implement the minimal _why wiki
5
2
 
3
+ require 'rubygems'
6
4
  require 'ramaze'
7
5
  require 'bluecloth'
8
6
 
@@ -1,6 +1,9 @@
1
+ require 'rubygems'
1
2
  require 'ramaze'
2
3
 
3
4
  $wikore = {}
4
5
 
5
6
  require 'src/model'
6
7
  require 'src/controller'
8
+
9
+ Ramaze.start
@@ -0,0 +1 @@
1
+ first text
@@ -0,0 +1 @@
1
+ second text
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'ramaze'
2
3
  require 'bluecloth'
3
4