clogger 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -1
- data/.gitignore +3 -1
- data/GIT-VERSION-GEN +40 -0
- data/GNUmakefile +90 -53
- data/Rakefile +97 -15
- data/clogger.gemspec +16 -3
- data/ext/clogger_ext/clogger.c +10 -3
- data/lib/clogger.rb +1 -1
- data/test/test_clogger.rb +40 -0
- metadata +14 -6
data/.document
CHANGED
data/.gitignore
CHANGED
data/GIT-VERSION-GEN
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
GVF=GIT-VERSION-FILE
|
4
|
+
DEF_VER=v0.1.0.GIT
|
5
|
+
|
6
|
+
LF='
|
7
|
+
'
|
8
|
+
|
9
|
+
# First see if there is a version file (included in release tarballs),
|
10
|
+
# then try git-describe, then default.
|
11
|
+
if test -f version
|
12
|
+
then
|
13
|
+
VN=$(cat version) || VN="$DEF_VER"
|
14
|
+
elif test -d .git -o -f .git &&
|
15
|
+
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
16
|
+
case "$VN" in
|
17
|
+
*$LF*) (exit 1) ;;
|
18
|
+
v[0-9]*)
|
19
|
+
git update-index -q --refresh
|
20
|
+
test -z "$(git diff-index --name-only HEAD --)" ||
|
21
|
+
VN="$VN-dirty" ;;
|
22
|
+
esac
|
23
|
+
then
|
24
|
+
VN=$(echo "$VN" | sed -e 's/-/./g');
|
25
|
+
else
|
26
|
+
VN="$DEF_VER"
|
27
|
+
fi
|
28
|
+
|
29
|
+
VN=$(expr "$VN" : v*'\(.*\)')
|
30
|
+
|
31
|
+
if test -r $GVF
|
32
|
+
then
|
33
|
+
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
|
34
|
+
else
|
35
|
+
VC=unset
|
36
|
+
fi
|
37
|
+
test "$VN" = "$VC" || {
|
38
|
+
echo >&2 "GIT_VERSION = $VN"
|
39
|
+
echo "GIT_VERSION = $VN" >$GVF
|
40
|
+
}
|
data/GNUmakefile
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
all:: test
|
2
2
|
ruby = ruby
|
3
3
|
rake = rake
|
4
|
+
GIT_URL = git://git.bogomips.org/clogger.git
|
4
5
|
|
6
|
+
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
7
|
+
@./GIT-VERSION-GEN
|
8
|
+
-include GIT-VERSION-FILE
|
5
9
|
-include local.mk
|
6
10
|
|
7
11
|
ifeq ($(DLEXT),) # "so" for Linux
|
@@ -26,84 +30,117 @@ test-pure:
|
|
26
30
|
|
27
31
|
test: test-ext test-pure
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
|
34
|
+
manifest: $(pkg_extra)
|
35
|
+
$(RM) .manifest
|
36
|
+
$(MAKE) .manifest
|
37
|
+
|
38
|
+
.manifest:
|
39
|
+
(git ls-files && \
|
40
|
+
for i in $@ $(pkg_extra); \
|
41
|
+
do echo $$i; done) | LC_ALL=C sort > $@+
|
42
|
+
cmp $@+ $@ || mv $@+ $@
|
43
|
+
$(RM) $@+
|
44
|
+
|
45
|
+
NEWS: GIT-VERSION-FILE
|
46
|
+
$(rake) -s news_rdoc > $@+
|
31
47
|
mv $@+ $@
|
32
48
|
|
33
|
-
.
|
34
|
-
|
49
|
+
SINCE = 0.0.7
|
50
|
+
ChangeLog: log_range = $(shell test -n "$(SINCE)" && echo v$(SINCE)..)
|
51
|
+
ChangeLog: GIT-VERSION-FILE
|
52
|
+
@echo "ChangeLog from $(GIT_URL) ($(SINCE)..$(GIT_VERSION))" > $@+
|
53
|
+
@echo >> $@+
|
54
|
+
git log $(log_range) | sed -e 's/^/ /' >> $@+
|
35
55
|
mv $@+ $@
|
36
56
|
|
37
|
-
|
57
|
+
news_atom := http://clogger.rubyforge.org/NEWS.atom.xml
|
58
|
+
cgit_atom := http://git.bogomips.org/cgit/clogger.git/atom/?h=master
|
59
|
+
atom = <link rel="alternate" title="Atom feed" href="$(1)" \
|
60
|
+
type="application/atom+xml"/>
|
61
|
+
|
62
|
+
doc: .document NEWS ChangeLog
|
63
|
+
rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
|
64
|
+
install -m644 COPYING doc/COPYING
|
65
|
+
install -m644 $(shell grep '^[A-Z]' .document) doc/
|
66
|
+
$(ruby) -i -p -e \
|
67
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
|
68
|
+
doc/ChangeLog.html
|
69
|
+
$(ruby) -i -p -e \
|
70
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
|
71
|
+
doc/NEWS.html doc/README.html
|
72
|
+
$(rake) -s news_atom > doc/NEWS.atom.xml
|
73
|
+
cd doc && ln README.html tmp && mv tmp index.html
|
74
|
+
|
75
|
+
# publishes docs to http://clogger.rubyforge.org/
|
76
|
+
# this preserves timestamps as best as possible to help HTTP caches out
|
77
|
+
# git set-file-times is here: http://git-scm.org/gitwiki/ExampleScripts
|
78
|
+
publish_doc:
|
79
|
+
git set-file-times
|
80
|
+
$(RM) -r doc
|
81
|
+
$(MAKE) doc
|
82
|
+
rsync -av --delete doc/ rubyforge.org:/var/www/gforge-projects/clogger/
|
83
|
+
git ls-files | xargs touch
|
38
84
|
|
39
85
|
ifneq ($(VERSION),)
|
40
|
-
|
41
|
-
|
86
|
+
rfproject := clogger
|
87
|
+
rfpackage := clogger
|
88
|
+
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
89
|
+
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
42
90
|
release_notes := release_notes-$(VERSION)
|
43
91
|
release_changes := release_changes-$(VERSION)
|
92
|
+
|
44
93
|
release-notes: $(release_notes)
|
45
94
|
release-changes: $(release_changes)
|
46
|
-
$(release_changes):
|
47
|
-
|
48
|
-
echo >> $@+
|
49
|
-
git log $(vPREV)..v$(VERSION) >> $@+
|
95
|
+
$(release_changes):
|
96
|
+
$(rake) -s release_changes > $@+
|
50
97
|
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
51
|
-
$(release_notes):
|
52
|
-
$(
|
53
|
-
gem spec $(pkggem) description | sed -ne '/\w/p' > $@+
|
54
|
-
echo >> $@+
|
55
|
-
gem spec $(pkggem) homepage | sed -ne 's/^--- /* /p' >> $@+
|
56
|
-
gem spec $(pkggem) email | sed -ne 's/^--- /* /p' >> $@+
|
57
|
-
echo '* git://git.bogomips.org/clogger.git' >> $@+
|
58
|
-
echo >> $@+
|
59
|
-
echo Changes: >> $@+
|
60
|
-
echo >> $@+
|
61
|
-
git cat-file tag v$(VERSION) | awk 'p>1{print $$0}/^$$/{++p}' >> $@+
|
98
|
+
$(release_notes):
|
99
|
+
GIT_URL=$(GIT_URL) $(rake) -s release_notes > $@+
|
62
100
|
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
101
|
+
|
102
|
+
# ensures we're actually on the tagged $(VERSION), only used for release
|
63
103
|
verify:
|
64
|
-
|
104
|
+
test x"$(shell umask)" = x0022
|
65
105
|
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
66
|
-
@test -n "$(VISUAL)" || { echo >&2 VISUAL= not defined; exit 1; }
|
67
106
|
git diff-index --quiet HEAD^0
|
68
107
|
test `git rev-parse --verify HEAD^0` = \
|
69
108
|
`git rev-parse --verify refs/tags/v$(VERSION)^{}`
|
70
109
|
|
71
|
-
|
72
|
-
|
110
|
+
fix-perms:
|
111
|
+
-git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
112
|
+
-git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
113
|
+
|
114
|
+
gem: $(pkggem)
|
115
|
+
|
116
|
+
install-gem: $(pkggem)
|
117
|
+
gem install $(CURDIR)/$<
|
118
|
+
|
119
|
+
$(pkggem): manifest fix-perms
|
120
|
+
gem build $(rfpackage).gemspec
|
73
121
|
mkdir -p pkg
|
74
122
|
mv $(@F) $@
|
75
123
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
124
|
+
$(pkgtgz): distdir = $(basename $@)
|
125
|
+
$(pkgtgz): HEAD = v$(VERSION)
|
126
|
+
$(pkgtgz): manifest fix-perms
|
127
|
+
@test -n "$(distdir)"
|
128
|
+
$(RM) -r $(distdir)
|
129
|
+
mkdir -p $(distdir)
|
130
|
+
tar c `cat .manifest` | (cd $(distdir) && tar x)
|
131
|
+
cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
|
82
132
|
mv $@+ $@
|
83
133
|
|
84
|
-
package:
|
134
|
+
package: $(pkgtgz) $(pkggem)
|
85
135
|
|
86
|
-
|
87
|
-
release: package $(release_notes) $(release_changes)
|
136
|
+
release: verify package $(release_notes) $(release_changes)
|
88
137
|
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
89
|
-
|
138
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
90
139
|
rubyforge add_file \
|
91
|
-
|
140
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
141
|
+
else
|
142
|
+
gem install-gem: GIT-VERSION-FILE
|
143
|
+
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
92
144
|
endif
|
93
145
|
|
94
|
-
|
95
|
-
rdoc -Na -t "$(shell sed -ne '1s/^= //p' README)"
|
96
|
-
install -m644 COPYING doc/COPYING
|
97
|
-
cd doc && ln README.html tmp.html && mv tmp.html index.html
|
98
|
-
|
99
|
-
# publishes docs to http://clogger.rubyforge.org/
|
100
|
-
# this preserves timestamps as best as possible to help HTTP caches out
|
101
|
-
# git set-file-times can is here: http://git-scm.org/gitwiki/ExampleScripts
|
102
|
-
publish_doc:
|
103
|
-
git set-file-times
|
104
|
-
$(RM) -r doc
|
105
|
-
$(MAKE) doc
|
106
|
-
rsync -av --delete doc/ rubyforge.org:/var/www/gforge-projects/clogger/
|
107
|
-
git ls-files | xargs touch
|
108
|
-
|
109
|
-
.PHONY: test doc .manifest release History
|
146
|
+
.PHONY: .FORCE-GIT-VERSION-FILE test doc manifest
|
data/Rakefile
CHANGED
@@ -5,21 +5,6 @@ rescue LoadError
|
|
5
5
|
warn "rake-compiler not available, cross compiling disabled"
|
6
6
|
end
|
7
7
|
|
8
|
-
desc 'prints RDoc-formatted history'
|
9
|
-
task :history do
|
10
|
-
tags = `git tag -l`.split(/\n/).grep(/^v/).reverse
|
11
|
-
timefmt = '%Y-%m-%d %H:%M UTC'
|
12
|
-
tags.each do |tag|
|
13
|
-
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
14
|
-
tagger = header.split(/\n/).grep(/^tagger /).first.split(/\s/)
|
15
|
-
time = Time.at(tagger[-2].to_i).utc
|
16
|
-
puts "=== #{tag.sub(/^v/, '')} / #{time.strftime(timefmt)}"
|
17
|
-
puts ""
|
18
|
-
puts body.gsub(/^/sm, " ")
|
19
|
-
puts ""
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
8
|
desc "read news article from STDIN and post to rubyforge"
|
24
9
|
task :publish_news do
|
25
10
|
require 'rubyforge'
|
@@ -35,3 +20,100 @@ task :publish_news do
|
|
35
20
|
rf.login
|
36
21
|
rf.post_news('clogger', subject, body)
|
37
22
|
end
|
23
|
+
|
24
|
+
def tags
|
25
|
+
timefmt = '%Y-%m-%dT%H:%M:%SZ'
|
26
|
+
@tags ||= `git tag -l`.split(/\n/).map do |tag|
|
27
|
+
next if tag == "v0.0.0"
|
28
|
+
if %r{\Av[\d\.]+\z} =~ tag
|
29
|
+
header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
|
30
|
+
header = header.split(/\n/)
|
31
|
+
tagger = header.grep(/\Atagger /).first
|
32
|
+
body ||= "initial"
|
33
|
+
{
|
34
|
+
:time => Time.at(tagger.split(/ /)[-2].to_i).utc.strftime(timefmt),
|
35
|
+
:tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1],
|
36
|
+
:tagger_email => %r{<([^>]+)>}.match(tagger)[1],
|
37
|
+
:id => `git rev-parse refs/tags/#{tag}`.chomp!,
|
38
|
+
:tag => tag,
|
39
|
+
:subject => subject,
|
40
|
+
:body => body,
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end.compact.sort { |a,b| b[:time] <=> a[:time] }
|
44
|
+
end
|
45
|
+
|
46
|
+
cgit_url = "http://git.bogomips.org/cgit/clogger.git"
|
47
|
+
|
48
|
+
desc 'prints news as an Atom feed'
|
49
|
+
task :news_atom do
|
50
|
+
require 'nokogiri'
|
51
|
+
new_tags = tags[0,10]
|
52
|
+
puts(Nokogiri::XML::Builder.new do
|
53
|
+
feed :xmlns => "http://www.w3.org/2005/Atom" do
|
54
|
+
id! "http://clogger.rubyforge.org/NEWS.atom.xml"
|
55
|
+
title "Clogger news"
|
56
|
+
subtitle "configurable request logging for Rack"
|
57
|
+
link! :rel => 'alternate', :type => 'text/html',
|
58
|
+
:href => 'http://clogger.rubyforge.org/NEWS.html'
|
59
|
+
updated new_tags.first[:time]
|
60
|
+
new_tags.each do |tag|
|
61
|
+
entry do
|
62
|
+
title tag[:subject]
|
63
|
+
updated tag[:time]
|
64
|
+
published tag[:time]
|
65
|
+
author {
|
66
|
+
name tag[:tagger_name]
|
67
|
+
email tag[:tagger_email]
|
68
|
+
}
|
69
|
+
url = "#{cgit_url}/tag/?id=#{tag[:tag]}"
|
70
|
+
link! :rel => "alternate", :type => "text/html", :href =>url
|
71
|
+
id! url
|
72
|
+
content(:type => 'text') { tag[:body] }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end.to_xml)
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'prints RDoc-formatted news'
|
80
|
+
task :news_rdoc do
|
81
|
+
tags.each do |tag|
|
82
|
+
time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
|
83
|
+
puts "=== #{tag[:tag].sub(/^v/, '')} / #{time}"
|
84
|
+
puts ""
|
85
|
+
|
86
|
+
body = tag[:body]
|
87
|
+
puts tag[:body].gsub(/^/sm, " ").gsub(/[ \t]+$/sm, "")
|
88
|
+
puts ""
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
desc "print release changelog for Rubyforge"
|
93
|
+
task :release_changes do
|
94
|
+
version = ENV['VERSION'] or abort "VERSION= needed"
|
95
|
+
version = "v#{version}"
|
96
|
+
vtags = tags.map { |tag| tag[:tag] =~ /\Av/ and tag[:tag] }.sort
|
97
|
+
prev = vtags[vtags.index(version) - 1]
|
98
|
+
system('git', 'diff', '--stat', prev, version) or abort $?
|
99
|
+
puts ""
|
100
|
+
system('git', 'log', "#{prev}..#{version}") or abort $?
|
101
|
+
end
|
102
|
+
|
103
|
+
desc "print release notes for Rubyforge"
|
104
|
+
task :release_notes do
|
105
|
+
require 'rubygems'
|
106
|
+
|
107
|
+
git_url = ENV['GIT_URL'] || 'git://git.bogomips.org/clogger.git'
|
108
|
+
|
109
|
+
spec = Gem::Specification.load('clogger.gemspec')
|
110
|
+
puts spec.description.strip
|
111
|
+
puts ""
|
112
|
+
puts "* #{spec.homepage}"
|
113
|
+
puts "* #{spec.email}"
|
114
|
+
puts "* #{git_url}"
|
115
|
+
|
116
|
+
_, _, body = `git cat-file tag v#{spec.version}`.split(/\n\n/, 3)
|
117
|
+
print "\nChanges:\n\n"
|
118
|
+
puts body
|
119
|
+
end
|
data/clogger.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
ENV["VERSION"] or abort "VERSION= must be specified"
|
2
|
+
manifest = File.readlines('.manifest').map! { |x| x.chomp! }
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = %q{clogger}
|
@@ -15,8 +16,19 @@ Clogger is Rack middleware for logging HTTP requests. The log format
|
|
15
16
|
is customizable so you can specify exactly which fields to log.
|
16
17
|
}.strip
|
17
18
|
s.email = %q{clogger@librelist.com}
|
18
|
-
|
19
|
-
s.
|
19
|
+
|
20
|
+
s.extra_rdoc_files = File.readlines('.document').map! do |x|
|
21
|
+
x.chomp!
|
22
|
+
if File.directory?(x)
|
23
|
+
manifest.grep(%r{\A#{x}/})
|
24
|
+
elsif File.file?(x)
|
25
|
+
x
|
26
|
+
else
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end.flatten.compact
|
30
|
+
|
31
|
+
s.files = manifest
|
20
32
|
s.rdoc_options = [ "-Na",
|
21
33
|
"-t", "Clogger - configurable request logging for Rack"
|
22
34
|
]
|
@@ -28,5 +40,6 @@ is customizable so you can specify exactly which fields to log.
|
|
28
40
|
# HeaderHash wasn't case-insensitive in old versions
|
29
41
|
s.add_dependency(%q<rack>, ["> 0.9"])
|
30
42
|
s.extensions = %w(ext/clogger_ext/extconf.rb)
|
31
|
-
|
43
|
+
|
44
|
+
# s.license = "LGPLv3" # disabled for compatibility with older RubyGems
|
32
45
|
end
|
data/ext/clogger_ext/clogger.c
CHANGED
@@ -124,7 +124,7 @@ static inline int need_escape(unsigned c)
|
|
124
124
|
}
|
125
125
|
|
126
126
|
/* we are encoding-agnostic, clients can send us all sorts of junk */
|
127
|
-
static VALUE
|
127
|
+
static VALUE byte_xs_str(VALUE from)
|
128
128
|
{
|
129
129
|
static const char esc[] = "0123456789ABCDEF";
|
130
130
|
unsigned char *new_ptr;
|
@@ -164,6 +164,11 @@ static VALUE byte_xs(VALUE from)
|
|
164
164
|
return rv;
|
165
165
|
}
|
166
166
|
|
167
|
+
static VALUE byte_xs(VALUE from)
|
168
|
+
{
|
169
|
+
return byte_xs_str(rb_obj_as_string(from));
|
170
|
+
}
|
171
|
+
|
167
172
|
static void clogger_mark(void *ptr)
|
168
173
|
{
|
169
174
|
struct clogger *c = ptr;
|
@@ -459,7 +464,7 @@ static void append_request_env(struct clogger *c, VALUE key)
|
|
459
464
|
{
|
460
465
|
VALUE tmp = rb_hash_aref(c->env, key);
|
461
466
|
|
462
|
-
tmp = NIL_P(tmp) ? g_dash : byte_xs(
|
467
|
+
tmp = NIL_P(tmp) ? g_dash : byte_xs(tmp);
|
463
468
|
rb_str_buf_append(c->log_buf, tmp);
|
464
469
|
}
|
465
470
|
|
@@ -470,7 +475,7 @@ static void append_response(struct clogger *c, VALUE key)
|
|
470
475
|
assert(rb_obj_class(c->headers) == cHeaderHash);
|
471
476
|
|
472
477
|
v = rb_funcall(c->headers, sq_brace_id, 1, key);
|
473
|
-
v = NIL_P(v) ? g_dash : byte_xs(
|
478
|
+
v = NIL_P(v) ? g_dash : byte_xs(v);
|
474
479
|
rb_str_buf_append(c->log_buf, v);
|
475
480
|
}
|
476
481
|
|
@@ -714,6 +719,8 @@ static VALUE clogger_call(VALUE self, VALUE env)
|
|
714
719
|
struct clogger *c = clogger_get(self);
|
715
720
|
VALUE rv;
|
716
721
|
|
722
|
+
env = rb_check_convert_type(env, T_HASH, "Hash", "to_hash");
|
723
|
+
|
717
724
|
if (c->wrap_body) {
|
718
725
|
if (c->reentrant < 0) {
|
719
726
|
VALUE tmp = rb_hash_aref(env, g_rack_multithread);
|
data/lib/clogger.rb
CHANGED
data/test/test_clogger.rb
CHANGED
@@ -7,6 +7,11 @@ require "stringio"
|
|
7
7
|
require "rack"
|
8
8
|
|
9
9
|
require "clogger"
|
10
|
+
|
11
|
+
# used to test subclasses
|
12
|
+
class FooString < String
|
13
|
+
end
|
14
|
+
|
10
15
|
class TestClogger < Test::Unit::TestCase
|
11
16
|
include Clogger::Format
|
12
17
|
|
@@ -392,6 +397,41 @@ class TestClogger < Test::Unit::TestCase
|
|
392
397
|
assert_nothing_raised { cl.call(@req) }
|
393
398
|
end
|
394
399
|
|
400
|
+
def test_subclass_hash
|
401
|
+
str = StringIO.new
|
402
|
+
req = Rack::Utils::HeaderHash.new(@req)
|
403
|
+
app = lambda { |env| [302, [ %w(a) ], []] }
|
404
|
+
cl = Clogger.new(app, :logger => str, :format => Rack_1_0)
|
405
|
+
assert_nothing_raised { cl.call(req).last.each {} }
|
406
|
+
assert str.size > 0
|
407
|
+
end
|
408
|
+
|
409
|
+
def test_subclassed_string_req
|
410
|
+
str = StringIO.new
|
411
|
+
req = {}
|
412
|
+
@req.each { |key,value|
|
413
|
+
req[FooString.new(key)] = value.kind_of?(String) ?
|
414
|
+
FooString.new(value) : value
|
415
|
+
}
|
416
|
+
app = lambda { |env| [302, [ %w(a) ], []] }
|
417
|
+
cl = Clogger.new(app, :logger => str, :format => Rack_1_0)
|
418
|
+
assert_nothing_raised { cl.call(req).last.each {} }
|
419
|
+
assert str.size > 0
|
420
|
+
end
|
421
|
+
|
422
|
+
def test_subclassed_string_in_body
|
423
|
+
str = StringIO.new
|
424
|
+
body = "hello"
|
425
|
+
r = nil
|
426
|
+
app = lambda { |env| [302, [ %w(a) ], [FooString.new(body)]] }
|
427
|
+
cl = Clogger.new(app, :logger => str, :format => '$body_bytes_sent')
|
428
|
+
assert_nothing_raised { cl.call(@req).last.each { |x| r = x } }
|
429
|
+
assert str.size > 0
|
430
|
+
assert_equal body.size.to_s << "\n", str.string
|
431
|
+
assert_equal r, body
|
432
|
+
assert r.object_id != body.object_id
|
433
|
+
end
|
434
|
+
|
395
435
|
def test_http_09_request
|
396
436
|
str = StringIO.new
|
397
437
|
app = lambda { |env| [302, [ %w(a) ], []] }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Wong
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,14 +32,22 @@ extensions:
|
|
32
32
|
- ext/clogger_ext/extconf.rb
|
33
33
|
extra_rdoc_files:
|
34
34
|
- README
|
35
|
-
-
|
35
|
+
- NEWS
|
36
|
+
- ChangeLog
|
37
|
+
- lib/clogger.rb
|
38
|
+
- lib/clogger/format.rb
|
39
|
+
- lib/clogger/pure.rb
|
40
|
+
- ext/clogger_ext/clogger.c
|
36
41
|
files:
|
37
42
|
- .document
|
38
43
|
- .gitignore
|
39
44
|
- .manifest
|
40
45
|
- COPYING
|
46
|
+
- ChangeLog
|
47
|
+
- GIT-VERSION-FILE
|
48
|
+
- GIT-VERSION-GEN
|
41
49
|
- GNUmakefile
|
42
|
-
-
|
50
|
+
- NEWS
|
43
51
|
- README
|
44
52
|
- Rakefile
|
45
53
|
- clogger.gemspec
|
@@ -53,8 +61,8 @@ files:
|
|
53
61
|
- test/test_clogger.rb
|
54
62
|
has_rdoc: true
|
55
63
|
homepage: http://clogger.rubyforge.org/
|
56
|
-
licenses:
|
57
|
-
|
64
|
+
licenses: []
|
65
|
+
|
58
66
|
post_install_message:
|
59
67
|
rdoc_options:
|
60
68
|
- -Na
|