trackman 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/trackman.rb CHANGED
@@ -10,7 +10,8 @@ module Trackman
10
10
  autoload :Errors, 'trackman/errors'
11
11
  autoload :Path, 'trackman/path'
12
12
  autoload :Utility, 'trackman/utility'
13
- end
14
13
 
14
+ end
15
+ require File.expand_path("../trackman/version", __FILE__)
15
16
  require File.expand_path("../trackman/utility/debugger", __FILE__)
16
17
  require File.expand_path("../trackman/utility/railtie", __FILE__)
@@ -84,6 +84,8 @@ module Trackman
84
84
  rescue Exception => ex
85
85
  begin
86
86
  Trackman::Utility::Debugger.log_exception ex
87
+ rescue Exception => ex2
88
+ puts ex2
87
89
  ensure
88
90
  return false
89
91
  end
@@ -15,11 +15,25 @@ module Trackman
15
15
  end
16
16
 
17
17
  def self.log_exception ex
18
- RestClient.post "#{@@server_url}/exceptions", :exception => { :message => ex.message, :backtrace => ex.backtrace }, :ssl_version => 'SSLv3'
18
+ to_send = {
19
+ :ruby_version => "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}",
20
+ :gem_version => Trackman::VERSION,
21
+ :rails_version => defined?(Rails) ? ::Rails::VERSION::STRING : 'rails not defined',
22
+ :bundle => `bundle list`.split("\n"),
23
+ :exception => { :class => ex.class.name, :message => ex.message, :backtrace => ex.backtrace },
24
+ :local => Trackman::Assets::Asset.all.map{|a| a.to_s },
25
+ :remote => Trackman::Assets::RemoteAsset.all.map{|a| a.to_s }
26
+ }
27
+ send_data to_send
28
+ end
29
+
30
+ def self.send_data data
31
+ RestClient.post "#{@@server_url}/exceptions", data, :ssl_version => 'SSLv3'
19
32
  end
20
33
  end
21
34
  end
22
35
  end
36
+
23
37
  if Trackman::Utility::Debugger.debug_mode?
24
38
  RestClient.log = Logger.new(STDOUT)
25
39
 
@@ -1,3 +1,3 @@
1
1
  module Trackman
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ module Trackman
5
+ module Utility
6
+ class Debugger
7
+ def self.send_data data
8
+ data
9
+ end
10
+ end
11
+ end
12
+ end
13
+ describe Trackman::Utility::Debugger do
14
+ before :all do
15
+ module Trackman
16
+ module Assets
17
+ class RemoteAsset
18
+ class << self
19
+ alias old_all all
20
+ def all
21
+ []
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ after :all do
30
+ module Trackman
31
+ module Assets
32
+ class RemoteAsset
33
+ class << self
34
+ alias all old_all
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ describe "log_exception" do
42
+ it "returns everything I need" do
43
+ ex = Trackman::Errors::ConfigSetupError.new
44
+
45
+ result = Trackman::Utility::Debugger.log_exception ex
46
+
47
+ result[:ruby_version].should_not be_nil
48
+ result[:rails_version].should_not be_nil
49
+ result[:gem_version].should_not be_nil
50
+ result[:local].should == []
51
+ result[:remote].should == []
52
+ result[:exception][:class].should == "Trackman::Errors::ConfigSetupError"
53
+ result[:exception][:message].should == ex.message
54
+ result[:exception][:backtrace].should == ex.backtrace
55
+ end
56
+ end
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-29 00:00:00.000000000 Z
13
+ date: 2012-10-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -208,6 +208,7 @@ files:
208
208
  - spec/composite_asset_spec.rb
209
209
  - spec/configuration_spec.rb
210
210
  - spec/css_asset_spec.rb
211
+ - spec/debugger_spec.rb
211
212
  - spec/diffable_spec.rb
212
213
  - spec/fixtures/composite_assets/query_string_in_path.html
213
214
  - spec/fixtures/rails2311/fully-loaded/README
@@ -520,6 +521,7 @@ test_files:
520
521
  - spec/composite_asset_spec.rb
521
522
  - spec/configuration_spec.rb
522
523
  - spec/css_asset_spec.rb
524
+ - spec/debugger_spec.rb
523
525
  - spec/diffable_spec.rb
524
526
  - spec/fixtures/composite_assets/query_string_in_path.html
525
527
  - spec/fixtures/rails2311/fully-loaded/README