rscratch 0.1.4 → 0.1.5

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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 676517b649abb56d47e1a082529497f3f8c36d16
4
- data.tar.gz: edc162e44f9a79ddf8b0be16a028619778267db4
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTExZjJkNjg0Y2ZjNzk3MzQ0YzJjMGQzMWRlYTgwYTAyMDY1ODFhMg==
5
+ data.tar.gz: !binary |-
6
+ ZmEzOWVjMjU4N2M3NDFhMWRmMTgwODJhOWFhYTdkN2M3NDgzNmIwNw==
5
7
  SHA512:
6
- metadata.gz: 8aaf9492970cc937350ed1f1ef06fb73f10a54776c92e5d158adda4d132b88b78e2371b590eedec8f70119ebc902a262a72923f80b485d04d5078b64925e785b
7
- data.tar.gz: e30dab1e112a060e633c48f97355145512cddf1d7c0e7263ed1170362c63291633dff3fa5e48ed933905f62a7623d932e8b77520bdb3abfcd818c155891cd62e
8
+ metadata.gz: !binary |-
9
+ YTczZThmZDU0Mjc4YzkyZjZmNThjNzU3MmYwMDY1ZmExNzJiZmRjYTg2NzU4
10
+ NzYxZjUyNjcxMTAwZjNlZTUyYTQwMzFlZjczNTM5MmI0MDRjYTg5YzEwZDk0
11
+ MTZiNGM1ZGZiODc3MDcwZjY3MGU0ODNkNzk0MTU3NDBlN2ZjMDY=
12
+ data.tar.gz: !binary |-
13
+ ZmY0YzllNmZhODAzYjQ0ZGNlMjA0MzY3MTE4MjA4YmFiMWM3M2Q4MDM1ODc5
14
+ ZmRhMzhiNjE1ZWQ3MjIwMTkwZGNhNmRhZDI3OWYwMzJkODYyNzUwNzNlYmZh
15
+ M2VmM2NhNjgxYmE5YWI3MmM0YzI2YWY4N2M5ZTE0ZTY5MWUwZGM=
data/README.md CHANGED
@@ -14,6 +14,14 @@ RScratch is a Ruby on Rails gem that helps you to manage bugs in your applicatio
14
14
  * UI is developed on top of Material Design.
15
15
  * Exception log comes with full backtrace, parameters, client details and request preconditions.
16
16
 
17
+ ### Screenshots
18
+
19
+ #### Dashboard
20
+ ![Rscratch Dashboard](./doc/Screen-Dashboard.png)
21
+
22
+ #### Exception Details
23
+ ![Rscratch Dashboard](./doc/Screen-Exception.png)
24
+
17
25
  ## Installation
18
26
 
19
27
  Add this line to your application's Gemfile:
@@ -38,7 +46,7 @@ You should restart your application after installing RScratch gem.
38
46
  ## Usage
39
47
  Add this following line in rescue block of your your code. An example is given below
40
48
  ```ruby
41
- Rscratch::Exception.log e,request
49
+ Rscratch.log_exception e,request
42
50
  ```
43
51
 
44
52
  An example is given below
@@ -53,7 +61,7 @@ An example is given below
53
61
  end
54
62
  rescue Exception => e
55
63
  # Log exception in RScratch
56
- Rscratch::Exception.log e,request
64
+ Rscratch.log_exception e,request
57
65
 
58
66
  respond_to do |format|
59
67
  format.json { render json: @post.errors, status: :unprocessable_entity }
@@ -13,53 +13,61 @@
13
13
  return entityMap[s];
14
14
  });
15
15
  }
16
+ var seen_at = new Date(response.log.created_at);
17
+ var seen_at = seen_at.format("dd-mm-yyyy hh:MM TT","GMT");
18
+
16
19
  var created_at = new Date(response.created_at);
17
- var created_at = created_at.format("dd-mm-yyyy hh:MM TT","GMT");
20
+ var created_at = created_at.format("dd-mm-yyyy hh:MM TT","GMT");
18
21
 
19
- var updated_at = new Date(response.log.created_at);
22
+ var updated_at = new Date(response.updated_at);
20
23
  var updated_at = updated_at.format("dd-mm-yyyy hh:MM TT","GMT");
21
24
  %>
