clogger 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b76e4e3732458628f99861db1ea7b40bcf6ea794
4
+ data.tar.gz: 4d6ff9cf36d46a6715ae540b569962dbbe2ba519
5
+ SHA512:
6
+ metadata.gz: 17e4f24e68ae4be4dd878c32c364349009cbb788a434ac4109e773c12896213c3c34cc799f85a3836c82fc0687a165821177572d305fd7c37a7de7eb6bd66b72
7
+ data.tar.gz: 15546434b4982ee7d71d8a05a77440a732625611e4f436c38c09bc5c56facfb9bf6e0a24ca349feb3d8b4a5cc28be94e75d9954727e0e9e663a4b6278647ace1
@@ -1,5 +1,7 @@
1
1
  ---
2
- rdoc_url: http://clogger.rubyforge.org/
2
+ rdoc_url: http://clogger.bogomips.org/
3
3
  cgit_url: http://bogomips.org/clogger.git
4
4
  git_url: git://bogomips.org/clogger.git
5
+ public_email: clogger@librelist.org
6
+ private_email: clogger@bogomips.org
5
7
  changelog_since: 0.4.0
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v1.3.0
4
+ DEF_VER=v2.0.0
5
5
 
6
6
  LF='
7
7
  '
@@ -1,5 +1,5 @@
1
1
  all::
2
- RSYNC_DEST := rubyforge.org:/var/www/gforge-projects/clogger/
2
+ RSYNC_DEST := clogger.bogomips.org:/srv/clogger/
3
3
  rfproject := clogger
4
4
  rfpackage := clogger
5
5
  include pkg.mk
@@ -14,5 +14,4 @@ test: test-ext test-pure
14
14
  ifneq ($(VERSION),)
15
15
  release::
16
16
  $(RAKE) publish_news VERSION=$(VERSION)
17
- $(RAKE) raa_update VERSION=$(VERSION)
18
17
  endif
data/LICENSE CHANGED
@@ -1,14 +1,12 @@
1
- \Clogger is copyrighted Free Software by all contributors, see logs in
1
+ clogger is copyrighted Free Software by all contributors, see logs in
2
2
  revision control for names and email addresses of all of them.
3
3
 
4
4
  You can redistribute it and/or modify it under the terms of the GNU
5
5
  Lesser General Public License (LGPL) as published by the Free Software
6
6
  Foundation, version {2.1}[http://www.gnu.org/licenses/lgpl-2.1.txt] or
7
- or {3}[http://www.gnu.org/licenses/lgpl-3.0.txt] (see link:COPYING).
8
- The \Clogger project leader (Eric Wong) reserves the right to
9
- relicense \Clogger under future versions of the LGPL.
7
+ (at your option) any later version.
10
8
 
11
- \Clogger is distributed in the hope that it will be useful, but WITHOUT
9
+ clogger is distributed in the hope that it will be useful, but WITHOUT
12
10
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
11
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14
12
  License for more details.
data/README CHANGED
@@ -1,6 +1,6 @@
1
- = \Clogger - configurable request logging for Rack
1
+ = clogger - configurable request logging for Rack
2
2
 
3
- \Clogger is Rack middleware for logging HTTP requests. The log format
3
+ clogger is Rack middleware for logging HTTP requests. The log format
4
4
  is customizable so you can specify exactly which fields to log.
5
5
 
6
6
  == FEATURES
@@ -19,7 +19,7 @@ is customizable so you can specify exactly which fields to log.
19
19
  all bytes in the range of \x00-\x1F
20
20
 
21
21
  * multi-instance capable and (optionally) reentrant. You can use
22
- \Clogger in a multi-threaded server, and even multiple Cloggers logging
22
+ clogger in a multi-threaded server, and even multiple cloggers logging
23
23
  to different locations and different formats in the same process.
24
24
 
25
25
  * Pure Ruby version for non-MRI versions of Ruby (or via CLOGGER_PURE=1
@@ -28,7 +28,7 @@ is customizable so you can specify exactly which fields to log.
28
28
 
29
29
  == SYNOPSIS
30
30
 
31
- \Clogger may be loaded as Rack middleware in your config.ru:
31
+ clogger may be loaded as Rack middleware in your config.ru:
32
32
 
33
33
  # ENV['CLOGGER_PURE'] = '1' # uncomment to disable C extension
34
34
  require "clogger"
@@ -91,7 +91,7 @@ that receives a "<<" method:
91
91
 
92
92
  == REQUIREMENTS
93
93
 
94
- * {Ruby}[http://ruby-lang.org/], {Rack}[http://rack.rubyforge.org/]
94
+ * {Ruby}[http://www.ruby-lang.org/], {Rack}[http://rack.github.io/]
95
95
 
96
96
  == DEVELOPMENT
97
97
 
@@ -118,21 +118,15 @@ requests) go to the mailing list.
118
118
 
119
119
  Do not send HTML mail or attachments. Do not top post.
120
120
 
121
- Homepage: http://clogger.rubyforge.org/
121
+ Homepage: http://clogger.bogomips.org/
122
122
 
123
123
  == INSTALL
124
124
 
125
- For Rubygems users:
125
+ For RubyGems users:
126
126
 
127
127
  gem install clogger
128
128
 
129
- If you do not use Rubygems, you may also use setup.rb from the tarballs
130
- on the Rubyforge project page:
131
-
132
- * http://rubyforge.org/frs/?group_id=8896
133
-
134
129
  There is an optional C extension that should be compatible with
135
130
  MatzRuby. The extensions should automatically be disabled for users of
136
131
  other Ruby implementations, but be sure to let us know if that's not the
137
- case. No pre-built binaries are currently distributed, let us know if
138
- you're interested in helping with the release/support effort.
132
+ case.
data/Rakefile CHANGED
@@ -36,41 +36,3 @@ task :publish_news do
36
36
  rf.login
37
37
  rf.post_news('clogger', subject, body)
38
38
  end
39
-
40
- desc "post to RAA"
41
- task :raa_update do
42
- require 'rubygems'
43
- require 'net/http'
44
- require 'net/netrc'
45
- rc = Net::Netrc.locate('clogger-raa') or abort "~/.netrc not found"
46
- password = rc.password
47
-
48
- s = Gem::Specification.load('clogger.gemspec')
49
- desc = [ s.description.strip ]
50
- desc << ""
51
- desc << "* #{s.email}"
52
- desc << "* #{git_url}"
53
- desc << "* #{cgit_url}"
54
- desc = desc.join("\n")
55
- uri = URI.parse('http://raa.ruby-lang.org/regist.rhtml')
56
- form = {
57
- :name => s.name,
58
- :short_description => s.summary,
59
- :version => s.version.to_s,
60
- :status => 'experimental',
61
- :owner => s.authors.first,
62
- :email => s.email,
63
- :category_major => 'Library',
64
- :category_minor => 'Rack',
65
- :url => s.homepage,
66
- :download => 'http://rubyforge.org/frs/?group_id=8896',
67
- :license => 'LGPL',
68
- :description_style => 'Plain',
69
- :description => desc,
70
- :pass => password,
71
- :submit => 'Update',
72
- }
73
- res = Net::HTTP.post_form(uri, form)
74
- p res
75
- puts res.body
76
- end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ require 'find'
3
+ require 'fileutils'
4
+ rfdir = 'rubyforge.org:/var/www/gforge-projects/clogger/'
5
+ newbase = 'http://clogger.bogomips.org/'
6
+ refresh = '<meta http-equiv="refresh" content="0; url=%s" />'
7
+ old = 'rf.old'
8
+ new = 'rf.new'
9
+ cmd = %W(rsync -av #{rfdir} #{old}/)
10
+ unless File.directory?(old)
11
+ system(*cmd) or abort "#{cmd.inspect} failed: #$?"
12
+ end
13
+
14
+ Find.find(old) do |path|
15
+ path =~ /\.html\z/ or next
16
+ data = File.read(path)
17
+ tmp = path.split(%r{/})
18
+ tmp.shift == old or abort "BUG"
19
+ dst = "#{new}/#{tmp.join('/')}"
20
+
21
+ tmp[-1] = '' if tmp[-1] == "index.html"
22
+ url = "#{newbase}#{tmp.join('/')}"
23
+ meta = sprintf(refresh, url)
24
+ data.sub!(/(<head[^>]*>)/i, "#$1#{meta}")
25
+ data.sub!(/(<body[^>]*>)/i,
26
+ "#{$1}Redirecting to <a href=\"#{url}\">#{url}</a> ...<br/>")
27
+ FileUtils.mkdir_p(File.dirname(dst))
28
+ File.open(dst, "w") { |fp| fp.write(data) }
29
+ end
30
+
31
+ print "Verify results in #{new}/, then run:\n "
32
+ puts %W(rsync -av #{new}/ #{rfdir}).join(' ')
@@ -9,22 +9,19 @@ Gem::Specification.new do |s|
9
9
  s.version = ENV["VERSION"].dup
10
10
  s.homepage = Wrongdoc.config[:rdoc_url]
11
11
  s.authors = ["cloggers"]
12
- s.date = Time.now.utc.strftime('%Y-%m-%d')
13
12
  s.description = readme_description
14
13
  s.email = %q{clogger@librelist.org}
15
14
  s.extra_rdoc_files = extra_rdoc_files(manifest)
16
15
  s.files = manifest
17
16
  s.rdoc_options = rdoc_options
18
- s.require_paths = %w(lib ext)
19
17
  s.rubyforge_project = %q{clogger}
20
18
  s.summary = summary
21
19
  s.test_files = %w(test/test_clogger.rb test/test_clogger_to_path.rb)
22
20
 
23
21
  # HeaderHash wasn't case-insensitive in old versions
24
- s.add_dependency(%q<rack>, ["> 0.9"])
25
- s.add_development_dependency(%q<wrongdoc>, "~> 1.0")
22
+ s.add_dependency(%q<rack>, ["~> 1.0"])
23
+ s.add_development_dependency(%q<wrongdoc>, "~> 1.8")
26
24
  s.extensions = %w(ext/clogger_ext/extconf.rb)
27
25
 
28
- # disabled for compatibility with older RubyGems
29
- # s.license = "LGPLv2.1 LGPLv3"
26
+ s.licenses = %w(LGPLv2.1+)
30
27
  end
@@ -1,43 +1,45 @@
1
- #ifdef HAVE_RB_THREAD_BLOCKING_REGION
2
- struct stat_args { const char *path; struct stat *buf; };
3
- static VALUE ng_stat(void *ptr)
1
+ #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
2
+ /* Ruby 2.0+ */
3
+ # include <ruby/thread.h>
4
+ # define WITHOUT_GVL(fn,a,ubf,b) \
5
+ rb_thread_call_without_gvl((fn),(a),(ubf),(b))
6
+ #elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
7
+ typedef VALUE (*my_blocking_fn_t)(void*);
8
+ # define WITHOUT_GVL(fn,a,ubf,b) \
9
+ rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),(ubf),(b))
10
+ #endif
11
+
12
+ #ifdef WITHOUT_GVL
13
+ struct stat_args { int err; const char *path; struct stat *buf; };
14
+ static void * ng_stat(void *ptr)
4
15
  {
5
16
  struct stat_args *a = ptr;
6
- return (VALUE)stat(a->path, a->buf);
17
+ a->err = stat(a->path, a->buf);
18
+ return NULL;
7
19
  }
20
+
8
21
  static int my_stat(const char *path, struct stat *buf)
9
22
  {
10
23
  struct stat_args a;
11
24
 
12
25
  a.path = path;
13
26
  a.buf = buf;
14
- return (int)rb_thread_blocking_region(ng_stat, &a, RUBY_UBF_IO, 0);
27
+ WITHOUT_GVL(ng_stat, &a, RUBY_UBF_IO, 0);
28
+ return a.err;
15
29
  }
30
+
16
31
  #ifndef HAVE_RB_THREAD_IO_BLOCKING_REGION
17
32
  # define rb_thread_io_blocking_region(fn,data,fd) \
18
- rb_thread_blocking_region((fn),(data), RUBY_UBF_IO, 0)
33
+ WITHOUT_GVL((fn),(data), RUBY_UBF_IO, 0)
34
+ #else
35
+ VALUE rb_thread_io_blocking_region(VALUE(*)(void *), void *, int);
19
36
  #endif
20
37
 
21
- struct fstat_args { int fd; struct stat *buf; };
22
- static VALUE ng_fstat(void *ptr)
23
- {
24
- struct fstat_args *a = ptr;
25
- return (VALUE)fstat(a->fd, a->buf);
26
- }
27
-
28
- static int my_fstat(int fd, struct stat *buf)
29
- {
30
- struct fstat_args a;
31
-
32
- a.fd = fd;
33
- a.buf = buf;
34
- return (int)rb_thread_io_blocking_region(ng_fstat, &a, fd);
35
- }
36
-
37
38
  struct write_args { int fd; const void *buf; size_t count; };
38
39
  static VALUE ng_write(void *ptr)
39
40
  {
40
41
  struct write_args *a = ptr;
42
+
41
43
  return (VALUE)write(a->fd, a->buf, a->count);
42
44
  }
43
45
  static ssize_t my_write(int fd, const void *buf, size_t count)
@@ -52,7 +54,6 @@ static ssize_t my_write(int fd, const void *buf, size_t count)
52
54
 
53
55
  return r;
54
56
  }
55
- # define stat(fd,buf) my_stat((fd),(buf))
56
- # define fstat(fd,buf) my_fstat((fd),(buf))
57
+ # define stat(path,buf) my_stat((path),(buf))
57
58
  # define write(fd,buf,count) my_write((fd),(buf),(count))
58
- #endif
59
+ #endif /* !WITHOUT_GVL */
@@ -122,7 +122,6 @@ struct clogger {
122
122
  static ID write_id;
123
123
  static ID ltlt_id;
124
124
  static ID call_id;
125
- static ID each_id;
126
125
  static ID close_id;
127
126
  static ID to_i_id;
128
127
  static ID to_s_id;
@@ -130,7 +129,6 @@ static ID size_id;
130
129
  static ID sq_brace_id;
131
130
  static ID new_id;
132
131
  static ID to_path_id;
133
- static ID to_io_id;
134
132
  static ID respond_to_id;
135
133
  static VALUE cClogger;
136
134
  static VALUE mFormat;
@@ -166,11 +164,12 @@ static inline int need_escape(unsigned c)
166
164
  }
167
165
 
168
166
  /* we are encoding-agnostic, clients can send us all sorts of junk */
169
- static VALUE byte_xs_str(VALUE from)
167
+ static VALUE byte_xs(VALUE obj)
170
168
  {
171
169
  static const char esc[] = "0123456789ABCDEF";
172
170
  unsigned char *new_ptr;
173
- unsigned char *ptr = (unsigned char *)RSTRING_PTR(from);
171
+ VALUE from = rb_obj_as_string(obj);
172
+ const unsigned char *ptr = (const unsigned char *)RSTRING_PTR(from);
174
173
  long len = RSTRING_LEN(from);
175
174
  long new_len = len;
176
175
  VALUE rv;
@@ -188,7 +187,7 @@ static VALUE byte_xs_str(VALUE from)
188
187
 
189
188
  rv = rb_str_new(NULL, new_len);
190
189
  new_ptr = (unsigned char *)RSTRING_PTR(rv);
191
- ptr = (unsigned char *)RSTRING_PTR(from);
190
+ ptr = (const unsigned char *)RSTRING_PTR(from);
192
191
  for (; --len >= 0; ptr++) {
193
192
  unsigned c = *ptr;
194
193
 
@@ -203,14 +202,10 @@ static VALUE byte_xs_str(VALUE from)
203
202
  }
204
203
  assert(RSTRING_PTR(rv)[RSTRING_LEN(rv)] == '\0');
205
204
 
205
+ RB_GC_GUARD(from);
206
206
  return rv;
207
207
  }
208
208
 
209
- static VALUE byte_xs(VALUE from)
210
- {
211
- return byte_xs_str(rb_obj_as_string(from));
212
- }
213
-
214
209
  static void clogger_mark(void *ptr)
215
210
  {
216
211
  struct clogger *c = ptr;
@@ -867,7 +862,7 @@ static VALUE ccall(struct clogger *c, VALUE env)
867
862
  rb_ary_store(rv, 1, c->headers);
868
863
  }
869
864
  } else {
870
- volatile VALUE tmp = rb_inspect(rv);
865
+ VALUE tmp = rb_inspect(rv);
871
866
 
872
867
  c->status = INT2FIX(500);
873
868
  c->headers = c->body = rb_ary_new();
@@ -875,6 +870,7 @@ static VALUE ccall(struct clogger *c, VALUE env)
875
870
  rb_raise(rb_eTypeError,
876
871
  "app response not a 3 element Array: %s",
877
872
  RSTRING_PTR(tmp));
873
+ RB_GC_GUARD(tmp);
878
874
  }
879
875
 
880
876
  return rv;
@@ -988,22 +984,17 @@ static VALUE to_path(VALUE self)
988
984
  struct stat sb;
989
985
  int rv;
990
986
  VALUE path = rb_funcall(c->body, to_path_id, 0);
987
+ const char *cpath = StringValueCStr(path);
988
+ unsigned devfd;
991
989
 
992
- /* try to avoid an extra path lookup */
993
- if (rb_respond_to(c->body, to_io_id)) {
994
- rv = fstat(my_fileno(c->body), &sb);
995
- } else {
996
- const char *cpath = StringValueCStr(path);
997
- unsigned devfd;
998
- /*
999
- * Rainbows! can use "/dev/fd/%u" in to_path output to avoid
1000
- * extra open() syscalls, too.
1001
- */
1002
- if (sscanf(cpath, "/dev/fd/%u", &devfd) == 1)
1003
- rv = fstat((int)devfd, &sb);
1004
- else
1005
- rv = stat(cpath, &sb);
1006
- }
990
+ /*
991
+ * Rainbows! can use "/dev/fd/%u" in to_path output to avoid
992
+ * extra open() syscalls, too.
993
+ */
994
+ if (sscanf(cpath, "/dev/fd/%u", &devfd) == 1)
995
+ rv = fstat((int)devfd, &sb);
996
+ else
997
+ rv = stat(cpath, &sb);
1007
998
 
1008
999
  /*
1009
1000
  * calling this method implies the web server will bypass
@@ -1014,24 +1005,6 @@ static VALUE to_path(VALUE self)
1014
1005
  return path;
1015
1006
  }
1016
1007
 
1017
- /*
1018
- * call-seq:
1019
- * clogger.to_io
1020
- *
1021
- * used to proxy +:to_io+ method calls to the wrapped response body.
1022
- */
1023
- static VALUE to_io(VALUE self)
1024
- {
1025
- struct clogger *c = clogger_get(self);
1026
- struct stat sb;
1027
- VALUE io = rb_convert_type(c->body, T_FILE, "IO", "to_io");
1028
-
1029
- if (fstat(my_fileno(io), &sb) == 0)
1030
- c->body_bytes_sent = sb.st_size;
1031
-
1032
- return io;
1033
- }
1034
-
1035
1008
  /* :nodoc: */
1036
1009
  static VALUE body(VALUE self)
1037
1010
  {
@@ -1047,7 +1020,6 @@ void Init_clogger_ext(void)
1047
1020
  write_id = rb_intern("write");
1048
1021
  ltlt_id = rb_intern("<<");
1049
1022
  call_id = rb_intern("call");
1050
- each_id = rb_intern("each");
1051
1023
  close_id = rb_intern("close");
1052
1024
  to_i_id = rb_intern("to_i");
1053
1025
  to_s_id = rb_intern("to_s");
@@ -1055,7 +1027,6 @@ void Init_clogger_ext(void)
1055
1027
  sq_brace_id = rb_intern("[]");
1056
1028
  new_id = rb_intern("new");
1057
1029
  to_path_id = rb_intern("to_path");
1058
- to_io_id = rb_intern("to_io");
1059
1030
  respond_to_id = rb_intern("respond_to?");
1060
1031
  cClogger = rb_define_class("Clogger", rb_cObject);
1061
1032
  mFormat = rb_define_module_under(cClogger, "Format");
@@ -1069,7 +1040,6 @@ void Init_clogger_ext(void)
1069
1040
  rb_define_method(cClogger, "wrap_body?", clogger_wrap_body, 0);
1070
1041
  rb_define_method(cClogger, "reentrant?", clogger_reentrant, 0);
1071
1042
  rb_define_method(cClogger, "to_path", to_path, 0);
1072
- rb_define_method(cClogger, "to_io", to_io, 0);
1073
1043
  rb_define_method(cClogger, "respond_to?", respond_to, 1);
1074
1044
  rb_define_method(cClogger, "body", body, 0);
1075
1045
  CONST_GLOBAL_STR(REMOTE_ADDR);
@@ -19,6 +19,7 @@ begin
19
19
  have_func('gmtime_r', 'time.h') or raise "gmtime_r needed"
20
20
  have_struct_member('struct tm', 'tm_gmtoff', 'time.h')
21
21
  have_func('rb_str_set_len', 'ruby.h')
22
+ have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
22
23
  have_func('rb_thread_blocking_region', 'ruby.h')
23
24
  have_func('rb_thread_io_blocking_region', 'ruby.h')
24
25
  create_makefile('clogger_ext')
@@ -5,9 +5,6 @@
5
5
  #ifndef RSTRING_LEN
6
6
  # define RSTRING_LEN(s) (RSTRING(s)->len)
7
7
  #endif
8
- #ifndef RARRAY_PTR
9
- # define RARRAY_PTR(s) (RARRAY(s)->ptr)
10
- #endif
11
8
  #ifndef RARRAY_LEN
12
9
  # define RARRAY_LEN(s) (RARRAY(s)->len)
13
10
  #endif
@@ -21,34 +18,3 @@ static void rb_18_str_set_len(VALUE str, long len)
21
18
  }
22
19
  #define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
23
20
  #endif
24
-
25
- #if ! HAVE_RB_IO_T
26
- # define rb_io_t OpenFile
27
- #endif
28
-
29
- #ifdef GetReadFile
30
- # define FPTR_TO_FD(fptr) (fileno(GetReadFile(fptr)))
31
- #else
32
- # if !HAVE_RB_IO_T || (RUBY_VERSION_MAJOR == 1 && RUBY_VERSION_MINOR == 8)
33
- # define FPTR_TO_FD(fptr) fileno(fptr->f)
34
- # else
35
- # define FPTR_TO_FD(fptr) fptr->fd
36
- # endif
37
- #endif
38
-
39
- static int my_fileno(VALUE io)
40
- {
41
- rb_io_t *fptr;
42
-
43
- for (;;) {
44
- switch (TYPE(io)) {
45
- case T_FILE: {
46
- GetOpenFile(io, fptr);
47
- return FPTR_TO_FD(fptr);
48
- }
49
- default:
50
- io = rb_convert_type(io, T_FILE, "IO", "to_io");
51
- /* retry */
52
- }
53
- }
54
- }
@@ -82,17 +82,10 @@ class Clogger
82
82
 
83
83
  def to_path
84
84
  rv = @body.to_path
85
- # try to avoid unnecessary path lookups with to_io.stat instead of
86
- # File.size
87
- @body_bytes_sent =
88
- @body.respond_to?(:to_io) ? @body.to_io.stat.size : File.size(rv)
85
+ @body_bytes_sent = File.size(rv)
89
86
  rv
90
87
  end
91
88
 
92
- def to_io
93
- @body.to_io
94
- end
95
-
96
89
  private
97
90
 
98
91
  def byte_xs(s)
@@ -222,12 +222,11 @@ class TestClogger < Test::Unit::TestCase
222
222
  req = @req.merge("HTTP_X_FORWARDED_FOR" => '192.168.1.1')
223
223
  status, headers, body = cl.call(req)
224
224
  assert_equal "192.168.1.1\n", str.string
225
- str.rewind
226
- str.truncate(0)
225
+
226
+ str = StringIO.new
227
+ cl = Clogger.new(app, :logger => str, :format => "$ip")
227
228
  status, headers, body = cl.call(@req)
228
229
  assert_equal "home\n", str.string
229
- str.rewind
230
- str.truncate(0)
231
230
  end
232
231
 
233
232
  def test_rack_1_0
@@ -93,43 +93,6 @@ class TestCloggerToPath < Test::Unit::TestCase
93
93
  assert_equal "365 200\n", logger.string
94
94
  end
95
95
 
96
- def test_wraps_to_path_to_io
97
- logger = StringIO.new
98
- tmp = Tempfile.new('')
99
- def tmp.to_io
100
- @to_io_called = super
101
- end
102
- def tmp.to_path
103
- path
104
- end
105
- app = Rack::Builder.new do
106
- tmp.syswrite(' ' * 365)
107
- tmp.sysseek(0)
108
- h = {
109
- 'Content-Length' => '0',
110
- 'Content-Type' => 'text/plain',
111
- }
112
- use Clogger,
113
- :logger => logger,
114
- :reentrant => true,
115
- :format => '$body_bytes_sent $status'
116
- run lambda { |env| [ 200, h, tmp ] }
117
- end.to_app
118
-
119
- status, headers, body = app.call(@req)
120
- assert_instance_of(Clogger, body)
121
- check_body(body)
122
-
123
- assert_equal tmp.path, body.to_path
124
- assert_nothing_raised { body.to_io }
125
- assert_kind_of IO, tmp.instance_variable_get(:@to_io_called)
126
- assert logger.string.empty?
127
- assert ! tmp.closed?
128
- body.close
129
- assert tmp.closed?
130
- assert_equal "365 200\n", logger.string
131
- end
132
-
133
96
  def test_does_not_wrap_to_path
134
97
  logger = StringIO.new
135
98
  app = Rack::Builder.new do
metadata CHANGED
@@ -1,51 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - cloggers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-26 00:00:00.000000000 Z
11
+ date: 2014-05-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0.9'
19
+ version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>'
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.9'
26
+ version: '1.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: wrongdoc
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '1.0'
33
+ version: '1.8'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '1.0'
46
- description: ! '\Clogger is Rack middleware for logging HTTP requests. The log format
47
-
48
- is customizable so you can specify exactly which fields to log.'
40
+ version: '1.8'
41
+ description: |-
42
+ clogger is Rack middleware for logging HTTP requests. The log format
43
+ is customizable so you can specify exactly which fields to log.
49
44
  email: clogger@librelist.org
50
45
  executables: []
51
46
  extensions:
@@ -61,10 +56,10 @@ extra_rdoc_files:
61
56
  - LICENSE
62
57
  - LATEST
63
58
  files:
64
- - .document
65
- - .gitignore
66
- - .manifest
67
- - .wrongdoc.yml
59
+ - ".document"
60
+ - ".gitignore"
61
+ - ".manifest"
62
+ - ".wrongdoc.yml"
68
63
  - COPYING
69
64
  - ChangeLog
70
65
  - GIT-VERSION-FILE
@@ -75,6 +70,7 @@ files:
75
70
  - NEWS
76
71
  - README
77
72
  - Rakefile
73
+ - archive/rfmig.rb
78
74
  - clogger.gemspec
79
75
  - ext/clogger_ext/blocking_helpers.h
80
76
  - ext/clogger_ext/broken_system_compat.h
@@ -88,34 +84,33 @@ files:
88
84
  - setup.rb
89
85
  - test/test_clogger.rb
90
86
  - test/test_clogger_to_path.rb
91
- homepage: http://clogger.rubyforge.org/
92
- licenses: []
87
+ homepage: http://clogger.bogomips.org/
88
+ licenses:
89
+ - LGPLv2.1+
90
+ metadata: {}
93
91
  post_install_message:
94
92
  rdoc_options:
95
- - -t
96
- - \Clogger - configurable request logging for Rack
97
- - -W
93
+ - "-t"
94
+ - clogger - configurable request logging for Rack
95
+ - "-W"
98
96
  - http://bogomips.org/clogger.git/tree/%s
99
97
  require_paths:
100
98
  - lib
101
- - ext
102
99
  required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
100
  requirements:
105
- - - ! '>='
101
+ - - ">="
106
102
  - !ruby/object:Gem::Version
107
103
  version: '0'
108
104
  required_rubygems_version: !ruby/object:Gem::Requirement
109
- none: false
110
105
  requirements:
111
- - - ! '>='
106
+ - - ">="
112
107
  - !ruby/object:Gem::Version
113
108
  version: '0'
114
109
  requirements: []
115
110
  rubyforge_project: clogger
116
- rubygems_version: 1.8.23
111
+ rubygems_version: 2.2.2
117
112
  signing_key:
118
- specification_version: 3
113
+ specification_version: 4
119
114
  summary: configurable request logging for Rack
120
115
  test_files:
121
116
  - test/test_clogger.rb