ramaze 0.1.3 → 0.1.4

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 (149) hide show
  1. data/bin/ramaze +58 -26
  2. data/doc/AUTHORS +2 -0
  3. data/doc/CHANGELOG +401 -0
  4. data/doc/README +14 -9
  5. data/doc/README.html +737 -0
  6. data/doc/TODO +14 -14
  7. data/doc/changes.txt +401 -0
  8. data/doc/changes.xml +401 -0
  9. data/doc/meta/announcement.txt +28 -15
  10. data/doc/meta/configuration.txt +3 -3
  11. data/doc/meta/internals.txt +2 -2
  12. data/doc/meta/users.kml +62 -0
  13. data/doc/readme_chunks/examples.txt +1 -1
  14. data/doc/readme_chunks/features.txt +13 -8
  15. data/doc/tutorial/todolist.html +2 -2
  16. data/doc/tutorial/todolist.mkd +2 -2
  17. data/examples/blog/README +3 -0
  18. data/examples/blog/spec/blog.rb +101 -0
  19. data/examples/blog/{main.rb → start.rb} +0 -0
  20. data/examples/caching.rb +16 -5
  21. data/examples/layout.rb +41 -0
  22. data/examples/templates/template_amrita2.rb +1 -1
  23. data/examples/templates/template_erubis.rb +1 -1
  24. data/examples/templates/template_ezamar.rb +1 -1
  25. data/examples/templates/template_haml.rb +1 -1
  26. data/examples/templates/template_liquid.rb +1 -1
  27. data/examples/templates/template_markaby.rb +1 -1
  28. data/examples/templates/template_remarkably.rb +1 -1
  29. data/examples/todolist/README +1 -0
  30. data/{spec/examples → examples/todolist/spec}/todolist.rb +3 -3
  31. data/examples/todolist/{main.rb → start.rb} +0 -0
  32. data/examples/whywiki/{main.rb → start.rb} +0 -0
  33. data/examples/wiktacular/README +2 -0
  34. data/examples/wiktacular/spec/wiktacular.rb +146 -0
  35. data/examples/wiktacular/src/controller.rb +11 -0
  36. data/examples/wiktacular/src/model.rb +5 -1
  37. data/examples/wiktacular/{main.rb → start.rb} +0 -1
  38. data/examples/wiktacular/template/edit.xhtml +1 -2
  39. data/examples/wiktacular/template/html_layout.xhtml +27 -0
  40. data/examples/wiktacular/template/index.xhtml +8 -10
  41. data/examples/wiktacular/template/new.xhtml +1 -2
  42. data/lib/proto/{main.rb → start.rb} +0 -0
  43. data/lib/proto/template/index.xhtml +1 -1
  44. data/lib/ramaze/action/render.rb +58 -4
  45. data/lib/ramaze/action.rb +20 -0
  46. data/lib/ramaze/adapter/cgi.rb +7 -4
  47. data/lib/ramaze/adapter/fcgi.rb +6 -4
  48. data/lib/ramaze/adapter/mongrel.rb +4 -0
  49. data/lib/ramaze/adapter/webrick.rb +20 -9
  50. data/lib/ramaze/adapter.rb +3 -1
  51. data/lib/ramaze/cache/memcached.rb +2 -26
  52. data/lib/ramaze/cache.rb +8 -4
  53. data/lib/ramaze/controller/resolve.rb +26 -8
  54. data/lib/ramaze/controller.rb +44 -7
  55. data/lib/ramaze/dispatcher/action.rb +5 -1
  56. data/lib/ramaze/dispatcher/directory.rb +115 -0
  57. data/lib/ramaze/dispatcher/error.rb +19 -5
  58. data/lib/ramaze/dispatcher/file.rb +2 -2
  59. data/lib/ramaze/dispatcher.rb +52 -39
  60. data/lib/ramaze/global/dsl.rb +3 -2
  61. data/lib/ramaze/global/globalstruct.rb +26 -4
  62. data/lib/ramaze/global.rb +20 -11
  63. data/lib/ramaze/helper/aspect.rb +29 -11
  64. data/lib/ramaze/helper/auth.rb +2 -2
  65. data/lib/ramaze/helper/cache.rb +2 -0
  66. data/lib/ramaze/helper/identity.rb +21 -6
  67. data/lib/ramaze/helper/link.rb +1 -1
  68. data/lib/ramaze/helper/pager.rb +158 -100
  69. data/lib/ramaze/helper/partial.rb +22 -0
  70. data/lib/ramaze/helper/redirect.rb +1 -2
  71. data/lib/ramaze/helper/stack.rb +1 -1
  72. data/lib/ramaze/inform/informer.rb +20 -0
  73. data/lib/ramaze/inform/syslog.rb +5 -0
  74. data/lib/ramaze/snippets/kernel/__dir__.rb +21 -0
  75. data/lib/ramaze/snippets/kernel/aquire.rb +22 -12
  76. data/lib/ramaze/snippets/numeric/human_readable_filesize_format.rb +33 -0
  77. data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
  78. data/lib/ramaze/snippets/struct/values_at.rb +11 -4
  79. data/lib/ramaze/sourcereload.rb +29 -1
  80. data/{spec → lib/ramaze/spec}/helper/context.rb +0 -0
  81. data/{spec → lib/ramaze/spec}/helper/layout.rb +1 -1
  82. data/{spec → lib/ramaze/spec}/helper/minimal.rb +0 -0
  83. data/{spec → lib/ramaze/spec}/helper/mock_http.rb +0 -0
  84. data/{spec → lib/ramaze/spec}/helper/requester.rb +0 -0
  85. data/{spec → lib/ramaze/spec}/helper/simple_http.rb +0 -0
  86. data/{spec → lib/ramaze/spec}/helper/wrap.rb +0 -0
  87. data/lib/ramaze/spec/helper.rb +60 -0
  88. data/lib/ramaze/store/default.rb +3 -0
  89. data/lib/ramaze/template/ezamar/render_partial.rb +3 -0
  90. data/lib/ramaze/template/sass.rb +45 -0
  91. data/lib/ramaze/template.rb +1 -1
  92. data/lib/ramaze/tool/create.rb +5 -5
  93. data/lib/ramaze/tool/localize.rb +26 -5
  94. data/lib/ramaze/tool/mime.rb +7 -0
  95. data/lib/ramaze/trinity/response.rb +15 -0
  96. data/lib/ramaze/trinity/session.rb +1 -1
  97. data/lib/ramaze/version.rb +1 -1
  98. data/lib/ramaze.rb +5 -0
  99. data/rake_tasks/conf.rake +4 -4
  100. data/rake_tasks/maintaince.rake +12 -7
  101. data/rake_tasks/spec.rake +7 -4
  102. data/spec/examples/caching.rb +6 -8
  103. data/spec/helper.rb +3 -60
  104. data/spec/ramaze/action/basics.rb +17 -0
  105. data/spec/ramaze/action/cache.rb +28 -0
  106. data/spec/ramaze/action/layout.rb +110 -0
  107. data/spec/ramaze/action/render.rb +14 -0
  108. data/spec/ramaze/action/template/bar.xhtml +1 -0
  109. data/spec/ramaze/action/template/other_wrapper.xhtml +1 -0
  110. data/spec/ramaze/action/template/single_wrapper.xhtml +1 -0
  111. data/spec/ramaze/controller/template/edit/content.xhtml +1 -0
  112. data/spec/ramaze/controller/template/edit.xhtml +1 -0
  113. data/spec/ramaze/controller/template_resolving.rb +2 -2
  114. data/spec/ramaze/dispatcher/directory.rb +53 -0
  115. data/spec/ramaze/dispatcher/file.rb +0 -3
  116. data/spec/ramaze/error.rb +17 -2
  117. data/spec/ramaze/helper/aspect.rb +14 -20
  118. data/spec/ramaze/helper/pager.rb +83 -1
  119. data/spec/ramaze/helper/partial.rb +1 -1
  120. data/spec/ramaze/helper/template/test_template.xhtml +1 -0
  121. data/spec/ramaze/inform/informer.rb +37 -5
  122. data/spec/ramaze/localize.rb +1 -1
  123. data/spec/ramaze/template/haml.rb +5 -5
  124. data/spec/ramaze/template/sass/file.css.sass +5 -0
  125. data/spec/ramaze/template/sass.rb +46 -0
  126. data/spec/ramaze/template.rb +1 -1
  127. data/spec/ramaze/trinity/session.rb +27 -0
  128. data/spec/snippets/kernel/__dir__.rb +8 -0
  129. data/spec/snippets/kernel/aquire.rb +71 -0
  130. data/spec/snippets/kernel/constant.rb +27 -0
  131. data/spec/snippets/numeric/human_readable_filesize_format.rb +11 -0
  132. data/spec/snippets/ramaze/caller_info.rb +39 -0
  133. data/spec/snippets/ramaze/caller_lines.rb +27 -0
  134. data/spec/snippets/string/DIVIDE.rb +18 -0
  135. data/spec/snippets/string/camel_case.rb +25 -0
  136. data/spec/snippets/string/color.rb +11 -0
  137. data/spec/snippets/string/snake_case.rb +17 -0
  138. data/spec/snippets/struct/fill.rb +27 -0
  139. data/spec/snippets/struct/values_at.rb +39 -0
  140. metadata +71 -31
  141. data/examples/todolist/todolist.db +0 -5
  142. data/examples/wiktacular/src/page.rb +0 -66
  143. data/lib/ramaze/helper/feed.rb +0 -135
  144. data/lib/ramaze/helper/form.rb +0 -204
  145. data/lib/ramaze/snippets/openstruct/temp.rb +0 -13
  146. data/lib/ramaze/store/yaml.rb +0 -170
  147. data/spec/ramaze/helper/feed.rb +0 -127
  148. data/spec/ramaze/helper/form.rb +0 -146
  149. data/spec/ramaze/store/yaml.rb +0 -76
@@ -1,127 +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
- testcase_requires 'hpricot'
7
-
8
- require 'ramaze/helper/feed'
9
- require 'pp'
10
-
11
- class String
12
- def hpricot
13
- Hpricot(self)
14
- end
15
- end
16
-
17
- class With
18
- class << self
19
- def with(hash)
20
- instance = self.new
21
- hash.each do |key, value|
22
- instance.send("#{key}=", value)
23
- end
24
- instance
25
- end
26
- end
27
- end
28
-
29
- class Book < With
30
- include ReFeed
31
-
32
- attr_accessor :title, :content, :author, :isbn, :description
33
-
34
- xml :title, :content, :type => :text
35
- xml :isbn, :type => :attribute
36
- xml :description, :type => :cdata
37
- xml :author
38
- end
39
-
40
- class User < With
41
- include ReFeed
42
-
43
- xml_accessor :name, :email, :type => :text
44
- xml_accessor :books
45
- end
46
-
47
- describe "ReFeed" do
48
- describe "User" do
49
- user = User.with :name => 'manveru', :email => 'foo@bar.com'
50
-
51
- it "to_xml" do
52
- xml = ( user.to_xml.hpricot/:user )
53
-
54
- xml.size.should == 1
55
- xml.at('email').inner_html.should == user.email
56
- xml.at('name').inner_html.should == user.name
57
- end
58
- end
59
-
60
- describe "Book" do
61
- book = Book.with :title => 'foo', :content => 'bar',
62
- :isbn => 123456789012, :description => 'The Best Foo in the world!'
63
-
64
- it "to_xml" do
65
- xml = ( book.to_xml.hpricot/:book )
66
-
67
- xml.size.should == 1
68
-
69
- xml.first['isbn'].to_i.should == book.isbn
70
-
71
- xml.at('description').to_plain_text.should == book.description
72
- xml.at('title').inner_html.should == 'foo'
73
- xml.at('content').inner_html.should == 'bar'
74
- end
75
- end
76
-
77
- describe "Book and User" do
78
- user = User.with :name => 'manveru', :email => 'foo@bar.com'
79
- book = Book.with :title => 'foo', :content => 'bar', :author => user
80
-
81
- it "to_xml" do
82
- xml_book = ( book.to_xml.hpricot/:book )
83
- xml_user = xml_book.at(:user)
84
-
85
- xml_book.at('title').inner_html.should == book.title
86
- xml_book.at('content').inner_html.should == book.content
87
-
88
- xml_user.at('name').inner_html.should == user.name
89
- xml_user.at('email').inner_html.should == user.email
90
- end
91
- end
92
-
93
- describe "User and books" do
94
- book1 = Book.with :title => 'foo', :content => 'bar'
95
- book2 = Book.with :title => 'foz', :content => 'baz'
96
- user = User.with :name => 'manveru', :email => 'foo@bar.com',
97
- :books => [book1, book2]
98
-
99
- it "to_xml" do
100
- xml = ( user.to_xml.hpricot/:user )
101
- books = ( xml/:book )
102
- first = books.find{|a| a.at('title').inner_html == book1.title }
103
- second = books.find{|a| a.at('title').inner_html == book2.title }
104
-
105
- books.size.should == 2
106
-
107
- xml.at('name').inner_html.should == user.name
108
- xml.at('email').inner_html.should == user.email
109
-
110
- first.at('title').inner_html.should == book1.title
111
- first.at('content').inner_html.should == book1.content
112
-
113
- second.at('title').inner_html.should == book2.title
114
- second.at('content').inner_html.should == book2.content
115
- end
116
- end
117
-
118
- describe "User from XML" do
119
- user = User.with :name => 'manveru', :email => 'foo@bar.com'
120
-
121
- it "from_xml" do
122
- new_user = User.from_xml(user.to_xml)
123
- new_user.name.should == user.name
124
- new_user.email.should == user.email
125
- end
126
- end
127
- end
@@ -1,146 +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
- testcase_requires 'og', 'glue/timestamped'
7
-
8
- class Entry
9
- attr_accessor :title, String
10
- end
11
-
12
- class EntryTimestamped
13
- attr_accessor :title, String
14
- is Timestamped
15
- end
16
-
17
- class EntryDated
18
- attr_accessor :date, Date
19
- end
20
-
21
- # catches all the stuff Og sends to Logger,
22
- # i wished on could mute it otherwise
23
-
24
- Logger.send(:class_variable_set, "@@global_logger", Ramaze::Informer.new)
25
-
26
- Og.start :destroy => true
27
-
28
- class TCFormHelperEntryController < Ramaze::Controller
29
- map '/'
30
- helper :form
31
-
32
- def index
33
- 'FormHelper Entry'
34
- end
35
-
36
- def form_with_submit
37
- form Entry
38
- end
39
-
40
- def form_without_submit
41
- form Entry, :submit => false
42
- end
43
-
44
- def form_with_title
45
- form Entry, :title => 'Title'
46
- end
47
-
48
- def form_without_title
49
- form Entry, :title => false
50
- end
51
-
52
- def form_with_oid
53
- form Entry, :deny => nil
54
- end
55
- end
56
-
57
- class TCFormHelperEntryTimestampedController < Ramaze::Controller
58
- map '/entry_timestamped'
59
- helper :form
60
-
61
- def index
62
- "FormHelper EntryTimestamped"
63
- end
64
-
65
- def form_with_submit
66
- form EntryTimestamped
67
- end
68
- end
69
-
70
- class TCFormHelperEntryDatedController < Ramaze::Controller
71
- map '/entry_dated'
72
- helper :form
73
-
74
- def index
75
- "FormHelper Dated"
76
- end
77
-
78
- def form_with_submit
79
- form EntryDated
80
- end
81
- end
82
-
83
- describe "FormHelper" do
84
- describe "Entry" do
85
- ramaze
86
-
87
- it "testrun" do
88
- get('/').body.should == 'FormHelper Entry'
89
- end
90
-
91
- it "with submit" do
92
- get('/form_with_submit').body.should ==
93
- %{title: <input type="text" name="title" value="" /><br />\n<input type="submit" />}
94
- end
95
-
96
- it "without submit" do
97
- get('/form_without_submit').body.should ==
98
- %{title: <input type="text" name="title" value="" />}
99
- end
100
-
101
- it "with title" do
102
- get('/form_with_title').body.should ==
103
- %{Title: <input type="text" name="title" value="" /><br />\n<input type="submit" />}
104
- end
105
-
106
- it "without title" do
107
- get('/form_without_title').body.should ==
108
- %{<input type="text" name="title" value="" /><br />\n<input type="submit" />}
109
- end
110
-
111
- it "with oid" do
112
- get('/form_with_oid').body.should ==
113
- %{title: <input type="text" name="title" value="" /><br />\noid: <input type="text" name="oid" value="0" /><br />\n<input type="submit" />}
114
- end
115
-
116
- describe "EntryTimestamped" do
117
- it "testrun" do
118
- get('/entry_timestamped/').body.should == "FormHelper EntryTimestamped"
119
- end
120
-
121
- it "with submit" do
122
- get('/entry_timestamped/form_with_submit').body.should ==
123
- "title: <input type=\"text\" name=\"title\" value=\"\" /><br />\n<input type=\"submit\" />"
124
- end
125
- end
126
-
127
- describe "EntryDated" do
128
- it "testrun" do
129
- get('/entry_dated').body.should ==
130
- "FormHelper Dated"
131
- end
132
-
133
- it "with submit" do
134
- result = get('/entry_dated/form_with_submit')
135
- result.should =~ /date\[day\]/
136
- result.should =~ /date\[month\]/
137
- result.should =~ /date\[year\]/
138
- result.should =~ /<input type="submit" \/>/
139
- end
140
- end
141
-
142
- after :all do
143
- FileUtils.rm('data.db')
144
- end
145
- end
146
- end
@@ -1,76 +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
- require 'ramaze/store/yaml'
6
-
7
- describe "Store::YAML" do
8
- def new_store name
9
- Ramaze::Store::YAML.new(name, :destroy => true)
10
- end
11
-
12
- after :all do
13
- FileUtils.rm('article.yaml')
14
- FileUtils.rm('author.yaml')
15
- end
16
-
17
- it "model" do
18
- article_class = new_store :article
19
- article_class.entities.should_not == nil
20
- end
21
-
22
- it "store and retrieve" do
23
- article_class = new_store :article
24
- article = article_class.new
25
- article.title = 'the article'
26
- article.text = 'the articles text'
27
- article.eid.should == nil
28
- article.save
29
-
30
- article.eid.should == 'a'
31
-
32
- old_article = article_class[article.eid]
33
- old_article.title.should == article.title
34
- old_article.text.should == article.text
35
- end
36
-
37
- it "convenience" do
38
- article_class = new_store :article
39
- article_class.all.should be_empty
40
- article = article_class.new
41
- article.name = 'the article'
42
- article.save
43
-
44
- article_class.keys.should == [:a]
45
- article_class.all.should_not be_empty
46
- end
47
-
48
- it "relations" do
49
- article_class = new_store :article
50
- author_class = new_store :author
51
-
52
- author = author_class.new
53
- author.name = 'manveru'
54
-
55
- article = article_class.new
56
- article.name = 'the article'
57
- article.author = author
58
- article.save
59
-
60
- article = article_class[article.eid]
61
- article.author.name.should == author.name
62
- author.article.name.should == article.name
63
- end
64
-
65
- it "delete" do
66
- article_class = new_store :article
67
-
68
- article = article_class['foo'] = {
69
- :bar => :one
70
- }
71
-
72
- article_class['foo'].should == {:bar => :one}
73
- article_class.delete 'foo'
74
- article_class['foo'].should == nil
75
- end
76
- end