ramaze 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/Rakefile +14 -259
  2. data/bin/ramaze +52 -25
  3. data/doc/AUTHORS +6 -0
  4. data/doc/CHANGELOG +1363 -42
  5. data/doc/INSTALL +1 -1
  6. data/doc/README +48 -35
  7. data/doc/README.html +637 -0
  8. data/doc/TODO +7 -16
  9. data/doc/allison/allison.css +6 -7
  10. data/doc/allison/allison.gif +0 -0
  11. data/doc/allison/cache/STYLE +1 -2
  12. data/doc/changes.txt +3375 -0
  13. data/doc/changes.xml +3378 -0
  14. data/doc/meta/announcement.txt +47 -0
  15. data/doc/meta/configuration.txt +179 -0
  16. data/doc/meta/internals.txt +111 -0
  17. data/doc/readme_chunks/features.txt +8 -16
  18. data/doc/readme_chunks/installing.txt +7 -1
  19. data/doc/tutorial/todolist.txt +2 -3
  20. data/examples/blog/main.rb +9 -8
  21. data/examples/blog/public/styles/blog.css +132 -0
  22. data/examples/blog/src/controller.rb +14 -41
  23. data/examples/blog/src/model.rb +12 -13
  24. data/examples/blog/src/view.rb +16 -0
  25. data/examples/blog/template/edit.xhtml +19 -8
  26. data/examples/blog/template/index.xhtml +14 -22
  27. data/examples/blog/template/new.xhtml +18 -5
  28. data/examples/caching.rb +5 -8
  29. data/examples/element.rb +3 -3
  30. data/examples/hello.rb +3 -5
  31. data/examples/simple.rb +4 -7
  32. data/examples/templates/template/external.haml +8 -7
  33. data/examples/templates/template/external.mab +11 -8
  34. data/examples/templates/template_amrita2.rb +4 -4
  35. data/examples/templates/template_erubis.rb +3 -3
  36. data/examples/templates/template_ezamar.rb +1 -2
  37. data/examples/templates/template_haml.rb +24 -23
  38. data/examples/templates/template_liquid.rb +3 -1
  39. data/examples/templates/template_markaby.rb +15 -9
  40. data/examples/todolist/src/element/page.rb +1 -1
  41. data/lib/proto/conf/benchmark.yaml +6 -20
  42. data/lib/proto/conf/debug.yaml +6 -19
  43. data/lib/proto/conf/live.yaml +7 -19
  44. data/lib/proto/conf/silent.yaml +6 -16
  45. data/lib/proto/conf/stage.yaml +6 -18
  46. data/lib/proto/public/error.zmr +2 -2
  47. data/lib/ramaze.rb +34 -72
  48. data/lib/ramaze/adapter.rb +21 -18
  49. data/lib/ramaze/adapter/mongrel.rb +0 -3
  50. data/lib/ramaze/adapter/webrick.rb +6 -6
  51. data/lib/ramaze/cache/memcached.rb +3 -0
  52. data/lib/ramaze/controller.rb +227 -183
  53. data/lib/ramaze/dispatcher.rb +34 -129
  54. data/lib/ramaze/dispatcher/action.rb +28 -0
  55. data/lib/ramaze/dispatcher/error.rb +43 -0
  56. data/lib/ramaze/dispatcher/file.rb +34 -0
  57. data/lib/ramaze/global.rb +89 -48
  58. data/lib/ramaze/helper/aspect.rb +8 -6
  59. data/lib/ramaze/helper/auth.rb +3 -3
  60. data/lib/ramaze/helper/cache.rb +2 -2
  61. data/lib/ramaze/helper/file.rb +14 -0
  62. data/lib/ramaze/helper/inform.rb +36 -0
  63. data/lib/ramaze/helper/link.rb +7 -3
  64. data/lib/ramaze/helper/markaby.rb +30 -0
  65. data/lib/ramaze/helper/redirect.rb +2 -0
  66. data/lib/ramaze/inform.rb +8 -182
  67. data/lib/ramaze/inform/analogger.rb +19 -0
  68. data/lib/ramaze/inform/growl.rb +28 -0
  69. data/lib/ramaze/inform/hub.rb +26 -0
  70. data/lib/ramaze/inform/informer.rb +92 -0
  71. data/lib/ramaze/inform/informing.rb +44 -0
  72. data/lib/ramaze/inform/syslog.rb +27 -0
  73. data/lib/ramaze/inform/xosd.rb +42 -0
  74. data/lib/ramaze/snippets.rb +6 -2
  75. data/lib/ramaze/snippets/object/traits.rb +13 -1
  76. data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
  77. data/lib/ramaze/snippets/string/color.rb +27 -0
  78. data/lib/ramaze/snippets/string/each.rb +6 -0
  79. data/lib/ramaze/snippets/struct/fill.rb +15 -0
  80. data/lib/ramaze/template/ezamar.rb +13 -22
  81. data/lib/ramaze/template/ezamar/element.rb +12 -12
  82. data/lib/ramaze/template/liquid.rb +19 -18
  83. data/lib/ramaze/template/markaby.rb +37 -58
  84. data/lib/ramaze/tool/localize.rb +128 -0
  85. data/lib/ramaze/tool/tidy.rb +51 -21
  86. data/lib/ramaze/trinity.rb +3 -3
  87. data/lib/ramaze/trinity/request.rb +41 -23
  88. data/lib/ramaze/trinity/response.rb +10 -5
  89. data/lib/ramaze/trinity/session.rb +17 -3
  90. data/lib/ramaze/version.rb +2 -2
  91. data/rake_tasks/conf.rake +56 -0
  92. data/rake_tasks/gem.rake +44 -0
  93. data/rake_tasks/maintaince.rake +187 -0
  94. data/spec/all.rb +32 -0
  95. data/spec/examples/caching.rb +19 -0
  96. data/spec/examples/element.rb +15 -0
  97. data/spec/examples/hello.rb +11 -0
  98. data/spec/examples/simple.rb +51 -0
  99. data/spec/examples/templates/template_amrita2.rb +14 -0
  100. data/spec/examples/templates/template_erubis.rb +21 -0
  101. data/spec/examples/templates/template_ezamar.rb +22 -0
  102. data/spec/examples/templates/template_haml.rb +23 -0
  103. data/spec/examples/templates/template_liquid.rb +24 -0
  104. data/spec/examples/templates/template_markaby.rb +21 -0
  105. data/spec/helper.rb +81 -0
  106. data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
  107. data/spec/helper/layout.rb +55 -0
  108. data/spec/helper/mock_http.rb +66 -0
  109. data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
  110. data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
  111. data/spec/helper/wrap.rb +193 -0
  112. data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
  113. data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
  114. data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
  115. data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
  116. data/spec/ramaze/conf/locale_de.yaml +6 -0
  117. data/spec/ramaze/conf/locale_en.yaml +6 -0
  118. data/spec/ramaze/controller.rb +184 -0
  119. data/spec/ramaze/controller/template/greet.xhtml +1 -0
  120. data/spec/ramaze/controller/template_resolving.rb +54 -0
  121. data/spec/ramaze/dependencies.rb +16 -0
  122. data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
  123. data/spec/ramaze/error.rb +64 -0
  124. data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
  125. data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
  126. data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
  127. data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
  128. data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
  129. data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
  130. data/spec/ramaze/helper/file.rb +17 -0
  131. data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
  132. data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
  133. data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
  134. data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
  135. data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
  136. data/spec/ramaze/inform/informer.rb +40 -0
  137. data/spec/ramaze/inform/syslog.rb +10 -0
  138. data/spec/ramaze/localize.rb +40 -0
  139. data/spec/ramaze/morpher.rb +82 -0
  140. data/spec/ramaze/params.rb +124 -0
  141. data/spec/{public → ramaze/public}/error404.xhtml +0 -0
  142. data/spec/{public → ramaze/public}/favicon.ico +0 -0
  143. data/spec/{public → ramaze/public}/ramaze.png +0 -0
  144. data/spec/{public → ramaze/public}/test_download.css +0 -0
  145. data/spec/ramaze/request.rb +129 -0
  146. data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
  147. data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
  148. data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
  149. data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
  150. data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
  151. data/spec/ramaze/template.rb +86 -0
  152. data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
  153. data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
  154. data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
  155. data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
  156. data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
  157. data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
  158. data/spec/ramaze/template/ezamar.rb +62 -0
  159. data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
  160. data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
  161. data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
  162. data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
  163. data/spec/ramaze/template/ezamar/nested.zmr +1 -0
  164. data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
  165. data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
  166. data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
  167. data/spec/{template → ramaze/template}/haml/index.haml +0 -0
  168. data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
  169. data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
  170. data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
  171. data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
  172. data/spec/ramaze/template/markaby.rb +59 -0
  173. data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
  174. data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
  175. data/spec/ramaze/template/ramaze/external.test +1 -0
  176. data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
  177. metadata +145 -81
  178. data/examples/blog/public/screen.css +0 -106
  179. data/examples/blog/src/element.rb +0 -58
  180. data/examples/blog/template/view.xhtml +0 -15
  181. data/examples/blog/test/tc_entry.rb +0 -18
  182. data/lib/proto/public/404.jpg +0 -0
  183. data/spec/request_tc_helper.rb +0 -135
  184. data/spec/spec_all.rb +0 -118
  185. data/spec/spec_helper.rb +0 -66
  186. data/spec/tc_controller.rb +0 -49
  187. data/spec/tc_dependencies.rb +0 -13
  188. data/spec/tc_error.rb +0 -43
  189. data/spec/tc_morpher.rb +0 -88
  190. data/spec/tc_params.rb +0 -125
  191. data/spec/tc_template_ezamar.rb +0 -64
  192. data/spec/tc_template_markaby.rb +0 -72
  193. data/spec/template/ezamar/nested.zmr +0 -1
data/Rakefile CHANGED
@@ -10,63 +10,11 @@ require 'pp'
10
10
  include FileUtils
11
11
 
12
12
  $:.unshift File.join(File.dirname(__FILE__), "lib")
13
- require 'ramaze/version'
14
-
15
- AUTHOR = "manveru"
16
- EMAIL = "m.fellinger@gmail.com"
17
- DESCRIPTION = "Ramaze tries to be a very simple Webframework without the voodoo"
18
- HOMEPATH = 'http://ramaze.rubyforge.org'
19
- BIN_FILES = %w( ramaze )
20
-
21
- BASEDIR = File.dirname(__FILE__)
22
-
23
- NAME = "ramaze"
24
- REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
25
- VERS = ENV['VERSION'] || (Ramaze::VERSION + (REV ? ".#{REV}" : ""))
26
- COPYRIGHT = [
27
- "# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com",
28
- "# All files in this distribution are subject to the terms of the Ruby license."
29
- ]
30
- CLEAN.include %w[
31
- **/.*.sw?
32
- *.gem
33
- .config
34
- **/*~
35
- **/{data.db,cache.yaml}
36
- *.yaml
37
- pkg
38
- ]
39
- RDOC_OPTS = %w[
40
- --all
41
- --quiet
42
- --op rdoc
43
- --line-numbers
44
- --inline-source
45
- --main doc/README
46
- --opname index.html
47
- --title "Ramaze\ documentation"
48
- --exclude "^(_darcs|spec|examples|bin|pkg)/"
49
- --exclude "lib/proto"
50
- --include "doc"
51
- --accessor "trait"
52
- ]
53
- RDOC_FILES = %w[
54
- lib doc doc/README doc/FAQ doc/CHANGELOG
55
- ]
56
- POST_INSTALL_MESSAGE = %{
57
- #{'=' * 60}
58
13
 
59
- Thank you for installing Ramaze!
60
- You can now do following:
61
-
62
- * Create a new project using the `ramaze' command:
63
- ramaze --create yourproject
64
-
65
- * Browse and try the Examples in
66
- #{File.join(Gem.path, 'gems', 'ramaze-' + VERS, 'examples')}
67
-
68
- #{'=' * 60}
69
- }.strip
14
+ require 'ramaze/version'
15
+ load 'rake_tasks/conf.rake'
16
+ load 'rake_tasks/gem.rake'
17
+ load 'rake_tasks/maintaince.rake'
70
18
 
71
19
  desc "Packages up ramaze gem."
72
20
  task :default => [:test]
@@ -74,54 +22,9 @@ task :default => [:test]
74
22
  desc "clean up temporary files and gems"
75
23
  task :package => [:clean]
76
24
 
77
- spec =
78
- Gem::Specification.new do |s|
79
- s.name = NAME
80
- s.version = VERS
81
- s.platform = Gem::Platform::RUBY
82
- s.has_rdoc = true
83
- s.extra_rdoc_files = RDOC_FILES
84
- s.rdoc_options += RDOC_OPTS
85
- s.summary = DESCRIPTION
86
- s.description = DESCRIPTION
87
- s.author = AUTHOR
88
- s.email = EMAIL
89
- s.homepage = HOMEPATH
90
- s.executables = BIN_FILES
91
- s.bindir = "bin"
92
- s.require_path = "lib"
93
- s.post_install_message = POST_INSTALL_MESSAGE
94
-
95
- s.add_dependency('rake', '>=0.7.1')
96
- s.add_dependency('rspec', '>=0.7.5.1')
97
- s.add_dependency('rack', '>=0.1.0')
98
- # s.required_ruby_version = '>= 1.8.5'
99
-
100
- s.files = (RDOC_FILES + %w[Rakefile] + Dir["{examples,bin,doc,spec,lib}/**/*"]).uniq
101
-
102
- # s.extensions = FileList["ext/**/extconf.rb"].to_a
103
- end
104
-
105
- Rake::GemPackageTask.new(spec) do |p|
106
- p.need_tar = true
107
- p.gem_spec = spec
108
- end
109
-
110
- desc "package and install ramaze"
111
- task :install do
112
- name = "#{NAME}-#{VERS}.gem"
113
- sh %{rake package}
114
- sh %{sudo gem install pkg/#{name}}
115
- end
116
-
117
- desc "uninstall the ramaze gem"
118
- task :uninstall => [:clean] do
119
- sh %{sudo gem uninstall #{NAME}}
120
- end
121
-
122
25
  desc "sanitize the code and darcs record"
123
26
  task :record => ['fix-end-spaces', 'add-copyright'] do
124
- system("darcs", "record")
27
+ sh "darcs record"
125
28
  end
126
29
 
127
30
  desc "create the doc/changes.xml"
@@ -148,23 +51,6 @@ task :changelog => :changes do
148
51
  cp 'doc/changes.txt', 'doc/CHANGELOG'
149
52
  end
150
53
 
151
- desc "add copyright to all .rb files in the distribution"
152
- task 'add-copyright' do
153
- puts "adding copyright to files that don't have it currently"
154
- Dir['{lib,test}/**/*{.rb}'].each do |file|
155
- next if file =~ /_darcs/
156
- lines = File.readlines(file).map{|l| l.chomp}
157
- unless lines.first(2) == COPYRIGHT
158
- puts "fixing #{file}"
159
- File.open(file, 'w+') do |f|
160
- (COPYRIGHT + lines).each do |line|
161
- f.puts(line)
162
- end
163
- end
164
- end
165
- end
166
- end
167
-
168
54
  task :rcov_dir do
169
55
  mkdir_p 'doc/output/tools/rcov/'
170
56
  end
@@ -180,7 +66,7 @@ end
180
66
 
181
67
  desc "run the specs and clean up afterwards"
182
68
  task :test do
183
- ruby "#{File.dirname(__FILE__)}/spec/spec_all.rb"
69
+ ruby "#{File.dirname(__FILE__)}/spec/all.rb"
184
70
  sh "rake clean"
185
71
  end
186
72
 
@@ -200,7 +86,7 @@ desc "create bzip2 and tarball"
200
86
  task :distribute => :gem do
201
87
  sh "rm -rf pkg/ramaze-#{VERS}"
202
88
  sh "mkdir -p pkg/ramaze-#{VERS}"
203
- sh "cp -r {bin,doc,lib,examples,spec,Rakefile,setup.rb} pkg/ramaze-#{VERS}/"
89
+ sh "cp -r {bin,doc,lib,examples,spec,Rakefile,rake_tasks} pkg/ramaze-#{VERS}/"
204
90
 
205
91
  Dir.chdir('pkg') do |pwd|
206
92
  sh "tar -zcvf ramaze-#{VERS}.tar.gz ramaze-#{VERS}"
@@ -210,24 +96,6 @@ task :distribute => :gem do
210
96
  sh "rm -rf pkg/ramaze-#{VERS}"
211
97
  end
212
98
 
213
- desc "doc/README to html"
214
- Rake::RDocTask.new('gen-readme2html') do |rd|
215
- rd.options = %w[
216
- --quiet
217
- --opname readme.html
218
- ]
219
-
220
- rd.rdoc_dir = 'readme'
221
- rd.rdoc_files = ['doc/README']
222
- rd.main = 'doc/README'
223
- rd.title = "Ramaze documentation"
224
- end
225
-
226
- desc "doc/README to doc/README.html"
227
- task 'readme2html' => 'gen-readme2html' do
228
- cp('readme/files/doc/README.html', 'doc/README.html')
229
- rm_rf('readme')
230
- end
231
99
 
232
100
  desc "list all still undocumented methods"
233
101
  task :undocumented do
@@ -259,7 +127,7 @@ end
259
127
 
260
128
  desc "show a todolist from all the TODO tags in the source"
261
129
  task :todo do
262
- files = Dir[File.join(BASEDIR, '{lib,test}', '**/*.rb')]
130
+ files = Dir[File.join(BASEDIR, '{lib,spec}', '**/*.rb')]
263
131
 
264
132
  files.each do |file|
265
133
  lastline = todo = comment = long_comment = false
@@ -287,34 +155,6 @@ task :todo do
287
155
  end
288
156
  end
289
157
 
290
- desc "generate doc/TODO from the TODO tags in the source"
291
- task 'todolist' do
292
- list = invoke('todo').split("\n")[2..-1]
293
- tasks = {}
294
- current = nil
295
-
296
- list.map do |line|
297
- if line =~ /TODO/ or line.empty?
298
- elsif line =~ /^vim/
299
- current = line.split[1]
300
- tasks[current] = []
301
- else
302
- tasks[current] << line
303
- end
304
- end
305
-
306
- lines = tasks.map{ |name, items| [name, items, ''] }.flatten
307
- lines.pop
308
-
309
- File.open(File.join('doc', 'TODO'), 'w+') do |f|
310
- f.puts "This list is programmaticly generated by `rake todolist`"
311
- f.puts "If you want to add/remove items from the list, change them at the"
312
- f.puts "position specified in the list."
313
- f.puts
314
- f.puts(lines)
315
- end
316
- end
317
-
318
158
  desc "show how many patches we made so far"
319
159
  task :patchsize do
320
160
  size = `darcs changes`.split("\n").reject{|l| l =~ /^\s/ or l.empty?}.size
@@ -322,27 +162,12 @@ task :patchsize do
322
162
  puts "shall i now play some Death-Metal for you?" if size == 666
323
163
  end
324
164
 
325
- desc "remove those annoying spaces at the end of lines"
326
- task 'fix-end-spaces' do
327
- Dir['{lib,test}/**/*.rb'].each do |file|
328
- next if file =~ /_darcs/
329
- lines = File.readlines(file)
330
- new = lines.dup
331
- lines.each_with_index do |line, i|
332
- if line =~ /\s+\n/
333
- puts "fixing #{file}:#{i + 1}"
334
- p line
335
- new[i] = line.rstrip
336
- end
337
- end
338
-
339
- unless new == lines
340
- File.open(file, 'w+') do |f|
341
- new.each do |line|
342
- f.puts(line)
343
- end
344
- end
345
- end
165
+ desc "show who made how many patches"
166
+ task :patchstat do
167
+ patches = `darcs changes`.split("\n").grep(/^\S/).map{|e| e.split.last}
168
+ committs = patches.inject(Hash.new(0)){|s,v| s[v] += 1; s}
169
+ committs.sort.each do |committer, patches|
170
+ puts "#{committer.ljust(25)}: #{patches}"
346
171
  end
347
172
  end
348
173
 
@@ -362,73 +187,3 @@ task 'request' do
362
187
  end
363
188
  end
364
189
  end
365
-
366
- desc "Compile the doc/README from the parts of doc/readme"
367
- task 'build-readme' do
368
- require 'enumerator'
369
-
370
- chapters = [
371
- 'About Ramaze', 'introduction',
372
- 'Features Overview', 'features',
373
- 'Basic Principles', 'principles',
374
- 'Installation', 'installing',
375
- 'Getting Started', 'getting_started',
376
- 'A couple of Examples', 'examples',
377
- 'How to find Help', 'getting_help',
378
- 'Appendix', 'appendix',
379
- 'And thanks to...', 'thanks',
380
- ]
381
-
382
- File.open('doc/README', 'w+') do |readme|
383
- readme.puts COPYRIGHT.map{|l| l[1..-1]}, ''
384
-
385
- chapters.each_slice(2) do |title, file|
386
- file = File.join('doc', 'readme_chunks', "#{file}.txt")
387
- chapter = File.read(file)
388
- readme.puts "= #{title}", '', chapter
389
- readme.puts '', '' unless title == chapters[-2]
390
- end
391
- end
392
- end
393
-
394
- task 'tutorial2html' do
395
- require 'bluecloth'
396
-
397
- basefile = File.join('doc', 'tutorial', 'todolist')
398
-
399
- content = File.read(basefile + '.txt')
400
-
401
- html = BlueCloth.new(content).to_html
402
-
403
- wrap = %{
404
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
405
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
406
- <html>
407
- <head>
408
- <title>Ramaze Tutorial: Todolist</title>
409
- <style>
410
- body {
411
- background: #eee;
412
- }
413
- code {
414
- background: #ddd;
415
- }
416
- pre code {
417
- background: #ddd;
418
- width: 70%;
419
- display: block;
420
- margin: 1em;
421
- padding: 0.7em;
422
- overflow: auto;
423
- }
424
- </style>
425
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
426
- </head>
427
- <body>
428
- #{html}
429
- </body>
430
- </html>
431
- }.strip
432
-
433
- File.open(basefile + '.html', 'w+'){|f| f.puts(wrap) }
434
- end
data/bin/ramaze CHANGED
@@ -38,10 +38,13 @@
38
38
  # updated files in your application
39
39
  # -r, --run-loose:: don't take control after startup.
40
40
  # this is useful for testcases.
41
+ # -c, --console:: Start an IRB-like session.
42
+ # --backtrace:: Show full backtrace at errors on start.
41
43
  # --cache:: use the simple caching based on the signature
42
44
  # of your requests (experimental)
43
45
  # --tidy:: run Tool::Tidy over text/html output
44
46
  #
47
+ #
45
48
  # -h, --help:: print this help
46
49
  # -v, --version:: print the version
47
50
  # -c, --copyright:: print the copyright
@@ -54,7 +57,7 @@
54
57
 
55
58
  require 'ramaze'
56
59
 
57
- runner = ARGV.find{|file| File.file?(file)} || 'main.rb'
60
+ runner = File.expand_path(ARGV.find{|file| File.file?(file)} || 'main.rb')
58
61
 
59
62
  begin
60
63
  require 'getoptlong'
@@ -86,6 +89,7 @@ begin
86
89
  [ '--run-loose', '-r', GetoptLong::NO_ARGUMENT ],
87
90
 
88
91
  [ '--console', '-c', GetoptLong::NO_ARGUMENT ],
92
+ [ '--backtrace', GetoptLong::NO_ARGUMENT ],
89
93
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
90
94
  [ '--version', '-v', GetoptLong::NO_ARGUMENT ],
91
95
  [ '--copyright', GetoptLong::NO_ARGUMENT ],
@@ -108,41 +112,64 @@ begin
108
112
  options[:inform_tags] = Set.new([:debug, :info, :error])
109
113
 
110
114
  case sopt
111
- when :create : create[arg]
112
- when :help : RDoc::ramazes_usage('Usage')
113
- when :version : puts("ramaze #{Ramaze::VERSION}") or exit
114
- when :copyright : RDoc::ramazes_usage('Copyright')
115
- when *adapter : options[:adapter] = sopt
116
-
117
- when :benchmark : options[:inform_tags] << :benchmark
118
- when :debug : options
119
- when :stage : options[:inform_tags].subtract [:debug]
120
- when :live : options[:inform_tags].subtract [:info, :debug]
121
- when :silent : options[:inform_tags].subtract options[:inform_tags]
122
-
123
- when :host : options[:host] = arg
124
- when :port : options[:port] = arg
125
-
126
- when :no_errorpage : options[:error_page] = false
127
- when :template_root : options[:template_root] = arg
128
- when :autoreload : options[:autoreload] = arg.to_i
129
- when :run_loose : options[:run_loose] = true
115
+ when :create
116
+ create[arg]
117
+ when :help
118
+ RDoc::ramazes_usage('Usage')
119
+ when :version
120
+ puts("ramaze #{Ramaze::VERSION}") or exit
121
+ when :copyright
122
+ RDoc::ramazes_usage('Copyright')
123
+ when *adapter
124
+ options[:adapter] = sopt
125
+
126
+ when :benchmark
127
+ options[:inform_tags] << :benchmark
128
+ when :debug
129
+ options
130
+ when :stage
131
+ options[:inform_tags].subtract [:debug]
132
+ when :live
133
+ options[:inform_tags].subtract [:info, :debug]
134
+ when :silent
135
+ options[:inform_tags].subtract options[:inform_tags]
136
+
137
+ when :host
138
+ options[:host] = arg
139
+ when :port
140
+ options[:port] = arg
141
+
142
+ when :no_errorpage
143
+ options[:error_page] = false
144
+ when :template_root
145
+ options[:template_root] = arg
146
+ when :autoreload
147
+ options[:autoreload] = arg.to_i
148
+ when :run_loose
149
+ options[:run_loose] = true
150
+ when :console
151
+ options[:console] = true
152
+ when :backtrace
153
+ options[:backtrace] = true
130
154
  end
131
155
  end
132
156
 
133
157
  begin
134
- puts "running #{File.expand_path(runner)}"
158
+ puts "running #{runner}"
135
159
  require runner
136
- rescue LoadError
137
- puts "Cannot find #{runner}, please provide a file to execute"
138
- puts "Example: $ ramaze myapp.rb"
160
+ rescue LoadError => ex
161
+ puts ex
162
+ puts ex.backtrace if options[:backtrace]
163
+ puts "Maybe i cannot find `#{runner}'"
164
+ puts "You could provide a file to execute like:"
165
+ puts "$ ramaze myapp.rb"
139
166
  exit
140
167
  end
141
168
 
142
169
  if options.delete(:console)
143
170
  options.merge!(:run_loose => true)
144
171
 
145
- ARGV.clear # Avoid passing args to IRB
172
+ ARGV.clear # Avoid passing args to IRB
146
173
 
147
174
  Ramaze.start(options)
148
175