airbrake_tools 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69d49a7777e05925150fd745022e5d562e650901
4
- data.tar.gz: d95b1466bb55dc1de1d09a077a8420742c8deafe
3
+ metadata.gz: 7ca733d0ea934ee169bc869dcbb5e607d0da8255
4
+ data.tar.gz: 9c1fc1c27f60aaf801504dbce6b7e63d46fbd00f
5
5
  SHA512:
6
- metadata.gz: a316f83755c72364afcd3820e3b50c3a6c4bef806ecc7a63201bd8d84fed79855d384e9b308063edfffe7429f4a905979c94680c2f5464703f794a7872c2b9d4
7
- data.tar.gz: fc7f985427c2e6585dd5f88c4bc8ff4e510a296c5fae06e79c77b1c2b68acfcd5d1e1fcf81b53867dc0209676fdc9a41b18d717301f2a3319cf6a6be88e98349
6
+ metadata.gz: b1b5f1a7c3b41801c342ff9fb790211212f80f4cb9a9c8d747dfc568b12f6b4873085af9c4ac0d074c4de23d6141f8733301abab8e61d59506fd5a87667d4d56
7
+ data.tar.gz: c972e286e6c3194db26b7d0b9cbbfaa1de542fea2588e6fe42d70965c0d304428135935eaac7b161a6ae9b8fc0f0d12b3b0980e7e92bd8e373bbf93f08cd42c8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- airbrake_tools (1.1.0)
4
+ airbrake_tools (1.1.1)
5
5
  airbrake-api (>= 4.5.1)
6
6
 
7
7
  GEM
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "bump/tasks"
3
3
 
4
- task :default do
4
+ file "spec/fixtures.yml" => "spec/fixtures.example.yml" do
5
+ cp "spec/fixtures.example.yml", "spec/fixtures.yml"
6
+ end
7
+
8
+ task :default => "spec/fixtures.yml" do
5
9
  sh "rspec spec/"
6
10
  end
data/Readme.md CHANGED
@@ -85,6 +85,11 @@ Mysql2::Error: Lost connection to MySQL server during reconnect
85
85
  -v, --version Show Version
86
86
  ```
87
87
 
88
+ Development
89
+ ======
90
+ In order for the specs to run, you need to copy `spec/fixtures.example.yml` to
91
+ `spec/features.yml` and edit to add your credentials.
92
+
88
93
  Author
89
94
  ======
90
95
  [Jonathan Cheatham](http://github.com/jcheatham)<br/>
@@ -6,11 +6,13 @@ require "launchy"
6
6
  module AirbrakeTools
7
7
  DEFAULT_HOT_PAGES = 1
8
8
  DEFAULT_NEW_PAGES = 1
9
- DEFAULT_SUMMARY_PAGES = 5
9
+ DEFAULT_SUMMARY_PAGES = 10
10
10
  DEFAULT_COMPARE_DEPTH_ADDITION = 3 # first line in project is 6 -> compare at 6 + x depth
11
11
  DEFAULT_ENVIRONMENT = "production"
12
12
  COLORS = {
13
13
  :gray => "\e[0;37m",
14
+ :green => "\e[0;32m",
15
+ :bold_white => "\e[1;37m",
14
16
  :clear => "\e[0m"
15
17
  }
16
18
 
@@ -62,7 +64,7 @@ module AirbrakeTools
62
64
 
63
65
  def list(options)
64
66
  page = 1
65
- while errors = AirbrakeAPI.errors(:page => page)
67
+ while errors = AirbrakeAPI.errors(:page => page) and page <= DEFAULT_SUMMARY_PAGES
66
68
  select_env(errors, options).each do |error|
67
69
  puts "#{error.id} -- #{error.error_class} -- #{error.error_message} -- #{error.created_at}"
68
70
  end
@@ -105,11 +107,8 @@ module AirbrakeTools
105
107
  color = :gray if $stdout.tty? && !custom_file?(line)
106
108
  line = line.sub("[PROJECT_ROOT]/", "")
107
109
  line = add_blame(line)
108
- if color
109
- "#{COLORS.fetch(color)}#{line}#{COLORS.fetch(:clear)}"
110
- else
111
- line
112
- end
110
+
111
+ color ? color_text(line, color) : line
113
112
  end
114
113
 
115
114
  def add_blame(backtrace_line)
@@ -166,6 +165,8 @@ module AirbrakeTools
166
165
  [error, notices, frequency(notices, pages * AirbrakeAPI::Client::PER_PAGE)]
167
166
  rescue Faraday::Error::ParsingError
168
167
  $stderr.puts "Ignoring #{hot_summary(error)}, got 500 from http://#{AirbrakeAPI.account}.airbrake.io/errors/#{error.id}"
168
+ rescue Exception => e
169
+ puts "Ignoring exception <<#{e}>>, most likely bad data from airbrake"
169
170
  end
170
171
  end.compact
171
172
  end
@@ -184,7 +185,9 @@ module AirbrakeTools
184
185
 
185
186
  def print_errors(hot)
186
187
  hot.each_with_index do |(error, notices, rate, deviance), index|
187
- puts "\n##{(index+1).to_s.ljust(2)} #{rate.round(2).to_s.rjust(6)}/hour total:#{error.notices_count.to_s.ljust(8)} #{sparkline(notices, :slots => 60, :interval => 60).ljust(61)} -- #{hot_summary(error)}"
188
+ spark = sparkline(notices, :slots => 60, :interval => 60)
189
+ puts "\n##{(index+1).to_s.ljust(2)} #{rate.round(2).to_s.rjust(6)}/hour total:#{error.notices_count.to_s.ljust(8)} #{color_text(spark.ljust(61), :green)}"
190
+ puts hot_summary(error)
188
191
  end
189
192
  end
190
193
 
@@ -201,7 +204,11 @@ module AirbrakeTools
201
204
  end
202
205
 
203
206
  def hot_summary(error)
204
- "id:#{error.id} -- first:#{error.created_at} -- #{error.error_class} -- #{error.error_message}"
207
+ "id: #{color_text(error.id, :bold_white)} -- first: #{color_text(error.created_at, :bold_white)} -- #{error.error_message}"
208
+ end
209
+
210
+ def color_text(text, color)
211
+ "#{COLORS[color]}#{text}#{COLORS[:clear]}"
205
212
  end
206
213
 
207
214
  def extract_options(argv)
@@ -1,3 +1,3 @@
1
1
  module AirbrakeTools
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -60,7 +60,7 @@ describe "airbrake-tools" do
60
60
 
61
61
  describe "summary" do
62
62
  it "kinda works" do
63
- output = airbrake_tools("#{config["subdomain"]} #{config["auth_token"]} summary 51344729")
63
+ output = airbrake_tools("#{config["subdomain"]} #{config["auth_token"]} summary #{config["summary_error_id"]} -p 1")
64
64
  output.should include("last retrieved notice: ")
65
65
  output.should include("last 2 hours: ")
66
66
  end
@@ -1,2 +1,3 @@
1
1
  subdomain: xxx
2
2
  auth_token: yyy # NOT THE API KEY <-> got to airbrake, click on settings, copy auth_token
3
+ summary_error_id: zzz # some valid error ID from airbrake to test summary functionality
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Cheatham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-19 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-api