resurrected_god 1.1.0 → 1.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48f0fc6744473a296e2203abfbfb1d723166166e04e1f371af3575dc2c69b94c
4
- data.tar.gz: 718a83da60bdcaae421163d7e9d7104d7de146945d7d812ae76b970260e11586
3
+ metadata.gz: c7465cd872f35560c971fa2a4a0d1571b37129d7012d309f9e76b37bdb4e07e4
4
+ data.tar.gz: 33fec16027eaccb0df55a0895ea139ceed978e98f8c868596e00bfa2ca87bff1
5
5
  SHA512:
6
- metadata.gz: 3e202fdde19b9808a0b323c984ef1c84a140e30763ffde8fccea8fa06639e267ddf7da16f533bd6b4024748ad21c030e2a43d36ddcea989fc03b2608bcc89c99
7
- data.tar.gz: af645648a614834208a01c543411e54a641172ee201061565312d8d09816977635ee26d75136eb735e3bb9b2d460eee66dfe33e49434f82a64abbdef1281797e
6
+ metadata.gz: 0ef0c4e6171d31c292a8f9b76f7d813f434c31de284a6fef9fafe947226c807d5110f7e604dd1fc950d9f33c35cd4bd3c485c00e9498ccb51942915829d1dbb3
7
+ data.tar.gz: 2c831bfd22c3887c9445fe22d15eb6ccfb3787b3b61bdbf40170e6497b305704d6dfac5cb897f72a5b7e4a5e7f8d2890675cb481e7e7e13cde13467e62d57c63
data/History.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.1.2 / 2026-11-18
2
+
3
+ * Bug fixes
4
+ * Fix compilation errors with GCC 15 ([@dsander][])
5
+
6
+ ## 1.1.1 / 2023-12-29
7
+
8
+ * Minor Changes
9
+ * Add drb and syslog to runtime dependencies for Ruby 3.4+
10
+
1
11
  ## 1.1.0 / 2022-06-29
2
12
 
3
13
  * Major Changes
data/README.md CHANGED
@@ -2,7 +2,7 @@ ResurrectedGod: The Ruby Framework for Process Management
2
2
  ==============================================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/resurrected_god.svg)](https://badge.fury.io/rb/resurrected_god)
5
- [![CI](https://github.com/mishina2228/resurrected_god/actions/workflows/ci.yml/badge.svg)](https://github.com/mishina2228/resurrected_god/actions/workflows/ci.yml)
5
+ [![Test](https://github.com/mishina2228/resurrected_god/actions/workflows/test.yml/badge.svg)](https://github.com/mishina2228/resurrected_god/actions/workflows/test.yml)
6
6
  [![Documentation](https://img.shields.io/badge/docs-rubydoc.info-blue.svg)](https://rubydoc.info/gems/resurrected_god)
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/27b37a69e634eba75483/maintainability)](https://codeclimate.com/github/mishina2228/resurrected_god/maintainability)
8
8
  [![codecov](https://codecov.io/gh/mishina2228/resurrected_god/branch/master/graph/badge.svg?token=K1DJPS9PSU)](https://codecov.io/gh/mishina2228/resurrected_god)
@@ -63,8 +63,9 @@ kqh_monitor_process(VALUE klass, VALUE pid, VALUE mask)
63
63
  }
64
64
 
65
65
  VALUE
66
- kqh_handle_events()
66
+ kqh_handle_events(VALUE klass)
67
67
  {
68
+ (void)klass;
68
69
  int nevents, i, num_to_fetch;
69
70
  struct kevent *events;
70
71
 
@@ -29,8 +29,9 @@ static int nl_sock; /* socket for netlink connection */
29
29
 
30
30
 
31
31
  VALUE
32
- nlh_handle_events()
32
+ nlh_handle_events(VALUE klass)
33
33
  {
34
+ (void)klass;
34
35
  char buff[CONNECTOR_MAX_MSG_SIZE];
35
36
  struct nlmsghdr *hdr;
36
37
  struct proc_event *event;
@@ -27,7 +27,7 @@ module God
27
27
  def dispatch
28
28
  if %w[load status signal log quit terminate].include?(@command)
29
29
  setup
30
- send("#{@command}_command")
30
+ send(:"#{@command}_command")
31
31
  elsif %w[start stop restart monitor unmonitor remove].include?(@command)
32
32
  setup
33
33
  lifecycle_command
data/lib/god/cli/run.rb CHANGED
@@ -111,13 +111,13 @@ module God
111
111
  def setup_logging
112
112
  log_file = God.log_file
113
113
  log_file = File.expand_path(@options[:log]) if @options[:log]
114
- log_file = '/dev/null' if !log_file && @options[:daemonize]
114
+ log_file = File::NULL if !log_file && @options[:daemonize]
115
115
  return unless log_file
116
116
 
117
117
  puts "Sending output to log file: #{log_file}" unless @options[:daemonize]
118
118
 
119
119
  # reset file descriptors
120
- $stdin.reopen '/dev/null'
120
+ $stdin.reopen File::NULL
121
121
  $stdout.reopen(log_file, 'a')
122
122
  $stderr.reopen $stdout
123
123
  $stdout.sync = true
@@ -64,15 +64,15 @@ module God
64
64
  # nil @this here by initially setting res to true or false,
65
65
  # depending on whether the first operator used is AND or OR
66
66
  # respectively.
67
- @op_stack[0] & AND > 0
67
+ @op_stack[0].anybits?(AND)
68
68
  else
69
69
  @this.test
70
70
  end
71
71
 
72
72
  @op_stack.each do |op|
73
73
  cond = @oper_stack.shift
74
- value = op & NOT > 0 ? !cond.test : cond.test
75
- if op & AND > 0
74
+ value = op.anybits?(NOT) ? !cond.test : cond.test
75
+ if op.anybits?(AND)
76
76
  res &&= value
77
77
  else
78
78
  res ||= value
@@ -64,7 +64,7 @@ module God
64
64
  @timeline.push(process.percent_cpu)
65
65
  self.info = []
66
66
 
67
- history = @timeline.map { |x| "#{x > above ? '*' : ''}#{x}%%" }.join(', ')
67
+ history = @timeline.map { |x| "#{'*' if x > above}#{x}%%" }.join(', ')
68
68
 
69
69
  if @timeline.count { |x| x > above } >= times.first
70
70
  self.info = "cpu out of bounds [#{history}]"
@@ -66,7 +66,7 @@ module God
66
66
  @timeline.push(process.memory)
67
67
  self.info = []
68
68
 
69
- history = @timeline.map { |x| "#{x > above ? '*' : ''}#{x}kb" }.join(', ')
69
+ history = @timeline.map { |x| "#{'*' if x > above}#{x}kb" }.join(', ')
70
70
 
71
71
  if @timeline.count { |x| x > above } >= times.first
72
72
  self.info = "memory out of bounds [#{history}]"
@@ -48,13 +48,13 @@ module God
48
48
  active = pid && System::Process.new(pid).exists?
49
49
 
50
50
  if running && active
51
- info.concat(['process is running'])
51
+ info.push('process is running')
52
52
  true
53
53
  elsif !running && !active
54
- info.concat(['process is not running'])
54
+ info.push('process is not running')
55
55
  true
56
56
  else
57
- info.concat(['process is not running']) if running
57
+ info.push('process is not running') if running
58
58
  false
59
59
  end
60
60
  end
data/lib/god/contact.rb CHANGED
@@ -28,7 +28,7 @@ module God
28
28
  end
29
29
 
30
30
  def arg(name)
31
- instance_variable_get("@#{name}") || self.class.instance_variable_get("@#{name}")
31
+ instance_variable_get(:"@#{name}") || self.class.instance_variable_get(:"@#{name}")
32
32
  end
33
33
 
34
34
  # Normalize the given notify specification into canonical form.
@@ -47,7 +47,7 @@ module God
47
47
  when String
48
48
  { contacts: Array(spec) }
49
49
  when Array
50
- raise ArgumentError, 'contains non-String elements' unless spec.all? { |x| x.instance_of?(String) }
50
+ raise ArgumentError, 'contains non-String elements' unless spec.all?(String)
51
51
 
52
52
  { contacts: spec }
53
53
  when Hash
@@ -60,7 +60,7 @@ module God
60
60
  when String
61
61
  # valid
62
62
  when Array
63
- raise ArgumentError, 'has a :contacts key containing non-String elements' unless contacts.all? { |x| x.instance_of?(String) }
63
+ raise ArgumentError, 'has a :contacts key containing non-String elements' unless contacts.all?(String)
64
64
  # valid
65
65
  else
66
66
  raise ArgumentError, 'must have a :contacts key pointing to a String or Array of Strings'
data/lib/god/logger.rb CHANGED
@@ -12,7 +12,7 @@ module God
12
12
 
13
13
  # Instantiate a new Logger object
14
14
  def initialize(io = $stdout)
15
- super(io)
15
+ super
16
16
  self.logs = {}
17
17
  @mutex = Mutex.new
18
18
  @capture = nil
@@ -24,7 +24,7 @@ module God
24
24
 
25
25
  def level=(lev)
26
26
  SysLogger.level = SimpleLogger::CONSTANT_TO_SYMBOL[lev] if Logger.syslog
27
- super(lev)
27
+ super
28
28
  end
29
29
 
30
30
  # Log a message
data/lib/god/process.rb CHANGED
@@ -9,7 +9,7 @@ module God
9
9
  :stop_timeout, :stop_signal, :umask
10
10
 
11
11
  def initialize
12
- self.log = '/dev/null'
12
+ self.log = File::NULL
13
13
 
14
14
  @pid_file = nil
15
15
  @tracking_pid = true
@@ -139,7 +139,7 @@ module God
139
139
  applog(self, :error, "CHROOT directory '#{chroot}' does not exist")
140
140
  end
141
141
 
142
- unless File.exist?(File.join(chroot, '/dev/null'))
142
+ unless File.exist?(File.join(chroot, File::NULL))
143
143
  valid = false
144
144
  applog(self, :error, "CHROOT directory '#{chroot}' does not contain '/dev/null'")
145
145
  end
@@ -253,7 +253,7 @@ module God
253
253
  $stdout.reopen(w)
254
254
  r.close
255
255
  pid = self.spawn(command)
256
- puts pid.to_s # send pid back to forker
256
+ puts pid # send pid back to forker
257
257
  exit!(0)
258
258
  end
259
259
 
@@ -309,9 +309,9 @@ module God
309
309
  ::Process::Sys.setgid(gid_num) if gid_num
310
310
  ::Process::Sys.setuid(uid_num) if uid
311
311
  self.dir ||= '/'
312
- Dir.chdir self.dir
312
+ Dir.chdir dir
313
313
  $0 = command
314
- $stdin.reopen '/dev/null'
314
+ $stdin.reopen File::NULL
315
315
  if log_cmd
316
316
  $stdout.reopen IO.popen(log_cmd, 'a')
317
317
  else
@@ -22,7 +22,7 @@ module God
22
22
  end
23
23
 
24
24
  def initialize(pid)
25
- super(pid)
25
+ super
26
26
  return if @@total_mem
27
27
 
28
28
  # in K
data/lib/god/timeline.rb CHANGED
@@ -16,7 +16,7 @@ module God
16
16
  #
17
17
  # Returns Timeline
18
18
  def push(val)
19
- concat([val])
19
+ super
20
20
  shift if size > @max_size
21
21
  end
22
22
 
data/lib/god/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module God
4
4
  # The String version number for this package.
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.2'
6
6
  end
data/lib/god/watch.rb CHANGED
@@ -27,6 +27,7 @@ module God
27
27
 
28
28
  # Public: God::Process delegators. See lib/god/process.rb for docs.
29
29
  extend Forwardable
30
+
30
31
  def_delegators :@process, :name, :uid, :gid, :start, :stop, :restart, :dir,
31
32
  :name=, :uid=, :gid=, :start=, :stop=, :restart=,
32
33
  :dir=, :pid_file, :pid_file=, :log, :log=,
@@ -284,7 +285,7 @@ module God
284
285
  before_items = behaviors
285
286
  before_items += [condition] if condition
286
287
  before_items.each do |b|
287
- info = b.send("before_#{action}")
288
+ info = b.send(:"before_#{action}")
288
289
  if info
289
290
  msg = "#{name} before_#{action}: #{info} (#{b.base_name})"
290
291
  applog(self, :info, msg)
@@ -304,7 +305,7 @@ module God
304
305
  after_items = behaviors
305
306
  after_items += [condition] if condition
306
307
  after_items.each do |b|
307
- info = b.send("after_#{action}")
308
+ info = b.send(:"after_#{action}")
308
309
  if info
309
310
  msg = "#{name} after_#{action}: #{info} (#{b.base_name})"
310
311
  applog(self, :info, msg)
data/lib/god.rb CHANGED
@@ -124,7 +124,7 @@ if $load_god
124
124
  class Module
125
125
  def safe_attr_accessor(*args)
126
126
  args.each do |arg|
127
- define_method("#{arg}=".intern) do |other|
127
+ define_method(:"#{arg}=") do |other|
128
128
  abort "God.#{arg} must be set before any Tasks are defined" if !running && inited
129
129
 
130
130
  if running && inited
@@ -132,11 +132,11 @@ if $load_god
132
132
  return
133
133
  end
134
134
 
135
- instance_variable_set("@#{arg}".intern, other)
135
+ instance_variable_set(:"@#{arg}", other)
136
136
  end
137
137
 
138
138
  define_method(arg) do
139
- instance_variable_get("@#{arg}".intern)
139
+ instance_variable_get(:"@#{arg}")
140
140
  end
141
141
  end
142
142
  end
@@ -243,7 +243,7 @@ if $load_god
243
243
  warn: Logger::WARN,
244
244
  error: Logger::ERROR,
245
245
  fatal: Logger::FATAL }
246
- LOG.level = log_level_map[self.log_level]
246
+ LOG.level = log_level_map[log_level]
247
247
 
248
248
  # Init has been executed.
249
249
  self.inited = true
@@ -461,7 +461,7 @@ if $load_god
461
461
  # Returns true on success, false if all tasks could not be stopped within 10
462
462
  # seconds
463
463
  def self.stop_all
464
- watches.sort.each do |_name, w|
464
+ watches.sort.each do |(_name, w)|
465
465
  Thread.new do
466
466
  w.action(:stop)
467
467
  w.unmonitor if w.state != :unmonitored
@@ -514,8 +514,7 @@ if $load_god
514
514
  # Returns an Array of String names of the tasks affected.
515
515
  def self.signal(name, signal)
516
516
  items = watches_by_name(name)
517
- jobs = []
518
- items.each { |w| jobs << Thread.new { w.signal(signal) } }
517
+ jobs = items.map { |w| Thread.new { w.signal(signal) } }
519
518
  jobs.each(&:join)
520
519
  items.map(&:name)
521
520
  end
@@ -676,7 +675,7 @@ if $load_god
676
675
  internal_init
677
676
 
678
677
  # Instantiate server.
679
- self.server = Socket.new(self.port, socket_user, socket_group, socket_perms)
678
+ self.server = Socket.new(port, socket_user, socket_group, socket_perms)
680
679
 
681
680
  # Start monitoring any watches set to autostart.
682
681
  watches.each_value { |w| w.monitor if w.autostart? }
metadata CHANGED
@@ -1,18 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resurrected_god
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  - Kevin Clark
9
9
  - Eric Lindvall
10
10
  - mishina2228
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2022-06-29 00:00:00.000000000 Z
15
- dependencies: []
13
+ date: 1980-01-02 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: drb
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '2.0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: syslog
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '0.1'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.1'
16
43
  description: An easy to configure, easy to extend monitoring framework written in
17
44
  Ruby.
18
45
  email:
@@ -91,8 +118,7 @@ metadata:
91
118
  changelog_uri: https://github.com/mishina2228/resurrected_god/blob/master/History.md
92
119
  homepage_uri: https://github.com/mishina2228/resurrected_god
93
120
  rubygems_mfa_required: 'true'
94
- source_code_uri: https://github.com/mishina2228/resurrected_god/tree/v1.1.0
95
- post_install_message:
121
+ source_code_uri: https://github.com/mishina2228/resurrected_god/tree/v1.1.2
96
122
  rdoc_options: []
97
123
  require_paths:
98
124
  - lib
@@ -108,8 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
134
  - !ruby/object:Gem::Version
109
135
  version: '0'
110
136
  requirements: []
111
- rubygems_version: 3.3.7
112
- signing_key:
137
+ rubygems_version: 4.0.3
113
138
  specification_version: 4
114
139
  summary: Process monitoring framework.
115
140
  test_files: []