rookout 0.1.8 → 0.1.13

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.8".freeze
2
+ VERSION = "0.1.13".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.8
4
+ version: 0.1.13
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-22 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,14 +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
- - Rakefile
192
190
  - bin/rookout
193
- - ext/mkrf_conf.rb
194
191
  - lib/rookout.rb
195
192
  - lib/rookout/atfork.rb
196
193
  - lib/rookout/augs/actions/action.rb
@@ -251,13 +248,12 @@ files:
251
248
  - lib/rookout/user_warnings.rb
252
249
  - lib/rookout/utils.rb
253
250
  - lib/rookout/version.rb
254
- - rookout.gemspec
255
251
  homepage: https://rookout.com
256
252
  licenses:
257
253
  - Proprietary
258
254
  metadata:
259
255
  homepage_uri: https://rookout.com
260
- post_install_message:
256
+ post_install_message:
261
257
  rdoc_options: []
262
258
  require_paths:
263
259
  - lib
@@ -272,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
268
  - !ruby/object:Gem::Version
273
269
  version: '0'
274
270
  requirements: []
275
- rubygems_version: 3.0.3
276
- signing_key:
271
+ rubygems_version: 3.1.2
272
+ signing_key:
277
273
  specification_version: 4
278
274
  summary: rookout is the Ruby SDK for the Rookout Debugging Platform
279
275
  test_files: []
data/Rakefile DELETED
@@ -1,92 +0,0 @@
1
- require "bundler/setup"
2
- require "bundler/gem_tasks"
3
-
4
- spec = Gem::Specification.load("rookout.gemspec")
5
-
6
- require "rake/testtask"
7
- desc "Run tests."
8
- Rake::TestTask.new do |t|
9
- t.pattern = "test/**/*_test.rb"
10
- t.warning = false
11
- end
12
-
13
- desc "Run the CI build"
14
- task :ci do
15
- header "BUILDING rookout", "#"
16
- header "rookout rubocop", "*"
17
- require "rubocop/rake_task"
18
- RuboCop::RakeTask.new
19
- Rake::Task[:rubocop].invoke
20
- header "rookout test", "*"
21
- Rake::Task[:test].invoke
22
- end
23
-
24
- desc "Set commit hash"
25
- task :set_commit do
26
- header "Setting commit hash in file", "#"
27
- write_commit_file read_commit
28
- puts "Done!"
29
- end
30
-
31
- desc "Bump gem vesrion"
32
- task :bump_version do
33
- header "Bumpding version", "#"
34
-
35
- version = read_version
36
- minor_version = version[0...version.rindex(".")]
37
- patch_version = version[version.rindex(".") + 1...version.length]
38
- new_patch_version = patch_version.to_i + 1
39
- new_version = "#{minor_version}.#{new_patch_version}"
40
-
41
- write_version_file new_version
42
-
43
- puts "Done! New version is #{new_version}"
44
- end
45
-
46
- desc "Print version configuration"
47
- task :print_version do
48
- puts "export ROOK_VERSION=#{read_version}"
49
- puts "export ROOK_COMMIT=#{read_commit}"
50
- end
51
-
52
- task :default => :test
53
-
54
- def read_version
55
- require_relative "lib/rookout/version"
56
- Rookout::VERSION
57
- end
58
-
59
- def read_commit
60
- `git rev-parse HEAD`.strip
61
- end
62
-
63
- def write_version_file new_version
64
- contents = ""
65
- contents += "module Rookout\n"
66
- contents += " VERSION = \"#{new_version}\".freeze\n"
67
- contents += "end\n"
68
-
69
- f = File.new "lib/rookout/version.rb", "wb"
70
- f.write contents
71
- f.close
72
- end
73
-
74
- def write_commit_file commit
75
- contents = ""
76
- contents += "module Rookout\n"
77
- contents += " COMMIT = \"#{commit}\".freeze\n"
78
- contents += "end\n"
79
-
80
- f = File.new "lib/rookout/commit.rb", "wb"
81
- f.write contents
82
- f.close
83
- end
84
-
85
- def header str, token
86
- line_length = str.length + 8
87
- puts ""
88
- puts token * line_length
89
- puts "#{token * 3} #{str} #{token * 3}"
90
- puts token * line_length
91
- puts ""
92
- end
@@ -1,23 +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
- installed = inst.install "google-protobuf", [">= 3.0.0", "< 3.10.0"]
17
- else
18
- installed = inst.install "google-protobuf", ">= 3.0.0"
19
- end
20
- puts "[Rookout] Installed additional dependencies: #{installed}"
21
- rescue
22
- exit 1
23
- end
@@ -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", "Rakefile", "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