rookout 0.1.7 → 0.1.12

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.
@@ -154,6 +154,22 @@ module Rookout
154
154
 
155
155
  attr_reader :level
156
156
 
157
+ def check_result result, first_obj, second_obj
158
+ return unless [true, false].include? result
159
+ if result
160
+ return
161
+ end
162
+
163
+ unless first_obj.nil?
164
+ raise Exceptions::RookNonPrimitiveObjectType, first_obj.class.to_s unless
165
+ PRIMITIVES.include? first_obj.class
166
+ end
167
+
168
+ return if second_obj.nil?
169
+ raise Exceptions::RookNonPrimitiveObjectType, second_obj.class.to_s unless
170
+ PRIMITIVES.include? second_obj.class
171
+ end
172
+
157
173
  def execute_operation first, second
158
174
  # Remove wrapping of objects as needed
159
175
  first_obj = decapsulate_item first
@@ -166,6 +182,8 @@ module Rookout
166
182
  raise Exceptions::RookExceptionEvaluationFailed.new "", e
167
183
  end
168
184
 
185
+ check_result result, first_obj, second_obj
186
+
169
187
  # If we don't have a result
170
188
  if result.nil?
171
189
  # Verify objects are primitives
@@ -24,13 +24,16 @@ module Rookout
24
24
  end
25
25
  end
26
26
 
27
- attr_reader :message
27
+ attr_reader :message, :exception, :parameters
28
28
 
29
29
  def dumps
30
30
  parameters = NamespaceSerializer.dump Namespaces::RubyObjectNamespace.new(@parameters), false
31
31
  exception = NamespaceSerializer.dump Namespaces::RubyObjectNamespace.new(@exception), false
32
32
 
33
- backtrace_string = @exception.backtrace.join "\n\t"
33
+ backtrace_string = ""
34
+ unless @exception.backtrace.nil?
35
+ backtrace_string = @exception.backtrace.join "\n\t"
36
+ end
34
37
  backtrace_object = Namespaces::RubyObjectNamespace.new(backtrace_string).tailor_limits!
35
38
  traceback = NamespaceSerializer.dump backtrace_object, false
36
39
 
@@ -102,13 +102,16 @@ module Rookout
102
102
  elsif suggested_match? location, filename
103
103
  warning = Exceptions::RookSourceFilePathSuggestion.new location.filename, filename
104
104
  location.notify_warning warning
105
+ # Must return nil in order to skip this script
106
+ nil
105
107
  end
106
108
  end
107
109
 
108
110
  #########################################################################################
109
111
  # Utils
110
112
  def exact_match? location_filename, script_filename
111
- script_filename.end_with? location_filename
113
+ return unless script_filename.end_with? location_filename
114
+ File.basename(script_filename) == File.basename(location_filename)
112
115
  end
113
116
 
114
117
  def suggested_match? location, filename
@@ -122,6 +125,31 @@ module Rookout
122
125
  Digest::SHA2.new(256).hexdigest content
123
126
  end
124
127
 
128
+ def handle_unique_line lines, location, filename
129
+ first_line = nil
130
+ second_found = false
131
+
132
+ lines.each_with_index do |line, index|
133
+ if crc_line(line) == location.line_crc
134
+ if first_line.nil?
135
+ first_line = index
136
+ else
137
+ second_found = true
138
+ break
139
+ end
140
+ end
141
+ end
142
+
143
+ if first_line && !second_found
144
+ updated_line = first_line + 1
145
+ location.notify_warning Processor::RookError.new Exceptions::RookLineMoved.new(filename,
146
+ location.lineno,
147
+ updated_line)
148
+ return updated_line
149
+ end
150
+ nil
151
+ end
152
+
125
153
  def find_updated_line filename, location
126
154
  return location.lineno if location.line_crc.nil?
127
155
 
@@ -130,23 +158,8 @@ module Rookout
130
158
  return location.lineno if location.line_crc == line_crc32
131
159
 
132
160
  if location.line_unique
133
- first_line = nil
134
- second_found = false
135
-
136
- lines.each_with_index do |line, index|
137
- if crc_line(line) == location.line_crc
138
- if first_line.nil?
139
- first_line = index
140
- else
141
- second_found = true
142
- break
143
- end
144
- end
145
- end
146
-
147
- if first_line && !second_found
148
- updated_line = first_line + 1
149
- location.notify_warning Exceptions::RookLineMoved.new(filename, location.lineno, updated_line)
161
+ updated_line = handle_unique_line lines, location, filename
162
+ unless updated_line.nil?
150
163
  return updated_line
151
164
  end
152
165
  end
@@ -1,3 +1,3 @@
1
1
  module Rookout
2
- VERSION = "0.1.7".freeze
2
+ VERSION = "0.1.12".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rookout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liran Haimovitch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-13 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -53,33 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: google-protobuf
56
+ name: event_emitter
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0
61
+ version: 0.2.6
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
- version: 3.0.0
68
+ version: 0.2.6
69
69
  - !ruby/object:Gem::Dependency
70
- name: event_emitter
70
+ name: google-protobuf
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.6
75
+ version: 3.9.2
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
- version: 0.2.6
82
+ version: 3.9.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: google-style
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -253,7 +253,7 @@ licenses:
253
253
  - Proprietary
254
254
  metadata:
255
255
  homepage_uri: https://rookout.com
256
- post_install_message:
256
+ post_install_message:
257
257
  rdoc_options: []
258
258
  require_paths:
259
259
  - lib
@@ -268,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.0.3
272
- signing_key:
271
+ rubygems_version: 3.1.2
272
+ signing_key:
273
273
  specification_version: 4
274
274
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform
275
275
  test_files: []