22
- <div class="row">
23
- <div class="col s3">First seen at</div>
24
- <div class="col s9"><%= created_at %></div>
25
- </div>
26
- <div class="row">
27
- <div class="col s3">Last seen at</div>
28
- <div class="col s9"><%= updated_at %></div>
29
- </div>
30
- <div class="row">
31
- <div class="col s3">Occurrences</div>
32
- <div class="col s9"><%= response.total_occurance_count %></div>
33
- </div>
34
- <div class="row">
35
- <div class="col s3">Description</div>
36
- <div class="col s9"> <%= escapeHtml(response.log.description) %></div>
37
- </div>
38
- <div class="row">
39
- <div class="col s3">Environment</div>
40
- <div class="col s9"><%= response.app_environment %></div>
41
- </div>
42
- <div class="row">
43
- <div class="col s3">Request URL</div>
44
- <div class="col s9"><%= response.log.request_url %></div>
45
- </div>
46
- <div class="row">
47
- <div class="col s3">Request Method</div>
48
- <div class="col s9"><%= response.log.request_method %></div>
49
- </div>
50
- <div class="row">
51
- <div class="col s3">Controller</div>
52
- <div class="col s9"><%= response.controller %></div>
53
- </div>
54
- <div class="row">
55
- <div class="col s3">Action</div>
56
- <div class="col s9"><%= response.action %></div>
57
- </div>
58
- <div class="row">
59
- <div class="col s3">Client IP</div>
60
- <div class="col s9"><%= response.log.client_ip %></div>
61
- </div>
62
- <div class="row">
63
- <div class="col s3">User Agent</div>
64
- <div class="col s9"><%= response.log.user_agent %></div>
65
- </div>
25
+ <table>
26
+ <tbody>
27
+ <tr>
28
+ <td class="p5">Occured at</td>
29
+ <td class="p5"><%= seen_at %></td>
30
+ </tr>
31
+ <tr>
32
+ <td class="p5">First occured at</td>
33
+ <td class="p5"><%= created_at %></td>
34
+ </tr>
35
+
36
+ <tr>
37
+ <td class="p5">Last occured at</td>
38
+ <td class="p5"><%= updated_at %></td>
39
+ </tr>
40
+ <tr>
41
+ <td class="p5">Description</td>
42
+ <td class="p5"><%= escapeHtml(response.log.description) %></td>
43
+ </tr>
44
+ <tr>
45
+ <td class="p5">Environment</td>
46
+ <td class="p5"><%= response.app_environment %></td>
47
+ </tr>
48
+ <tr>
49
+ <td class="p5">Request URL</td>
50
+ <td class="p5"><%= response.log.request_url %></td>
51
+ </tr>
52
+ <tr>
53
+ <td class="p5">Request Method</td>
54
+ <td class="p5"><%= response.log.request_method %></td>
55
+ </tr>
56
+ <tr>
57
+ <td class="p5">Controller</td>
58
+ <td class="p5"><%= response.controller %></td>
59
+ </tr>
60
+ <tr>
61
+ <td class="p5">Action</td>
62
+ <td class="p5"><%= response.action %></td>
63
+ </tr>
64
+ <tr>
65
+ <td class="p5">Client IP</td>
66
+ <td class="p5"><%= response.log.client_ip %></td>
67
+ </tr>
68
+ <tr>
69
+ <td class="p5">User Agent</td>
70
+ <td class="p5"><%= response.log.user_agent %></td>
71
+ </tr>
72
+ </tbody>
73
+ </table>
@@ -19,12 +19,12 @@ module Rscratch
19
19
  validates :status , presence: true, :inclusion => {:in => STATUS}
20
20
 
21
21
  ### => Model Scopes
22
- scope :by_exception, lambda {|exc|where(["exception=?", exc])}
23
- scope :by_message, lambda {|msg|where(["message=?", msg])}
24
- scope :by_controller, lambda {|con|where(["controller=?", con])}
25
- scope :by_action, lambda {|act|where(["action=?", act])}
26
- scope :by_environment, lambda {|env|where(["app_environment=?", env])}
27
- scope :by_status, lambda {|status|where(["status=?", status])}
22
+ scope :by_exception, lambda {|exc|where(["exception=?", exc])}
23
+ scope :by_message, lambda {|msg|where(["message=?", msg])}
24
+ scope :by_controller, lambda {|con|where(["controller=?", con])}
25
+ scope :by_action, lambda {|act|where(["action=?", act])}
26
+ scope :by_environment, lambda {|env|where(["app_environment=?", env])}
27
+ scope :by_status, lambda {|status|where(["status=?", status])}
28
28
 
29
29
  ### => Model Callbacks
30
30
  before_validation :set_default_attributes
@@ -39,31 +39,24 @@ module Rscratch
39
39
  # Log an exception
40
40
  def self.log(_exception,_request)
41
41
  _exc = self.find_or_create(_exception,_request.filtered_parameters["controller"].camelize,_request.filtered_parameters["action"],Rails.env.camelize)
42
- if _exc.is_ignored == false
43
- @log = ExceptionLog.new
44
- @log.set_attributes_for _exception,_request
45
- _exc.exception_logs << @log
46
- else
47
- @log = _exc.exception_logs.last
42
+ unless _exc.ignored?
43
+ _log = ExceptionLog.new
44
+ _log.set_attributes_for _exception,_request
45
+ _exc.exception_logs << _log
48
46
  end
49
- _hash = { :exception_id => _exc.id,
50
- :log_serial => @log.id,
51
- :log_url => "#{_request.base_url}#{Rscratch::Engine.routes.url_helpers.log_exceptions_path(@log)}"
52
- }
53
- return _hash
47
+ _exc_log = _exc.exception_logs.last
48
+ return { :exception_id => _exc.id, :log_serial => _exc_log.id, :log_url => "#{_request.base_url}#{Rscratch::Engine.routes.url_helpers.log_exceptions_path(_exc_log)}" }
54
49
  end
55
50
 
56
51
  # Log unique exceptions
57
52
  def self.find_or_create exc,_controller,_action,_env
58
- _excp = Exception.by_exception(exc.class).by_message(exc.message).by_controller(_controller).by_action(_action).by_environment(_env)
59
- if _excp.present?
60
- return _excp.first
61
- else
53
+ _excp = Exception.by_exception(exc.class).by_message(exc.message).by_controller(_controller).by_action(_action).by_environment(_env).first
54
+ unless _excp.present?
62
55
  _excp = Exception.new
63
56
  _excp.set_attributes_for exc, _controller, _action, _env
64
- _excp.save!
65
- _excp
57
+ _excp.save!
66
58
  end
59
+ _excp
67
60
  end
68
61
 
69
62
  # Sets Exception instance attributes.
@@ -89,6 +82,10 @@ module Rscratch
89
82
  def ignored?
90
83
  self.is_ignored == true
91
84
  end
85
+
86
+ def not_ignored?
87
+ !ignored?
88
+ end
92
89
 
93
90
  def dont_ignore!
94
91
  update_attribute(:is_ignored, false)
@@ -39,14 +39,14 @@ module Rscratch
39
39
 
40
40
  # Sets Log instance attributes.
41
41
  def set_attributes_for exc, request
42
- self.description = exc.inspect,
43
42
  self.backtrace = exc.backtrace.join("\n"),
44
43
  self.request_url = request.original_url,
45
44
  self.request_method = request.request_method,
46
45
  self.parameters = request.filtered_parameters,
47
46
  self.user_agent = request.user_agent,
48
47
  self.client_ip = request.remote_ip,
49
- self.status = "new"
48
+ self.status = "new",
49
+ self.description = exc.inspect
50
50
  end
51
51
 
52
52
  def log_count exception_id
@@ -11,14 +11,12 @@
11
11
  %li.tab.col.s6
12
12
  %a.white-text.waves-effect.waves-light{:href => "#resolved-ex"} Resolved
13
13
  #new-ex.p0
14
- =# smart_listing_controls_for(:exceptions, {class: "form-inline text-right"}) do
15
- =# text_field_tag :filter, '', class: "search form-control", placeholder: "Search...", autocomplete: :off
16
14
  = smart_listing_render :exceptions
17
15
  #resolved-ex.p0
18
16
  = smart_listing_render :resolved_exceptions
19
17
 
20
18
  .col.s8.p0.right
21
- .card#log-page-header.exception-info.margin-0.waves-effect.waves-block.waves-light
19
+ .card#log-page-header.exception-info.margin-0
22
20
  .card-content.p0.blue.border-radius-0
23
21
  .row.margin-0
24
22
  .col.l8.s12
@@ -5,7 +5,12 @@ module Rscratch
5
5
  def self.configure
6
6
  yield configuration
7
7
  end
8
+
8
9
  def self.configuration
9
10
  @configuration ||= Configuration.new
10
11
  end
12
+
13
+ def self.log_exception(exception, request)
14
+ log = Rscratch::Exception.log(exception, request)
15
+ end
11
16
  end
@@ -1,3 +1,3 @@
1
1
  module Rscratch
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rscratch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avishek Jana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-17 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_listing
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: haml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ejs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jbuilder
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: haml-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: RScratch - Exception and log processing solution for Ruby on Rails application
@@ -181,12 +181,12 @@ require_paths:
181
181
  - lib
182
182
  required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">="
184
+ - - ! '>='
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - ">="
189
+ - - ! '>='
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []