ramaze 2008.06 → 2008.11
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.
- data/README.markdown +6 -6
- data/Rakefile +33 -3
- data/bin/ramaze +18 -0
- data/doc/CHANGELOG +960 -0
- data/doc/LEGAL +5 -1
- data/doc/meta/announcement.txt +20 -36
- data/doc/tutorial/todolist.html +421 -313
- data/doc/tutorial/todolist.mkd +33 -16
- data/examples/app/blog/spec/blog.rb +3 -3
- data/examples/app/rapaste/controller/paste.rb +8 -1
- data/examples/app/rapaste/model/paste.rb +3 -0
- data/examples/app/rapaste/spec/rapaste.rb +3 -1
- data/examples/app/rapaste/start.rb +3 -2
- data/examples/app/sourceview/public/sourceview.js +2 -2
- data/examples/app/todolist/spec/todolist.rb +6 -6
- data/examples/app/todolist/template/index.xhtml +1 -1
- data/examples/app/whywiki/spec/whywiki.rb +2 -2
- data/examples/app/wikore/spec/wikore.rb +2 -2
- data/examples/app/wikore/src/model.rb +4 -3
- data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
- data/examples/basic/simple.rb +2 -2
- data/examples/helpers/paginate.rb +71 -0
- data/examples/misc/simple_auth.rb +20 -8
- data/lib/proto/controller/init.rb +10 -0
- data/lib/proto/controller/main.rb +1 -3
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/dispatch.fcgi +1 -1
- data/lib/proto/spec/main.rb +2 -1
- data/lib/proto/start.rb +3 -3
- data/lib/proto/start.ru +1 -1
- data/lib/proto/view/error.xhtml +4 -4
- data/lib/ramaze.rb +8 -3
- data/lib/ramaze/action.rb +6 -6
- data/lib/ramaze/adapter.rb +1 -6
- data/lib/ramaze/adapter/base.rb +30 -27
- data/lib/ramaze/adapter/cgi.rb +1 -0
- data/lib/ramaze/cache.rb +1 -3
- data/lib/ramaze/cache/memcached.rb +3 -5
- data/lib/ramaze/contrib/auto_params.rb +2 -2
- data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
- data/lib/ramaze/contrib/gems.rb +17 -18
- data/lib/ramaze/contrib/gzip_filter.rb +22 -9
- data/lib/ramaze/contrib/maruku_uv.rb +59 -0
- data/lib/ramaze/contrib/profiling.rb +1 -1
- data/lib/ramaze/contrib/rest.rb +16 -13
- data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
- data/lib/ramaze/contrib/sequel/image.rb +198 -0
- data/lib/ramaze/contrib/sequel/relation.rb +82 -0
- data/lib/ramaze/controller.rb +33 -34
- data/lib/ramaze/controller/resolve.rb +29 -9
- data/lib/ramaze/current.rb +60 -20
- data/lib/ramaze/current/request.rb +8 -7
- data/lib/ramaze/current/response.rb +15 -3
- data/lib/ramaze/current/session/flash.rb +8 -0
- data/lib/ramaze/dispatcher.rb +17 -9
- data/lib/ramaze/dispatcher/action.rb +4 -5
- data/lib/ramaze/dispatcher/directory.rb +1 -1
- data/lib/ramaze/dispatcher/error.rb +4 -4
- data/lib/ramaze/dispatcher/file.rb +4 -4
- data/lib/ramaze/gestalt.rb +15 -20
- data/lib/ramaze/helper/cgi.rb +7 -15
- data/lib/ramaze/helper/formatting.rb +41 -1
- data/lib/ramaze/helper/httpdigest.rb +20 -7
- data/lib/ramaze/helper/link.rb +4 -6
- data/lib/ramaze/helper/paginate.rb +233 -0
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/helper/rest.rb +1 -1
- data/lib/ramaze/helper/thread.rb +17 -0
- data/lib/ramaze/helper/ultraviolet.rb +44 -0
- data/lib/ramaze/helper/user.rb +4 -9
- data/lib/ramaze/log.rb +2 -2
- data/lib/ramaze/log/analogger.rb +21 -23
- data/lib/ramaze/log/growl.rb +21 -23
- data/lib/ramaze/log/hub.rb +1 -1
- data/lib/ramaze/log/informer.rb +97 -99
- data/lib/ramaze/log/knotify.rb +14 -16
- data/lib/ramaze/log/logger.rb +11 -13
- data/lib/ramaze/log/logging.rb +61 -63
- data/lib/ramaze/log/rotatinginformer.rb +168 -0
- data/lib/ramaze/log/syslog.rb +41 -31
- data/lib/ramaze/log/xosd.rb +70 -72
- data/lib/ramaze/option.rb +9 -6
- data/lib/ramaze/option/holder.rb +5 -27
- data/lib/ramaze/reloader.rb +186 -0
- data/lib/ramaze/setup.rb +1 -1
- data/lib/ramaze/snippets.rb +13 -0
- data/lib/ramaze/snippets/array/put_within.rb +31 -24
- data/lib/ramaze/snippets/binding/locals.rb +23 -11
- data/lib/ramaze/snippets/dictionary.rb +2 -2
- data/lib/ramaze/snippets/fiber.rb +63 -0
- data/lib/ramaze/snippets/kernel/constant.rb +36 -21
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
- data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
- data/lib/ramaze/snippets/numeric/time.rb +63 -0
- data/lib/ramaze/snippets/object/__dir__.rb +29 -0
- data/lib/ramaze/snippets/object/acquire.rb +40 -0
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
- data/lib/ramaze/snippets/object/pretty.rb +14 -4
- data/lib/ramaze/snippets/object/scope.rb +14 -7
- data/lib/ramaze/snippets/ordered_set.rb +25 -14
- data/lib/ramaze/snippets/proc/locals.rb +17 -9
- data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
- data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
- data/lib/ramaze/snippets/ramaze/state.rb +86 -0
- data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
- data/lib/ramaze/snippets/string/camel_case.rb +13 -8
- data/lib/ramaze/snippets/string/color.rb +24 -20
- data/lib/ramaze/snippets/string/each.rb +14 -3
- data/lib/ramaze/snippets/string/end_with.rb +20 -0
- data/lib/ramaze/snippets/string/esc.rb +26 -21
- data/lib/ramaze/snippets/string/ord.rb +12 -6
- data/lib/ramaze/snippets/string/snake_case.rb +13 -7
- data/lib/ramaze/snippets/string/start_with.rb +16 -5
- data/lib/ramaze/snippets/string/unindent.rb +23 -15
- data/lib/ramaze/snippets/thread/into.rb +3 -3
- data/lib/ramaze/spec/helper/bacon.rb +5 -5
- data/lib/ramaze/spec/helper/mock_http.rb +1 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
- data/lib/ramaze/spec/helper/snippets.rb +8 -0
- data/lib/ramaze/template.rb +4 -1
- data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
- data/lib/ramaze/template/maruku.rb +34 -0
- data/lib/ramaze/template/tagz.rb +2 -2
- data/lib/ramaze/template/xslt.rb +2 -2
- data/lib/ramaze/tool/create.rb +27 -53
- data/lib/ramaze/tool/localize.rb +8 -4
- data/lib/ramaze/tool/mime.rb +11 -1
- data/lib/ramaze/tool/project_creator.rb +110 -0
- data/lib/ramaze/trinity.rb +4 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/vendor/bacon.rb +323 -0
- data/rake_tasks/gem.rake +10 -1
- data/rake_tasks/maintenance.rake +40 -2
- data/rake_tasks/metric.rake +24 -0
- data/rake_tasks/release.rake +17 -4
- data/rake_tasks/spec.rake +1 -2
- data/ramaze.gemspec +549 -495
- data/spec/contrib/auto_params.rb +3 -3
- data/spec/contrib/profiling.rb +2 -2
- data/spec/examples/simple_auth.rb +2 -2
- data/spec/examples/templates/template_haml.rb +0 -2
- data/spec/ramaze/action/file_cache.rb +22 -0
- data/spec/ramaze/adapter.rb +2 -2
- data/spec/ramaze/controller/actionless_templates.rb +1 -1
- data/spec/ramaze/controller/subclass.rb +15 -0
- data/spec/ramaze/controller/template_resolving.rb +1 -1
- data/spec/ramaze/controller/view/bar.xhtml +1 -0
- data/spec/ramaze/controller/view/base/another.xhtml +1 -0
- data/spec/ramaze/current/session.rb +1 -1
- data/spec/ramaze/dispatcher/file.rb +2 -2
- data/spec/ramaze/helper/aspect.rb +26 -17
- data/spec/ramaze/helper/formatting.rb +13 -0
- data/spec/ramaze/log/informer.rb +10 -10
- data/spec/ramaze/log/syslog.rb +67 -4
- data/spec/ramaze/rewrite.rb +1 -1
- data/spec/ramaze/route.rb +1 -1
- data/spec/ramaze/struct.rb +47 -0
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/tagz.rb +1 -1
- data/spec/snippets/binding/locals.rb +9 -0
- data/spec/snippets/numeric/time.rb +12 -0
- data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
- data/spec/snippets/{kernel → object}/acquire.rb +0 -0
- metadata +90 -81
- data/cache.yaml +0 -7
- data/examples/app/rammit/spec/rammit.rb +0 -31
- data/examples/app/rammit/src/controller/main.rb +0 -3
- data/examples/app/rammit/src/controller/page.rb +0 -16
- data/examples/app/rammit/src/model.rb +0 -33
- data/examples/app/rammit/start.rb +0 -8
- data/examples/app/rammit/template/index.xhtml +0 -14
- data/examples/app/rammit/template/page/view.xhtml +0 -4
- data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
- data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
- data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
- data/lib/ramaze/snippets/struct/fill.rb +0 -23
- data/lib/ramaze/snippets/struct/values_at.rb +0 -39
- data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
- data/lib/ramaze/sourcereload.rb +0 -176
- data/spec/snippets/struct/fill.rb +0 -26
- data/spec/snippets/struct/values_at.rb +0 -52
- data/spec/snippets/symbol/to_proc.rb +0 -13
data/lib/ramaze/log/hub.rb
CHANGED
data/lib/ramaze/log/informer.rb
CHANGED
@@ -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
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
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
|
-
|
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
|
-
|
63
|
+
if @out.respond_to?(:tty?) and class_trait[:colorize]
|
64
|
+
@colorize = @out.tty?
|
69
65
|
end
|
70
66
|
|
71
|
-
|
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
|
-
|
70
|
+
# Close the file we log to if it isn't closed already.
|
81
71
|
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
79
|
+
# Integration to Logging.
|
87
80
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
81
|
+
def log tag, *messages
|
82
|
+
return if closed? || !@log_levels.include?(tag)
|
83
|
+
messages.flatten!
|
92
84
|
|
93
|
-
|
94
|
-
@out.puts(log_interpolate(prefix, message))
|
95
|
-
end
|
85
|
+
prefix = tag.to_s.upcase.ljust(5)
|
96
86
|
|
97
|
-
|
87
|
+
if @colorize
|
88
|
+
color = COLORS[tag] ||= :white
|
89
|
+
prefix.replace prefix.send(color)
|
98
90
|
end
|
99
91
|
|
100
|
-
|
101
|
-
|
92
|
+
messages.each do |message|
|
93
|
+
@out.puts(log_interpolate(prefix, message))
|
94
|
+
end
|
102
95
|
|
103
|
-
|
104
|
-
|
96
|
+
@out.flush if @out.respond_to?(:flush)
|
97
|
+
end
|
105
98
|
|
106
|
-
|
107
|
-
|
99
|
+
# Takes the prefix (tag), text and timestamp and applies it to
|
100
|
+
# the :format trait.
|
108
101
|
|
109
|
-
|
110
|
-
|
102
|
+
def log_interpolate prefix, text, time = timestamp
|
103
|
+
message = class_trait[:format].dup
|
111
104
|
|
112
|
-
|
113
|
-
|
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
|
-
|
117
|
-
|
118
|
-
Time.now.strftime(mask || "%Y-%m-%d %H:%M:%S")
|
119
|
-
end
|
108
|
+
message
|
109
|
+
end
|
120
110
|
|
121
|
-
|
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
|
-
|
124
|
-
|
125
|
-
|
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
|
data/lib/ramaze/log/knotify.rb
CHANGED
@@ -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
|
6
|
-
module Logger
|
5
|
+
module Logger
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
# Informer for the Knotify notfication system used on KDE.
|
8
|
+
# Doesn't need any special libraries.
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
class Knotify
|
11
|
+
include Logging
|
13
12
|
|
14
|
-
|
13
|
+
trait :present => 16
|
15
14
|
|
16
|
-
|
17
|
-
|
15
|
+
# Please see for more information on the API used here:
|
16
|
+
# http://lukeplant.me.uk/articles.php?id=3
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
data/lib/ramaze/log/logger.rb
CHANGED
@@ -4,25 +4,23 @@
|
|
4
4
|
require 'logger'
|
5
5
|
|
6
6
|
module Ramaze
|
7
|
-
module
|
8
|
-
module Logger
|
7
|
+
module Logger
|
9
8
|
|
10
|
-
|
9
|
+
# Informer for the Stdlib Logger
|
11
10
|
|
12
|
-
|
11
|
+
class Logger < ::Logger
|
13
12
|
|
14
|
-
|
13
|
+
# integration to Logging
|
15
14
|
|
16
|
-
|
17
|
-
|
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
|
data/lib/ramaze/log/logging.rb
CHANGED
@@ -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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
17
|
+
module Logging
|
33
18
|
|
34
|
-
|
35
|
-
|
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
|
-
|
31
|
+
# Converts everything given to strings and passes them on with :info
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
def info(*objects)
|
34
|
+
tag_log(:info, :to_s, *objects)
|
35
|
+
end
|
43
36
|
|
44
|
-
|
37
|
+
# Converts everything given to strings and passes them on with :warn
|
45
38
|
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
def warn(*objects)
|
40
|
+
tag_log(:warn, :to_s, *objects)
|
41
|
+
end
|
49
42
|
|
50
|
-
|
43
|
+
# inspects objects if they are no strings. Tag is :debug
|
51
44
|
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
def debug(*objects)
|
46
|
+
tag_log(:debug, :inspect, *objects)
|
47
|
+
end
|
55
48
|
|
56
|
-
|
49
|
+
# inspects objects if they are no strings. Tag is :dev
|
57
50
|
|
58
|
-
|
59
|
-
|
51
|
+
def dev(*objects)
|
52
|
+
tag_log(:dev, :inspect, *objects)
|
53
|
+
end
|
60
54
|
|
61
|
-
|
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
|
-
|
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
|
-
|
75
|
-
|
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
|
-
|
71
|
+
# raises
|
79
72
|
|
80
|
-
|
81
|
-
|
73
|
+
def log(*args)
|
74
|
+
raise "#log should be implemented by an instance including this module (#{self})"
|
75
|
+
end
|
82
76
|
|
83
|
-
|
77
|
+
# nothing
|
84
78
|
|
85
|
-
|
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
|