ramaze 2008.06 → 2008.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/README.markdown +6 -6
  2. data/Rakefile +33 -3
  3. data/bin/ramaze +18 -0
  4. data/doc/CHANGELOG +960 -0
  5. data/doc/LEGAL +5 -1
  6. data/doc/meta/announcement.txt +20 -36
  7. data/doc/tutorial/todolist.html +421 -313
  8. data/doc/tutorial/todolist.mkd +33 -16
  9. data/examples/app/blog/spec/blog.rb +3 -3
  10. data/examples/app/rapaste/controller/paste.rb +8 -1
  11. data/examples/app/rapaste/model/paste.rb +3 -0
  12. data/examples/app/rapaste/spec/rapaste.rb +3 -1
  13. data/examples/app/rapaste/start.rb +3 -2
  14. data/examples/app/sourceview/public/sourceview.js +2 -2
  15. data/examples/app/todolist/spec/todolist.rb +6 -6
  16. data/examples/app/todolist/template/index.xhtml +1 -1
  17. data/examples/app/whywiki/spec/whywiki.rb +2 -2
  18. data/examples/app/wikore/spec/wikore.rb +2 -2
  19. data/examples/app/wikore/src/model.rb +4 -3
  20. data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
  21. data/examples/basic/simple.rb +2 -2
  22. data/examples/helpers/paginate.rb +71 -0
  23. data/examples/misc/simple_auth.rb +20 -8
  24. data/lib/proto/controller/init.rb +10 -0
  25. data/lib/proto/controller/main.rb +1 -3
  26. data/lib/proto/model/init.rb +4 -0
  27. data/lib/proto/public/dispatch.fcgi +1 -1
  28. data/lib/proto/spec/main.rb +2 -1
  29. data/lib/proto/start.rb +3 -3
  30. data/lib/proto/start.ru +1 -1
  31. data/lib/proto/view/error.xhtml +4 -4
  32. data/lib/ramaze.rb +8 -3
  33. data/lib/ramaze/action.rb +6 -6
  34. data/lib/ramaze/adapter.rb +1 -6
  35. data/lib/ramaze/adapter/base.rb +30 -27
  36. data/lib/ramaze/adapter/cgi.rb +1 -0
  37. data/lib/ramaze/cache.rb +1 -3
  38. data/lib/ramaze/cache/memcached.rb +3 -5
  39. data/lib/ramaze/contrib/auto_params.rb +2 -2
  40. data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
  41. data/lib/ramaze/contrib/gems.rb +17 -18
  42. data/lib/ramaze/contrib/gzip_filter.rb +22 -9
  43. data/lib/ramaze/contrib/maruku_uv.rb +59 -0
  44. data/lib/ramaze/contrib/profiling.rb +1 -1
  45. data/lib/ramaze/contrib/rest.rb +16 -13
  46. data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
  47. data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
  48. data/lib/ramaze/contrib/sequel/image.rb +198 -0
  49. data/lib/ramaze/contrib/sequel/relation.rb +82 -0
  50. data/lib/ramaze/controller.rb +33 -34
  51. data/lib/ramaze/controller/resolve.rb +29 -9
  52. data/lib/ramaze/current.rb +60 -20
  53. data/lib/ramaze/current/request.rb +8 -7
  54. data/lib/ramaze/current/response.rb +15 -3
  55. data/lib/ramaze/current/session/flash.rb +8 -0
  56. data/lib/ramaze/dispatcher.rb +17 -9
  57. data/lib/ramaze/dispatcher/action.rb +4 -5
  58. data/lib/ramaze/dispatcher/directory.rb +1 -1
  59. data/lib/ramaze/dispatcher/error.rb +4 -4
  60. data/lib/ramaze/dispatcher/file.rb +4 -4
  61. data/lib/ramaze/gestalt.rb +15 -20
  62. data/lib/ramaze/helper/cgi.rb +7 -15
  63. data/lib/ramaze/helper/formatting.rb +41 -1
  64. data/lib/ramaze/helper/httpdigest.rb +20 -7
  65. data/lib/ramaze/helper/link.rb +4 -6
  66. data/lib/ramaze/helper/paginate.rb +233 -0
  67. data/lib/ramaze/helper/redirect.rb +1 -1
  68. data/lib/ramaze/helper/rest.rb +1 -1
  69. data/lib/ramaze/helper/thread.rb +17 -0
  70. data/lib/ramaze/helper/ultraviolet.rb +44 -0
  71. data/lib/ramaze/helper/user.rb +4 -9
  72. data/lib/ramaze/log.rb +2 -2
  73. data/lib/ramaze/log/analogger.rb +21 -23
  74. data/lib/ramaze/log/growl.rb +21 -23
  75. data/lib/ramaze/log/hub.rb +1 -1
  76. data/lib/ramaze/log/informer.rb +97 -99
  77. data/lib/ramaze/log/knotify.rb +14 -16
  78. data/lib/ramaze/log/logger.rb +11 -13
  79. data/lib/ramaze/log/logging.rb +61 -63
  80. data/lib/ramaze/log/rotatinginformer.rb +168 -0
  81. data/lib/ramaze/log/syslog.rb +41 -31
  82. data/lib/ramaze/log/xosd.rb +70 -72
  83. data/lib/ramaze/option.rb +9 -6
  84. data/lib/ramaze/option/holder.rb +5 -27
  85. data/lib/ramaze/reloader.rb +186 -0
  86. data/lib/ramaze/setup.rb +1 -1
  87. data/lib/ramaze/snippets.rb +13 -0
  88. data/lib/ramaze/snippets/array/put_within.rb +31 -24
  89. data/lib/ramaze/snippets/binding/locals.rb +23 -11
  90. data/lib/ramaze/snippets/dictionary.rb +2 -2
  91. data/lib/ramaze/snippets/fiber.rb +63 -0
  92. data/lib/ramaze/snippets/kernel/constant.rb +36 -21
  93. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
  94. data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
  95. data/lib/ramaze/snippets/numeric/time.rb +63 -0
  96. data/lib/ramaze/snippets/object/__dir__.rb +29 -0
  97. data/lib/ramaze/snippets/object/acquire.rb +40 -0
  98. data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
  99. data/lib/ramaze/snippets/object/pretty.rb +14 -4
  100. data/lib/ramaze/snippets/object/scope.rb +14 -7
  101. data/lib/ramaze/snippets/ordered_set.rb +25 -14
  102. data/lib/ramaze/snippets/proc/locals.rb +17 -9
  103. data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
  104. data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
  105. data/lib/ramaze/snippets/ramaze/state.rb +86 -0
  106. data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
  107. data/lib/ramaze/snippets/string/camel_case.rb +13 -8
  108. data/lib/ramaze/snippets/string/color.rb +24 -20
  109. data/lib/ramaze/snippets/string/each.rb +14 -3
  110. data/lib/ramaze/snippets/string/end_with.rb +20 -0
  111. data/lib/ramaze/snippets/string/esc.rb +26 -21
  112. data/lib/ramaze/snippets/string/ord.rb +12 -6
  113. data/lib/ramaze/snippets/string/snake_case.rb +13 -7
  114. data/lib/ramaze/snippets/string/start_with.rb +16 -5
  115. data/lib/ramaze/snippets/string/unindent.rb +23 -15
  116. data/lib/ramaze/snippets/thread/into.rb +3 -3
  117. data/lib/ramaze/spec/helper/bacon.rb +5 -5
  118. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  119. data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
  120. data/lib/ramaze/spec/helper/snippets.rb +8 -0
  121. data/lib/ramaze/template.rb +4 -1
  122. data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
  123. data/lib/ramaze/template/maruku.rb +34 -0
  124. data/lib/ramaze/template/tagz.rb +2 -2
  125. data/lib/ramaze/template/xslt.rb +2 -2
  126. data/lib/ramaze/tool/create.rb +27 -53
  127. data/lib/ramaze/tool/localize.rb +8 -4
  128. data/lib/ramaze/tool/mime.rb +11 -1
  129. data/lib/ramaze/tool/project_creator.rb +110 -0
  130. data/lib/ramaze/trinity.rb +4 -1
  131. data/lib/ramaze/version.rb +1 -1
  132. data/lib/vendor/bacon.rb +323 -0
  133. data/rake_tasks/gem.rake +10 -1
  134. data/rake_tasks/maintenance.rake +40 -2
  135. data/rake_tasks/metric.rake +24 -0
  136. data/rake_tasks/release.rake +17 -4
  137. data/rake_tasks/spec.rake +1 -2
  138. data/ramaze.gemspec +549 -495
  139. data/spec/contrib/auto_params.rb +3 -3
  140. data/spec/contrib/profiling.rb +2 -2
  141. data/spec/examples/simple_auth.rb +2 -2
  142. data/spec/examples/templates/template_haml.rb +0 -2
  143. data/spec/ramaze/action/file_cache.rb +22 -0
  144. data/spec/ramaze/adapter.rb +2 -2
  145. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  146. data/spec/ramaze/controller/subclass.rb +15 -0
  147. data/spec/ramaze/controller/template_resolving.rb +1 -1
  148. data/spec/ramaze/controller/view/bar.xhtml +1 -0
  149. data/spec/ramaze/controller/view/base/another.xhtml +1 -0
  150. data/spec/ramaze/current/session.rb +1 -1
  151. data/spec/ramaze/dispatcher/file.rb +2 -2
  152. data/spec/ramaze/helper/aspect.rb +26 -17
  153. data/spec/ramaze/helper/formatting.rb +13 -0
  154. data/spec/ramaze/log/informer.rb +10 -10
  155. data/spec/ramaze/log/syslog.rb +67 -4
  156. data/spec/ramaze/rewrite.rb +1 -1
  157. data/spec/ramaze/route.rb +1 -1
  158. data/spec/ramaze/struct.rb +47 -0
  159. data/spec/ramaze/template/markaby.rb +1 -1
  160. data/spec/ramaze/template/tagz.rb +1 -1
  161. data/spec/snippets/binding/locals.rb +9 -0
  162. data/spec/snippets/numeric/time.rb +12 -0
  163. data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
  164. data/spec/snippets/{kernel → object}/acquire.rb +0 -0
  165. metadata +90 -81
  166. data/cache.yaml +0 -7
  167. data/examples/app/rammit/spec/rammit.rb +0 -31
  168. data/examples/app/rammit/src/controller/main.rb +0 -3
  169. data/examples/app/rammit/src/controller/page.rb +0 -16
  170. data/examples/app/rammit/src/model.rb +0 -33
  171. data/examples/app/rammit/start.rb +0 -8
  172. data/examples/app/rammit/template/index.xhtml +0 -14
  173. data/examples/app/rammit/template/page/view.xhtml +0 -4
  174. data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
  175. data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
  176. data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
  177. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
  178. data/lib/ramaze/snippets/struct/fill.rb +0 -23
  179. data/lib/ramaze/snippets/struct/values_at.rb +0 -39
  180. data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
  181. data/lib/ramaze/sourcereload.rb +0 -176
  182. data/spec/snippets/struct/fill.rb +0 -26
  183. data/spec/snippets/struct/values_at.rb +0 -52
  184. data/spec/snippets/symbol/to_proc.rb +0 -13
@@ -2,7 +2,7 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
- module Logging
5
+ module Logger
6
6
 
7
7
  # Bundles different informer instances and sends incoming messages to each.
8
8
  # This is the default with Informer as only member.
@@ -2,129 +2,127 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
- module Logging
6
- module Logger
7
-
8
- # A minimal logger for Ramaze, supports files, CLI, colors and some
9
- # customization.
10
-
11
- class Informer
12
- include Logging
13
-
14
- attr_accessor :out, :colorize, :log_levels
15
-
16
- # Should Ramaze try to use colors?
17
- trait :colorize => true
18
-
19
- # parameter for Time.now.strftime
20
- trait :timestamp => "%Y-%m-%d %H:%M:%S"
21
-
22
- # This is how the final output is arranged.
23
- trait :format => "[%time] %prefix %text"
24
-
25
- # Which tag should be in what color
26
- COLORS = {
27
- :dev => :blue,
28
- :debug => :yellow,
29
- :info => :green,
30
- :warn => :red,
31
- :error => :red,
32
- }
33
-
34
- # Create a new instance of Informer.
35
- # You can spcify
36
- #
37
- # Examples:
38
- # Informer.new #=> logs to stdout with all levels being
39
- # shown.
40
- # Informer.new($stderr) #=> same, but to stderr
41
- # Informer.new("foo.log") #=> same, but logs to the file foo.log
42
- # (or creates it if it doesn't exist yet)
43
- # Informer.new($stdout, [:info]) #=> show only #info messages to stdout.
44
-
45
- def initialize(out = $stdout, log_levels = [:debug, :error, :info, :warn])
46
- @colorize = false
47
-
48
- @out =
49
- case out
50
- when STDOUT, :stdout, 'stdout'
51
- $stdout
52
- when STDERR, :stderr, 'stderr'
53
- $stderr
54
- when IO
5
+ module Logger
6
+
7
+ # A minimal logger for Ramaze, supports files, CLI, colors and some
8
+ # customization.
9
+
10
+ class Informer
11
+ include Logging
12
+
13
+ attr_accessor :out, :colorize, :log_levels
14
+
15
+ # Should Ramaze try to use colors?
16
+ trait :colorize => true
17
+
18
+ # parameter for Time.now.strftime
19
+ trait :timestamp => "%Y-%m-%d %H:%M:%S"
20
+
21
+ # This is how the final output is arranged.
22
+ trait :format => "[%time] %prefix %text"
23
+
24
+ # Which tag should be in what color
25
+ COLORS = {
26
+ :dev => :blue,
27
+ :debug => :yellow,
28
+ :info => :green,
29
+ :warn => :red,
30
+ :error => :red,
31
+ }
32
+
33
+ # Create a new instance of Informer.
34
+ # You can spcify
35
+ #
36
+ # Examples:
37
+ # Informer.new #=> logs to stdout with all levels being
38
+ # shown.
39
+ # Informer.new($stderr) #=> same, but to stderr
40
+ # Informer.new("foo.log") #=> same, but logs to the file foo.log
41
+ # (or creates it if it doesn't exist yet)
42
+ # Informer.new($stdout, [:info]) #=> show only #info messages to stdout.
43
+
44
+ def initialize(out = $stdout, log_levels = [:debug, :error, :info, :warn])
45
+ @colorize = false
46
+
47
+ @out =
48
+ case out
49
+ when STDOUT, :stdout, 'stdout'
50
+ $stdout
51
+ when STDERR, :stderr, 'stderr'
52
+ $stderr
53
+ when IO
54
+ out
55
+ else
56
+ if out.respond_to?(:puts)
55
57
  out
