rookout 0.1.9 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.9".freeze
2
+ VERSION = "0.1.14".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.9
4
+ version: 0.1.14
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-16 00:00:00.000000000 Z
11
+ date: 2020-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: google-protobuf
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.0.0
76
- type: :development
75
+ version: 3.9.2
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: 3.0.0
82
+ version: 3.9.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: google-style
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -183,13 +183,11 @@ email:
183
183
  - support@rookout.com
184
184
  executables:
185
185
  - rookout
186
- extensions:
187
- - ext/mkrf_conf.rb
186
+ extensions: []
188
187
  extra_rdoc_files: []
189
188
  files:
190
189
  - LICENSE
191
190
  - bin/rookout
192
- - ext/mkrf_conf.rb
193
191
  - lib/rookout.rb
194
192
  - lib/rookout/atfork.rb
195
193
  - lib/rookout/augs/actions/action.rb
@@ -250,13 +248,12 @@ files:
250
248
  - lib/rookout/user_warnings.rb
251
249
  - lib/rookout/utils.rb
252
250
  - lib/rookout/version.rb
253
- - rookout.gemspec
254
251
  homepage: https://rookout.com
255
252
  licenses:
256
253
  - Proprietary
257
254
  metadata:
258
255
  homepage_uri: https://rookout.com
259
- post_install_message:
256
+ post_install_message:
260
257
  rdoc_options: []
261
258
  require_paths:
262
259
  - lib
@@ -271,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
268
  - !ruby/object:Gem::Version
272
269
  version: '0'
273
270
  requirements: []
274
- rubygems_version: 3.0.3
275
- signing_key:
271
+ rubygems_version: 3.1.2
272
+ signing_key:
276
273
  specification_version: 4
277
274
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform
278
275
  test_files: []
@@ -1,30 +0,0 @@
1
- require "rubygems"
2
- require "rubygems/command.rb"
3
- require "rubygems/dependency_installer.rb"
4
-
5
- # We override platform comparison to only match source gems
6
- class Gem::Platform
7
- def self.match platform
8
- platform.nil? || platform == Gem::Platform::RUBY
9
- end
10
- end
11
-
12
- inst = Gem::DependencyInstaller.new
13
- begin
14
- puts "[Rookout] installing appropriate google-protobuf gem"
15
- if File.exist? "/etc/alpine-release"
16
- # Versions from 3.10 onwards don't compile on Alpine
17
- installed = inst.install "google-protobuf", [">= 3.0.0", "< 3.10.0"]
18
- else
19
- installed = inst.install "google-protobuf", ">= 3.0.0"
20
- end
21
- puts "[Rookout] Installed additional dependencies:"
22
- installed.each { |dep| puts dep.name }
23
- rescue
24
- exit 1
25
- end
26
-
27
- # create dummy rakefile to indicate success
28
- f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
29
- f.write("task :default\n")
30
- f.close
@@ -1,39 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require_relative "lib/rookout/version"
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "rookout"
6
- spec.version = Rookout::VERSION
7
-
8
- spec.authors = ["Liran Haimovitch"]
9
- spec.email = ["support@rookout.com"]
10
- spec.description = "rookout is the Ruby SDK for the Rookout Debugging Platform"
11
- spec.summary = "rookout is the Ruby SDK for the Rookout Debugging Platform"
12
- spec.homepage = "https://rookout.com"
13
- spec.license = "Proprietary"
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
-
17
- spec.files = `git ls-files -- ext/* lib/* bin/*`.split("\n") +
18
- ["lib/rookout/commit.rb", "LICENSE", "rookout.gemspec"]
19
- spec.extensions = ["ext/mkrf_conf.rb"]
20
- spec.executables = ["rookout"]
21
-
22
- spec.require_paths = ["lib"]
23
-
24
- spec.required_ruby_version = ">= 2.6"
25
-
26
- spec.add_dependency "binding_of_caller", ">= 0.7"
27
- spec.add_dependency "concurrent-ruby", ">= 1.1"
28
- spec.add_dependency "websocket-driver", ">= 0.5.0"
29
- spec.add_dependency "event_emitter", ">= 0.2.6"
30
-
31
- spec.add_development_dependency "google-protobuf", ">= 3.0.0"
32
- spec.add_development_dependency "google-style", ">= 1.24.0"
33
- spec.add_development_dependency "minitest", ">= 5.14"
34
- spec.add_development_dependency "minitest-autotest", ">= 1.0"
35
- spec.add_development_dependency "minitest-focus", ">= 1.1"
36
- spec.add_development_dependency "minitest-rg", ">= 5.2"
37
- spec.add_development_dependency "autotest-suffix", ">= 1.1"
38
- spec.add_development_dependency "rake-compiler", ">= 1.0"
39
- end