debug_socket 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +5 -22
- data/CHANGES.md +4 -0
- data/Gemfile +4 -2
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/debug_socket.gemspec +4 -3
- data/exe/debug-socket +1 -0
- data/lib/debug_socket.rb +9 -7
- data/lib/debug_socket/version.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d939e097db34d5c7709ceb2f664ea2cf22b4563ab98dbb27de42c8fb1a504299
|
4
|
+
data.tar.gz: 9ec57072163a47f15f1d85d024f08b5f8e665d7e50ff8f98443a676ea0513a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ed0860c5525b41357aa9210f0341ee1dc07b9140bf51326d7d140a0e56aadd856117e2a21e2c50aa2666a9e9ee3161cb4daed8121478ef0b943a04ba5e3bce
|
7
|
+
data.tar.gz: 61520fe5be839d09dd9623ca0b9e376da3f0faef80c2ec040413c9eea97e885d1c978bad96038319fc146942faa784add4ee6b4b949f061797e19dabee49f000
|
data/.rubocop.yml
CHANGED
@@ -1,32 +1,15 @@
|
|
1
1
|
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
2
3
|
DisplayCopNames: true
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
Style/FrozenStringLiteralComment:
|
6
|
+
Enabled: true
|
6
7
|
|
7
|
-
|
8
|
-
Max: 25
|
9
|
-
|
10
|
-
Encoding:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
Metrics/AbcSize:
|
14
|
-
Max: 50
|
15
|
-
|
16
|
-
Metrics/BlockLength:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Metrics/CyclomaticComplexity:
|
20
|
-
Max: 25
|
21
|
-
|
22
|
-
Metrics/PerceivedComplexity:
|
23
|
-
Max: 25
|
24
|
-
|
25
|
-
Metrics/ParameterLists:
|
8
|
+
Metrics:
|
26
9
|
Enabled: false
|
27
10
|
|
28
11
|
Style/Documentation:
|
29
12
|
Enabled: false
|
30
13
|
|
31
14
|
Style/StringLiterals:
|
32
|
-
|
15
|
+
EnforcedStyle: double_quotes
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "https://rubygems.org"
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in debug_socket.gemspec
|
@@ -5,5 +7,5 @@ gemspec
|
|
5
7
|
|
6
8
|
gem "pry"
|
7
9
|
gem "rake"
|
8
|
-
gem "rspec", "~> 3.
|
9
|
-
gem "rubocop", "0.
|
10
|
+
gem "rspec", "~> 3.8"
|
11
|
+
gem "rubocop", "0.59.1"
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
4
|
require "rspec/core/rake_task"
|
3
5
|
require "rubocop/rake_task"
|
@@ -5,4 +7,4 @@ require "rubocop/rake_task"
|
|
5
7
|
RSpec::Core::RakeTask.new(:spec)
|
6
8
|
RuboCop::RakeTask.new
|
7
9
|
|
8
|
-
task default: [
|
10
|
+
task default: %i[spec rubocop]
|
data/bin/console
CHANGED
data/debug_socket.gemspec
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
5
|
+
require "debug_socket/version"
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = "debug_socket"
|
data/exe/debug-socket
CHANGED
data/lib/debug_socket.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "debug_socket/version"
|
2
4
|
require "socket"
|
3
5
|
require "time"
|
@@ -12,6 +14,7 @@ module DebugSocket
|
|
12
14
|
|
13
15
|
def self.logger
|
14
16
|
return @logger if defined?(@logger)
|
17
|
+
|
15
18
|
require "logger"
|
16
19
|
@logger = Logger.new(STDERR)
|
17
20
|
end
|
@@ -33,18 +36,17 @@ module DebugSocket
|
|
33
36
|
begin
|
34
37
|
socket = server.accept
|
35
38
|
input = socket.read
|
36
|
-
logger
|
39
|
+
logger&.warn("debug-socket-command=#{input.inspect}")
|
37
40
|
socket.puts(eval(input)) # rubocop:disable Security/Eval
|
38
41
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
39
|
-
|
40
|
-
logger.error { "debug-socket-error=#{e.inspect} backtrace=#{e.backtrace.inspect}" }
|
42
|
+
logger&.error { "debug-socket-error=#{e.inspect} backtrace=#{e.backtrace.inspect}" }
|
41
43
|
ensure
|
42
|
-
socket
|
44
|
+
socket&.close
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
logger
|
49
|
+
logger&.unknown { "Debug socket listening on #{@path}" }
|
48
50
|
|
49
51
|
@thread
|
50
52
|
ensure
|
@@ -52,7 +54,7 @@ module DebugSocket
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def self.stop
|
55
|
-
@thread
|
57
|
+
@thread&.kill
|
56
58
|
File.unlink(@path) if @path && File.exist?(@path)
|
57
59
|
@thread = nil
|
58
60
|
@pid = nil
|
@@ -63,7 +65,7 @@ module DebugSocket
|
|
63
65
|
pid = Process.pid
|
64
66
|
"#{Time.now.utc.iso8601} #{$PROGRAM_NAME}\n" + Thread.list.map do |thread|
|
65
67
|
output =
|
66
|
-
"#{Time.now.utc.iso8601} pid=#{pid} thread.object_id=#{thread.object_id} thread.status=#{thread.status}"
|
68
|
+
+"#{Time.now.utc.iso8601} pid=#{pid} thread.object_id=#{thread.object_id} thread.status=#{thread.status}"
|
67
69
|
backtrace = thread.backtrace || []
|
68
70
|
output << "\n#{backtrace.join("\n")}" if backtrace
|
69
71
|
output
|
data/lib/debug_socket/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debug_socket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Lazarus
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
54
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.6
|
55
|
+
rubygems_version: 2.7.6
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: Debug Socket for running ruby processes
|