56
58
  else
57
- if out.respond_to?(:puts)
58
- out
59
- else
60
- File.open(out.to_s, 'ab+')
61
- end
59
+ File.open(out.to_s, 'ab+')
62
60
  end
63
-
64
- if @out.respond_to?(:tty?) and class_trait[:colorize]
65
- @colorize = @out.tty?
66
61
  end
67
62
 
68
- @log_levels = log_levels
63
+ if @out.respond_to?(:tty?) and class_trait[:colorize]
64
+ @colorize = @out.tty?
69
65
  end
70
66
 
71
- # Close the file we log to if it isn't closed already.
72
-
73
- def shutdown
74
- if @out.respond_to?(:close)
75
- Log.debug("close, #{@out.inspect}")
76
- @out.close
77
- end
78
- end
67
+ @log_levels = log_levels
68
+ end
79
69
 
80
- # Integration to Logging.
70
+ # Close the file we log to if it isn't closed already.
81
71
 
82
- def log tag, *messages
83
- return if closed? || !@log_levels.include?(tag)
84
- messages.flatten!
72
+ def shutdown
73
+ if @out.respond_to?(:close)
74
+ Log.debug("close, #{@out.inspect}")
75
+ @out.close
76
+ end
77
+ end
85
78
 
86
- prefix = tag.to_s.upcase.ljust(5)
79
+ # Integration to Logging.
87
80
 
88
- if @colorize
89
- color = COLORS[tag] ||= :white
90
- prefix.replace prefix.send(color)
91
- end
81
+ def log tag, *messages
82
+ return if closed? || !@log_levels.include?(tag)
83
+ messages.flatten!
92
84
 
93
- messages.each do |message|
94
- @out.puts(log_interpolate(prefix, message))
95
- end
85
+ prefix = tag.to_s.upcase.ljust(5)
96
86
 
97
- @out.flush if @out.respond_to?(:flush)
87
+ if @colorize
88
+ color = COLORS[tag] ||= :white
89
+ prefix.replace prefix.send(color)
98
90
  end
99
91
 
100
- # Takes the prefix (tag), text and timestamp and applies it to
101
- # the :format trait.
92
+ messages.each do |message|
93
+ @out.puts(log_interpolate(prefix, message))
94
+ end
102
95
 
103
- def log_interpolate prefix, text, time = timestamp
104
- message = class_trait[:format].dup
96
+ @out.flush if @out.respond_to?(:flush)
97
+ end
105
98
 
106
- vars = { '%time' => time, '%prefix' => prefix, '%text' => text }
107
- vars.each{|from, to| message.gsub!(from, to) }
99
+ # Takes the prefix (tag), text and timestamp and applies it to
100
+ # the :format trait.
108
101
 
109
- message
110
- end
102
+ def log_interpolate prefix, text, time = timestamp
103
+ message = class_trait[:format].dup
111
104
 
112
- # This uses Global.inform_timestamp or a date in the format of
113
- # %Y-%m-%d %H:%M:%S
114
- # # => "2007-01-19 21:09:32"
105
+ vars = { '%time' => time, '%prefix' => prefix, '%text' => text }
106
+ vars.each{|from, to| message.gsub!(from, to) }
115
107
 
116
- def timestamp
117
- mask = class_trait[:timestamp]
118
- Time.now.strftime(mask || "%Y-%m-%d %H:%M:%S")
119
- end
108
+ message
109
+ end
120
110
 
121
- # is @out closed?
111
+ # This uses Global.inform_timestamp or a date in the format of
112
+ # %Y-%m-%d %H:%M:%S
113
+ # # => "2007-01-19 21:09:32"
122
114
 
123
- def closed?
124
- @out.respond_to?(:closed?) and @out.closed?
125
- end
115
+ def timestamp
116
+ mask = class_trait[:timestamp]
117
+ Time.now.strftime(mask || "%Y-%m-%d %H:%M:%S")
126
118
  end
127
119
 
120
+ # is @out closed?
121
+
122
+ def closed?
123
+ @out.respond_to?(:closed?) and @out.closed?
124
+ end
128
125
  end
126
+
129
127
  end
130
128
  end
@@ -2,29 +2,27 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
- module Logging
6
- module Logger
5
+ module Logger
7
6
 
8
- # Informer for the Knotify notfication system used on KDE.
9
- # Doesn't need any special libraries.
7
+ # Informer for the Knotify notfication system used on KDE.
8
+ # Doesn't need any special libraries.
10
9
 
11
- class Knotify
12
- include Logging
10
+ class Knotify
11
+ include Logging
13
12
 
14
- trait :present => 16
13
+ trait :present => 16
15
14
 
16
- # Please see for more information on the API used here:
17
- # http://lukeplant.me.uk/articles.php?id=3
15
+ # Please see for more information on the API used here:
16
+ # http://lukeplant.me.uk/articles.php?id=3
18
17
 
19
- def log(tag, *messages)
20
- present = class_trait[:present]
21
- tag = tag.to_s.capitalize
22
- messages.flatten.each do |message|
23
- system(%{dcop knotify default notify Ramaze "#{tag}" "#{message}" '' '' #{present} 0})
24
- end
18
+ def log(tag, *messages)
19
+ present = class_trait[:present]
20
+ tag = tag.to_s.capitalize
21
+ messages.flatten.each do |message|
22
+ system(%{dcop knotify default notify Ramaze "#{tag}" "#{message}" '' '' #{present} 0})
25
23
  end
26
24
  end
27
-
28
25
  end
26
+
29
27
  end
30
28
  end
@@ -4,25 +4,23 @@
4
4
  require 'logger'
5
5
 
6
6
  module Ramaze
7
- module Logging
8
- module Logger
7
+ module Logger
9
8
 
10
- # Informer for the Stdlib Logger
9
+ # Informer for the Stdlib Logger
11
10
 
12
- class Logger < ::Logger
11
+ class Logger < ::Logger
13
12
 
14
- # integration to Logging
13
+ # integration to Logging
15
14
 
16
- def log(tag, *args)
17
- __send__(tag, args.join("\n"))
18
- end
19
-
20
- # Stub for compatibility
21
- def dev(*args)
22
- debug(*args)
23
- end
15
+ def log(tag, *args)
16
+ __send__(tag, args.join("\n"))
24
17
  end
25
18
 
19
+ # Stub for compatibility
20
+ def dev(*args)
21
+ debug(*args)
22
+ end
26
23
  end
24
+
27
25
  end
28
26
  end
@@ -2,90 +2,88 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  module Ramaze
5
- module Logging
6
5
 
7
- # This module provides a basic skeleton for your own loggers to be compatible.
8
- # The minimal usage is like this:
9
- #
10
- # class MyLogger
11
- # include Logging
12
- #
13
- # def log(tag, *args)
14
- # p tag => args
15
- # end
16
- # end
17
-
18
- module Logging
19
-
20
- # Takes the tag (:warn|:debug|:error|:info) and the name of a method to be
21
- # called upon elements of msgs that don't respond to :to_str
22
- # Goes on and sends the tag and transformed messages each to the #log method.
23
- # If you include this module you have to define #log or it will raise.
24
-
25
- def tag_log(tag, meth, *msgs)
26
- msgs.each do |msg|
27
- string = (msg.respond_to?(:to_str) ? msg : msg.send(meth))
28
- log(tag, string)
29
- end
30
- end
6
+ # This module provides a basic skeleton for your own loggers to be compatible.
7
+ # The minimal usage is like this:
8
+ #
9
+ # class MyLogger
10
+ # include Logging
11
+ #
12
+ # def log(tag, *args)
13
+ # p tag => args
14
+ # end
15
+ # end
31
16
 
32
- # Converts everything given to strings and passes them on with :info
17
+ module Logging
33
18
 
34
- def info(*objects)
35
- tag_log(:info, :to_s, *objects)
19
+ # Takes the tag (:warn|:debug|:error|:info) and the name of a method to be
20
+ # called upon elements of msgs that don't respond to :to_str
21
+ # Goes on and sends the tag and transformed messages each to the #log method.
22
+ # If you include this module you have to define #log or it will raise.
23
+
24
+ def tag_log(tag, meth, *msgs)
25
+ msgs.each do |msg|
26
+ string = (msg.respond_to?(:to_str) ? msg : msg.send(meth))
27
+ log(tag, string)
36
28
  end
29
+ end
37
30
 
38
- # Converts everything given to strings and passes them on with :warn
31
+ # Converts everything given to strings and passes them on with :info
39
32
 
40
- def warn(*objects)
41
- tag_log(:warn, :to_s, *objects)
42
- end
33
+ def info(*objects)
34
+ tag_log(:info, :to_s, *objects)
35
+ end
43
36
 
44
- # inspects objects if they are no strings. Tag is :debug
37
+ # Converts everything given to strings and passes them on with :warn
45
38
 
46
- def debug(*objects)
47
- tag_log(:debug, :inspect, *objects)
48
- end
39
+ def warn(*objects)
40
+ tag_log(:warn, :to_s, *objects)
41
+ end
49
42
 
50
- # inspects objects if they are no strings. Tag is :dev
43
+ # inspects objects if they are no strings. Tag is :debug
51
44
 
52
- def dev(*objects)
53
- tag_log(:dev, :inspect, *objects)
54
- end
45
+ def debug(*objects)
46
+ tag_log(:debug, :inspect, *objects)
47
+ end
55
48
 
56
- alias << debug
49
+ # inspects objects if they are no strings. Tag is :dev
57
50
 
58
- # Takes either an Exception or just a String, formats backtraces to be a bit
59
- # more readable and passes all of this on to tag_log :error
51
+ def dev(*objects)
52
+ tag_log(:dev, :inspect, *objects)
53
+ end
60
54
 
61
- def error(ex)
62
- if ex.respond_to?(:exception)
63
- message = [ex.backtrace].flatten[0..Global.backtrace_size]
64
- message.map{|m| m.to_s.gsub(/^#{Regexp.escape(Dir.pwd)}/, '.') }
65
- message.unshift(ex.inspect)
66
- else
67
- message = ex.to_s
68
- end
69
- tag_log(:error, :to_s, *message)
70
- end
55
+ alias << debug
71
56
 
72
- # raises
57
+ # Takes either an Exception or just a String, formats backtraces to be a bit
58
+ # more readable and passes all of this on to tag_log :error
73
59
 
74
- def log(*args)
75
- raise "#log should be implemented by an instance including this module (#{self})"
60
+ def error(ex)
61
+ if ex.respond_to?(:exception)
62
+ message = [ex.backtrace].flatten[0..Global.backtrace_size]
63
+ message.map{|m| m.to_s.gsub(/^#{Regexp.escape(Dir.pwd)}/, '.') }
64
+ message.unshift(ex.inspect)
65
+ else
66
+ message = ex.to_s
76
67
  end
68
+ tag_log(:error, :to_s, *message)
69
+ end
77
70
 
78
- # nothing
71
+ # raises
79
72
 
80
- def shutdown
81
- end
73
+ def log(*args)
74
+ raise "#log should be implemented by an instance including this module (#{self})"
75
+ end
82
76
 
83
- # stub for WEBrick
77
+ # nothing
84
78
 
85
- def debug?
86
- false
87
- end
79
+ def shutdown
88
80
  end
89
81
 
82
+ # stub for WEBrick
83
+
84
+ def debug?
85
+ false
86
+ end
90
87
  end
88
+
91
89
  end