Exceptional_Log 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
31
31
  # s.add_runtime_dependency 'rest-client'
32
32
  s.add_runtime_dependency 'Split_Lines'
33
33
  s.add_runtime_dependency 'Classy_Name'
34
+ s.add_runtime_dependency 'Backtrace_Array'
34
35
  end
@@ -8,8 +8,11 @@ class Exceptional_Log < RuntimeError
8
8
  def convert file
9
9
  f = file
10
10
  full_path = File.expand_path(f)
11
+ lines = Split_Lines(File.read(full_path))
11
12
  msg = full_path
12
13
 
14
+ return nil if lines.empty?
15
+
13
16
  e_name = Classy_Name(File.basename(f).sub( /\.log\z/i, '' ))
14
17
 
15
18
  k = begin
@@ -22,7 +25,7 @@ class Exceptional_Log < RuntimeError
22
25
  end
23
26
 
24
27
  e = k.new(msg)
25
- e.set_backtrace Split_Lines(File.read full_path )
28
+ e.set_backtrace lines
26
29
  e.created_at = File.stat(full_path).atime
27
30
 
28
31
  e
@@ -1 +1 @@
1
- Exceptional_Log_Version = "0.1.0"
1
+ Exceptional_Log_Version = "0.1.1"
@@ -8,6 +8,13 @@ describe "Exceptional_Log.convert file_path" do
8
8
  }
9
9
  }
10
10
 
11
+ it "returns nil if file is empty" do
12
+ file = "/tmp/my_thin.log"
13
+ `echo " " > #{file}`
14
+ Exceptional_Log.convert(file)
15
+ .should == nil
16
+ end
17
+
11
18
  it "returns an Enumerable" do
12
19
  @e.should.respond_to :each_index
13
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Exceptional_Log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: Backtrace_Array
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  description: ! "\n\n Turn your log files into exceptions.\n The contents are
111
127
  used as a backtrace.\n\n "
112
128
  email: