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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 336dcb1b87087e96ab514349310067fa3997c209
4
- data.tar.gz: b33ba0771f64caf6a0519f38afd95dedee68bfb0
2
+ SHA256:
3
+ metadata.gz: d939e097db34d5c7709ceb2f664ea2cf22b4563ab98dbb27de42c8fb1a504299
4
+ data.tar.gz: 9ec57072163a47f15f1d85d024f08b5f8e665d7e50ff8f98443a676ea0513a03
5
5
  SHA512:
6
- metadata.gz: f97a3157e9c7fcdea84754b838d1599c095e0e07890eaede729d4606966592fb49fbdf837f337a68860d33287bf084a48afe493996ebe7e798148cfed8249ec4
7
- data.tar.gz: df969f92c5794cbb1ebc661dfe672d852db2d0161fc9e08daa67312da68a3ec4d0e903ada2ceca832efb351ee976d2dda2a2fa879d89284542f0321966f07635
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
- LineLength:
5
- Max: 128
5
+ Style/FrozenStringLiteralComment:
6
+ Enabled: true
6
7
 
7
- MethodLength:
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
- Enabled: false
15
+ EnforcedStyle: double_quotes
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.6 2018-09-20
2
+ - Update rubocop
3
+ - Check socket existence before closing
4
+
1
5
  ### 0.1.5 2017-09-07
2
6
  - Cleanup logging
3
7
 
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.5"
9
- gem "rubocop", "0.47.1"
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: [:spec, :rubocop]
10
+ task default: %i[spec rubocop]
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "debug_socket"
data/debug_socket.gemspec CHANGED
@@ -1,7 +1,8 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
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 'debug_socket/version'
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
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  if ARGV[0].nil? || ARGV[0].empty? || ARGV[0] == "-h" || ARGV[0] == "--help"
4
5
  puts "\nUsage: debug-socket <socket-path> [<command>=backtrace]"
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.warn("debug-socket-command=#{input.inspect}") if 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
- next unless logger
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.close
44
+ socket&.close
43
45
  end
44
46
  end
45
47
  end
46
48
 
47
- logger.unknown { "Debug socket listening on #{@path}" } if 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.kill if @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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugSocket
2
- VERSION = "0.1.5".freeze
4
+ VERSION = "0.1.6"
3
5
  end
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.5
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: 2017-09-08 00:00:00.000000000 Z
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.11
55
+ rubygems_version: 2.7.6
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Debug Socket for running ruby processes