samuel 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/Rakefile +11 -11
- data/lib/samuel.rb +2 -2
- data/samuel.gemspec +2 -2
- data/test/loader_test.rb +7 -7
- data/test/net_http_test.rb +4 -8
- data/test/samuel_test.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -58,8 +58,8 @@ Right now, there are three configuration changes you can make in either style:
|
|
58
58
|
* <tt>:labels</tt> -- This is a hash with domain substrings as keys and log
|
59
59
|
labels as values. If a request domain includes one of the domain substrings,
|
60
60
|
the corresponding label will be used for the first part of that log entry.
|
61
|
-
By default this is
|
62
|
-
|
61
|
+
By default this is empty, so that all requests are labeled with a default of
|
62
|
+
<tt>"HTTP Request"</tt>.
|
63
63
|
|
64
64
|
* <tt>:label</tt> -- As an alternative to the <tt>:labels</tt> hash, this is
|
65
65
|
simply a string. If set, it takes precedence over any <tt>:labels</tt> (by
|
data/Rakefile
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new(:test) do |test|
|
6
|
+
test.libs << 'lib' << 'test'
|
7
|
+
test.pattern = 'test/**/*_test.rb'
|
8
|
+
test.verbose = false
|
9
|
+
test.warning = true
|
10
|
+
end
|
11
|
+
|
4
12
|
begin
|
5
13
|
require 'jeweler'
|
6
14
|
Jeweler::Tasks.new do |gem|
|
7
15
|
gem.name = "samuel"
|
8
|
-
gem.version = "0.3.
|
16
|
+
gem.version = "0.3.2"
|
9
17
|
gem.summary = %Q{An automatic logger for HTTP requests in Ruby}
|
10
18
|
gem.description = %Q{An automatic logger for HTTP requests in Ruby, supporting the Net::HTTP and HTTPClient client libraries.}
|
11
19
|
gem.email = "chris@kampers.net"
|
@@ -17,18 +25,12 @@ begin
|
|
17
25
|
gem.add_development_dependency "httpclient"
|
18
26
|
gem.add_development_dependency "fakeweb"
|
19
27
|
end
|
28
|
+
|
29
|
+
task :test => :check_dependencies
|
20
30
|
rescue LoadError
|
21
31
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
32
|
end
|
23
33
|
|
24
|
-
require 'rake/testtask'
|
25
|
-
Rake::TestTask.new(:test) do |test|
|
26
|
-
test.libs << 'lib' << 'test'
|
27
|
-
test.pattern = 'test/**/*_test.rb'
|
28
|
-
test.verbose = false
|
29
|
-
test.warning = true
|
30
|
-
end
|
31
|
-
|
32
34
|
begin
|
33
35
|
require 'rcov/rcovtask'
|
34
36
|
Rcov::RcovTask.new do |test|
|
@@ -45,8 +47,6 @@ rescue LoadError
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
task :test => :check_dependencies
|
49
|
-
|
50
50
|
task :default => :test
|
51
51
|
|
52
52
|
begin
|
data/lib/samuel.rb
CHANGED
@@ -13,7 +13,7 @@ require "samuel/log_entries/net_http"
|
|
13
13
|
module Samuel
|
14
14
|
extend self
|
15
15
|
|
16
|
-
VERSION = "0.3.
|
16
|
+
VERSION = "0.3.2"
|
17
17
|
|
18
18
|
attr_writer :logger, :config
|
19
19
|
|
@@ -43,7 +43,7 @@ module Samuel
|
|
43
43
|
|
44
44
|
def reset_config
|
45
45
|
Thread.current[:__samuel_config] = nil
|
46
|
-
@config = {:label => nil, :labels => {
|
46
|
+
@config = {:label => nil, :labels => {}, :filtered_params => []}
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
data/samuel.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{samuel}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chris Kampmeier"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-12}
|
13
13
|
s.description = %q{An automatic logger for HTTP requests in Ruby, supporting the Net::HTTP and HTTPClient client libraries.}
|
14
14
|
s.email = %q{chris@kampers.net}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/loader_test.rb
CHANGED
@@ -26,8 +26,8 @@ class LoaderTest < Test::Unit::TestCase
|
|
26
26
|
end
|
27
27
|
|
28
28
|
should "not load HTTPClient" do
|
29
|
-
output = capture_output "puts defined?(HTTPClient)"
|
30
|
-
assert_equal "
|
29
|
+
output = capture_output "puts 'good' unless defined?(HTTPClient)"
|
30
|
+
assert_equal "good", output.strip
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -40,8 +40,8 @@ class LoaderTest < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
should "not load HTTPClient" do
|
43
|
-
output = capture_output "puts defined?(HTTPClient)"
|
44
|
-
assert_match "
|
43
|
+
output = capture_output "puts 'good' unless defined?(HTTPClient)"
|
44
|
+
assert_match "good", output.strip
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -54,10 +54,10 @@ class LoaderTest < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
should "not load Net::HTTP" do
|
57
|
-
output = capture_output "puts defined?(Net::HTTP)"
|
58
|
-
assert_match "
|
57
|
+
output = capture_output "puts 'good' unless defined?(Net::HTTP)"
|
58
|
+
assert_match "good", output.strip
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
end
|
63
|
+
end
|
data/test/net_http_test.rb
CHANGED
@@ -123,8 +123,7 @@ class RequestTest < Test::Unit::TestCase
|
|
123
123
|
end
|
124
124
|
|
125
125
|
should_log_including "Example request"
|
126
|
-
should_have_config_afterwards_including :labels => {
|
127
|
-
:label => nil
|
126
|
+
should_have_config_afterwards_including :labels => {}, :label => nil
|
128
127
|
end
|
129
128
|
|
130
129
|
context "inside a configuration block with :filter_params" do
|
@@ -158,8 +157,7 @@ class RequestTest < Test::Unit::TestCase
|
|
158
157
|
end
|
159
158
|
|
160
159
|
should_log_including "Example request"
|
161
|
-
should_have_config_afterwards_including :labels => {
|
162
|
-
:label => "Example"
|
160
|
+
should_have_config_afterwards_including :labels => {}, :label => "Example"
|
163
161
|
end
|
164
162
|
|
165
163
|
context "with a global config including :label => 'Example' but inside config block that changes it to 'Example 2'" do
|
@@ -170,8 +168,7 @@ class RequestTest < Test::Unit::TestCase
|
|
170
168
|
end
|
171
169
|
|
172
170
|
should_log_including "Example 2 request"
|
173
|
-
should_have_config_afterwards_including :labels => {
|
174
|
-
:label => "Example"
|
171
|
+
should_have_config_afterwards_including :labels => {}, :label => "Example"
|
175
172
|
end
|
176
173
|
|
177
174
|
context "inside a config block of :label => 'Example 2' nested inside a config block of :label => 'Example'" do
|
@@ -185,8 +182,7 @@ class RequestTest < Test::Unit::TestCase
|
|
185
182
|
end
|
186
183
|
|
187
184
|
should_log_including "Example 2 request"
|
188
|
-
should_have_config_afterwards_including :labels => {
|
189
|
-
:label => nil
|
185
|
+
should_have_config_afterwards_including :labels => {}, :label => nil
|
190
186
|
end
|
191
187
|
|
192
188
|
context "wth a global config including :labels => {'example.com' => 'Example'} but inside a config block of :label => 'Example 3' nested inside a config block of :label => 'Example 2'" do
|
data/test/samuel_test.rb
CHANGED
@@ -35,7 +35,7 @@ class SamuelTest < Test::Unit::TestCase
|
|
35
35
|
should "reset the config to default vaules" do
|
36
36
|
Samuel.config = {:foo => "bar"}
|
37
37
|
Samuel.reset_config
|
38
|
-
assert_equal({:label => nil, :labels => {
|
38
|
+
assert_equal({:label => nil, :labels => {}, :filtered_params => []}, Samuel.config)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Kampmeier
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-12 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|