Dex 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Dex.gemspec +1 -1
  2. data/bin/Dex +24 -19
  3. data/lib/Dex/version.rb +1 -1
  4. metadata +17 -1
@@ -33,5 +33,5 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency 'chronic_duration'
34
34
  s.add_runtime_dependency 'trollop'
35
35
  s.add_runtime_dependency 'term-ansicolor'
36
-
36
+ s.add_runtime_dependency 'Backtrace_Array'
37
37
  end
data/bin/Dex CHANGED
@@ -7,6 +7,8 @@ require 'terminal-table'
7
7
  require 'chronic_duration'
8
8
  require 'trollop'
9
9
  require 'term/ansicolor'
10
+ require 'Backtrace_Array'
11
+
10
12
  include Term::ANSIColor
11
13
 
12
14
  module Kernal
@@ -68,14 +70,18 @@ when 'filter'
68
70
 
69
71
  results = []
70
72
  ds_results = ds.to_a
73
+
74
+
71
75
  ds_results.each_index { |i|
72
- h = ds_results[i]
76
+ h = ds_results[i]
73
77
  offset = ds_results.size - i - 1
78
+ dur = ChronicDuration.output(Time.now.to_i - h[:created_at].to_i, :format=>:short) || "<1s"
79
+
74
80
  results << [
75
81
  offset,
76
82
  h[:exception],
77
83
  h[:message],
78
- ChronicDuration.output(Time.now.to_i - h[:created_at].to_i, :format=>:short) + " ago",
84
+ "#{dur} ago",
79
85
  h[:id]
80
86
  ]
81
87
  }
@@ -107,32 +113,31 @@ when 'show'
107
113
  raise_args "Record not found with offset: #{OPTS[:offset]}" unless r
108
114
 
109
115
  b = r.delete :backtrace
110
-
116
+ b = b ? Backtrace_Array(b) : []
117
+
111
118
  puts Terminal::Table.new(:rows=>r.to_a)
112
119
 
113
120
  if OPTS[:backtrace]
121
+
114
122
  puts "Backtrace:"
115
123
  current_line = nil
116
- rows = []
117
- b.each_line { |l|
118
- pieces = l.split(%r!:(\d+):!)
119
- line = pieces.shift
120
- num = pieces.shift
121
- code = pieces.join("")
124
+
125
+ b.each { |l|
122
126
 
123
- if current_line != line
124
- rows << [line]
125
- current_line = line
126
- puts ''
127
- puts bold(line.sub(Dir.pwd, '.').sub(File.expand_path('~'), '~'))
128
- end
127
+ line = l.first
128
+ content = l[1]
129
+
130
+ puts ''
131
+ puts bold(line.sub(Dir.pwd, '.').sub(File.expand_path('~'), '~'))
132
+
133
+ content.each { |pair|
134
+ num = pair.first
135
+ code = pair.last
136
+ puts "#{yellow "#{num}:"} #{code}"
137
+ }
129
138
 
130
- rows << [num, code]
131
-
132
- puts "#{yellow "#{num}:"} #{code}"
133
139
  }
134
140
 
135
- puts
136
141
  end
137
142
 
138
143
  when 'info'
@@ -1,3 +1,3 @@
1
1
  class Dex
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Dex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -187,6 +187,22 @@ dependencies:
187
187
  - - ! '>='
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: Backtrace_Array
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :runtime
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
190
206
  description: ! "\n A simple function to log errors to sqlite3.\n "
191
207
  email:
192
208
  - i-hate-spam-45671204@mailinator.com