bixby-common 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bixby-common.gemspec +2 -2
- data/lib/bixby-common/util/log.rb +11 -1
- data/test/util/log_test.rb +25 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986c24c212251c5f8f48d025925f3cbf16066c83
|
4
|
+
data.tar.gz: d61e2f50e64278e4cab3d38f2a113bcab4d9d08c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d09ab68cbad6dfd2e9dce62c39c0739dabf0f19bcb44c75b69bb024e77fac257a321dd319ca965fad60aa3fedbd08a5939513e8b0eb0300129cdf1e9ea5d766a
|
7
|
+
data.tar.gz: 3f26eabf6378d1cc9f1a21609b65b19b19a404d5b33310ae485032cb7c46dc710ea8e1257db53141a7f5adcde164e631c9b0d6865ef1b769b8f959df5ec2e7a2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/bixby-common.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bixby-common 0.7.
|
5
|
+
# stub: bixby-common 0.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bixby-common"
|
9
|
-
s.version = "0.7.
|
9
|
+
s.version = "0.7.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -15,9 +15,14 @@ module Bixby
|
|
15
15
|
def gems_regex
|
16
16
|
return @gems_regex if @gems_regex
|
17
17
|
gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) }
|
18
|
+
gems_paths << "#{Gem.path.first}/bundler" # include path for gems installed via git repo
|
18
19
|
@gems_regex = %r{(#{gems_paths.join('|')})/gems/([^/]+)-([\w.]+)/(.*)}
|
19
20
|
end
|
20
21
|
|
22
|
+
def bin_regex
|
23
|
+
@bin_regex ||= %r{#{Gem.path.first}/(bin/.*)$}
|
24
|
+
end
|
25
|
+
|
21
26
|
def ruby_regex
|
22
27
|
@ruby_regex ||= %r{^#{ENV["MY_RUBY_HOME"]}/lib(/.*?)?/ruby/[\d.]+/(.*)$}
|
23
28
|
end
|
@@ -34,7 +39,7 @@ module Bixby
|
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
37
|
-
if logger.parent then
|
42
|
+
if logger.respond_to?(:parent) && logger.parent then
|
38
43
|
return console_appender?(logger.parent)
|
39
44
|
end
|
40
45
|
|
@@ -76,6 +81,11 @@ module Bixby
|
|
76
81
|
end
|
77
82
|
last_gem = gem_name
|
78
83
|
|
84
|
+
elsif e =~ Log.bin_regex then
|
85
|
+
next if exclude_gems
|
86
|
+
rel_path = $1
|
87
|
+
s << " #{rel_path}"
|
88
|
+
|
79
89
|
elsif e =~ Log.ruby_regex then
|
80
90
|
next if exclude_gems
|
81
91
|
last_gem = nil
|
data/test/util/log_test.rb
CHANGED
@@ -46,6 +46,31 @@ class TestLog < TestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_console?
|
50
|
+
Logging::Logger.root.clear_appenders
|
51
|
+
refute Bixby::Log.console?(Logging::Logger.root)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_cleanup_ex
|
55
|
+
ex = nil
|
56
|
+
begin
|
57
|
+
raise "foobar had a problem"
|
58
|
+
rescue Exception => ex
|
59
|
+
end
|
60
|
+
|
61
|
+
assert ex
|
62
|
+
|
63
|
+
Logging::Logger.root.clear_appenders
|
64
|
+
assert_kind_of Exception, Bixby::Log.clean_ex_for_console(ex, Logging::Logger.root)
|
65
|
+
|
66
|
+
str = Bixby::Log.clean_ex(ex)
|
67
|
+
assert str
|
68
|
+
assert_kind_of String, str
|
69
|
+
|
70
|
+
assert str.split(/\n/).first =~ /foobar had a problem/
|
71
|
+
refute str.include? "/gems/"
|
72
|
+
end
|
73
|
+
|
49
74
|
end # TestLog
|
50
75
|
|
51
76
|
end # Test
|