yardie 0.1.0 → 0.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: e29620a34791153b5052f60b03cf99bb7735df11
4
- data.tar.gz: e150111058d351cf979e25c856ba155d9efdbd03
3
+ metadata.gz: 429da70fb6d471ac829492fa89c5ac47be7d9b4d
4
+ data.tar.gz: 37d6cab27a8b845ec305ba3d111e3dc11d99e2a9
5
5
  SHA512:
6
- metadata.gz: f192476eda9ec91efcd1544392764e2fd65d6702e7b8bd4a830ccf5b79c1333f18fc1f8434737567dbfd64efae38a2097708f31ed2ab153491ad5d0ff001b4e0
7
- data.tar.gz: 81c835d9b6d997ef0860512553dd02930a3ca8a21d76c3cedce5f0051f634443913844a537e9545c9e602178e4c369202783dcce81f15342cf5d9b80fa86d9e4
6
+ metadata.gz: 4c727007f22c2a56003d9293499559a36c84ac757bbd0f5bd3db36c8262bf9151bfd96a571b6bfdd6b9b82f2960b00e6415fe313367d68ab589af5a35104e96d
7
+ data.tar.gz: f289c1d93b648fde0b24c8a2ef393d2e5a81d27654bd88ce597c27efc3910baf2065d783ed44b6638020d2ec42ab7e2b7992d234887df3d7e8e7ec4f934f4d77
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  .rspec_status
12
12
 
13
13
  .idea/
14
+ *.gem
@@ -16,6 +16,7 @@ module Yardie
16
16
  return @app.call(env) unless env['CONTENT_TYPE'].eql?('application/json')
17
17
  return @app.call(env) if ENV['YARDIE_AUTH_KEY'].blank?
18
18
 
19
+ local_mode = ENV['YARDIE_LOCAL'] && ENV['YARDIE_LOCAL'].casecmp('TRUE').zero?
19
20
  ct = Thread.current.object_id
20
21
 
21
22
  error = false
@@ -25,7 +26,8 @@ module Yardie
25
26
  id: env['action_dispatch.request_id'],
26
27
  path: env['REQUEST_PATH'],
27
28
  method: env['REQUEST_METHOD'],
28
- body: nil
29
+ body: nil,
30
+ trace: [ ]
29
31
  },
30
32
  controller: {
31
33
  name: nil,
@@ -52,13 +54,21 @@ module Yardie
52
54
  trace = TracePoint.new(:call) do |tp|
53
55
  klass = tp.defined_class.to_s
54
56
 
55
- if klass.end_with?('Controller') && !klass.start_with?('Devise')
57
+ if tp.path.to_s.start_with?(Rails.root.to_s) && Thread.current.object_id == ct
56
58
  # tracepoint emits events for ALL threads, so check that the thread that caused the event to be
57
59
  # emitted is the one we are interested in
58
- if Thread.current.object_id == ct
60
+
61
+ p "#{tp.defined_class} - #{tp.method_id} - #{tp.path}" if local_mode
62
+
63
+ if klass.end_with?('Controller') && !klass.start_with?('Devise')
59
64
  payload[:controller][:name] = tp.defined_class.to_s
60
65
  payload[:controller][:method] = tp.method_id.to_s
61
66
  end
67
+
68
+ payload[:request][:trace] << {
69
+ class: tp.defined_class.to_s,
70
+ method: tp.method_id.to_s
71
+ }
62
72
  end
63
73
  end
64
74
 
@@ -85,7 +95,6 @@ module Yardie
85
95
  if payload[:controller][:name].present? && payload[:controller][:method].present?
86
96
  # post the payload to Construction Yard servers
87
97
  Thread.new {
88
- local_mode = ENV['YARDIE_LOCAL'] && ENV['YARDIE_LOCAL'].casecmp('TRUE').zero?
89
98
  uri = local_mode ? DEV_DELIVERY_URI : PROD_DELIVERY_PATH
90
99
  http = Net::HTTP.new(uri.host, uri.port)
91
100
  req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
@@ -1,3 +1,3 @@
1
1
  module Yardie
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yardie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Deany
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-06 00:00:00.000000000 Z
11
+ date: 2018-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler