Pistos-ramaze 2008.12 → 2009.01
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/examples/app/blog/model/entry.rb +8 -1
- data/examples/app/wikore/src/model.rb +7 -1
- data/lib/proto/public/.htaccess +24 -0
- data/lib/ramaze/contrib/gettext/po.rb +23 -23
- data/lib/ramaze/controller/resolve.rb +2 -2
- data/lib/ramaze/current/request.rb +13 -4
- data/lib/ramaze/helper/bench.rb +43 -0
- data/lib/ramaze/helper/markaby.rb +1 -1
- data/lib/ramaze/helper/paginate.rb +1 -1
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/log/syslog.rb +36 -36
- data/lib/ramaze/version.rb +1 -1
- data/ramaze.gemspec +3 -167
- data/spec/ramaze/log/syslog.rb +62 -59
- metadata +4 -168
data/spec/ramaze/log/syslog.rb
CHANGED
@@ -7,67 +7,70 @@ require 'ramaze/log/syslog'
|
|
7
7
|
|
8
8
|
describe 'Syslog' do
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
# close the syslog, if it was open for some reason before we
|
11
|
+
# start a test.
|
12
|
+
before do
|
13
|
+
if ( Syslog.opened? )
|
14
|
+
::Syslog.close
|
15
|
+
end
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
it 'should default initialize correctly' do
|
19
|
+
syslog = Ramaze::Logger::Syslog.new
|
20
|
+
::Syslog.opened?.should == true
|
21
|
+
::Syslog.ident.should == $0
|
22
|
+
::Syslog.options.should == ( ::Syslog::LOG_PID | ::Syslog::LOG_CONS )
|
23
|
+
::Syslog.facility.should == ::Syslog::LOG_USER
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
it 'should handle non default initialization' do
|
27
|
+
syslog = Ramaze::Logger::Syslog.new(
|
28
|
+
'ramaze_syslog_test', ::Syslog::LOG_NDELAY | ::Syslog::LOG_NOWAIT,
|
29
|
+
::Syslog::LOG_DAEMON
|
30
|
+
)
|
31
|
+
::Syslog.opened?.should == true
|
32
|
+
::Syslog.ident.should == 'ramaze_syslog_test'
|
33
|
+
::Syslog.options.should == ( ::Syslog::LOG_NDELAY | ::Syslog::LOG_NOWAIT )
|
34
|
+
::Syslog.facility.should == ::Syslog::LOG_DAEMON
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
37
|
+
# We test the actual logging using a trick found in te test code of the
|
38
|
+
# syslog module. We create a pipe, fork a child, reroute the childs
|
39
|
+
# stderr to the pipe. Then we open the logging using LOG_PERROR, so all
|
40
|
+
# log messages are written to stderror. In the parent we read the messages
|
41
|
+
# from the pipe and compare them to what we expected.
|
42
|
+
def test_log_msg( type, priority, msg )
|
43
|
+
logpipe = IO::pipe
|
44
|
+
child = fork {
|
45
|
+
logpipe[0].close
|
46
|
+
STDERR.reopen(logpipe[1])
|
47
|
+
syslog = Ramaze::Logger::Syslog.new(
|
48
|
+
'ramaze_syslog_test',
|
49
|
+
::Syslog::LOG_PID | ::Syslog::LOG_NDELAY | ::Syslog::LOG_PERROR,
|
50
|
+
::Syslog::LOG_USER
|
51
|
+
)
|
52
|
+
syslog.send priority, msg
|
53
|
+
Process.exit!( 0 )
|
54
|
+
}
|
55
|
+
logpipe[1].close
|
56
|
+
Process.waitpid(child)
|
54
57
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
58
|
+
logpipe[0].gets.should == "ramaze_syslog_test[#{child}]: #{msg}\n"
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should handle debug' do
|
62
|
+
test_log_msg :direct, :debug, "Hello Debug World"
|
63
|
+
end
|
64
|
+
it 'should handle dev' do
|
65
|
+
test_log_msg :direct, :dev, "Hello Dev World"
|
66
|
+
end
|
67
|
+
it 'should handle info' do
|
68
|
+
test_log_msg :direct, :info, 'Hello Info World!'
|
69
|
+
end
|
70
|
+
it 'should handle warn' do
|
71
|
+
test_log_msg :direct, :warn, 'Hello Warn World!'
|
72
|
+
end
|
73
|
+
it 'should handle error' do
|
74
|
+
test_log_msg :direct, :error, 'Hello Error World!'
|
75
|
+
end
|
73
76
|
end
|