bluepill 0.2.1 → 0.2.3

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -1
  3. data/README.md +2 -2
  4. data/bin/bluepill +1 -0
  5. data/bluepill.gemspec +3 -1
  6. data/lib/bluepill/application/lifecycle.rb +3 -1
  7. data/lib/bluepill/application/listener.rb +4 -2
  8. data/lib/bluepill/application/previous_daemon.rb +2 -0
  9. data/lib/bluepill/application.rb +2 -0
  10. data/lib/bluepill/base_directory.rb +2 -0
  11. data/lib/bluepill/clock.rb +2 -0
  12. data/lib/bluepill/condition_watch.rb +2 -0
  13. data/lib/bluepill/controller/directory.rb +2 -0
  14. data/lib/bluepill/controller.rb +2 -0
  15. data/lib/bluepill/daemonize.rb +2 -0
  16. data/lib/bluepill/dsl/app_proxy.rb +2 -0
  17. data/lib/bluepill/dsl/process_factory/children.rb +2 -0
  18. data/lib/bluepill/dsl/process_factory/registry.rb +2 -0
  19. data/lib/bluepill/dsl/process_factory.rb +2 -0
  20. data/lib/bluepill/dsl/process_proxy.rb +2 -0
  21. data/lib/bluepill/dsl.rb +2 -0
  22. data/lib/bluepill/group.rb +2 -0
  23. data/lib/bluepill/logger.rb +3 -1
  24. data/lib/bluepill/pid_file.rb +2 -0
  25. data/lib/bluepill/process/attributes.rb +2 -0
  26. data/lib/bluepill/process/children.rb +2 -0
  27. data/lib/bluepill/process/pid.rb +2 -0
  28. data/lib/bluepill/process/state_machine.rb +2 -0
  29. data/lib/bluepill/process/transition.rb +2 -0
  30. data/lib/bluepill/process/transition_callbacks.rb +2 -0
  31. data/lib/bluepill/process/user_commands.rb +2 -0
  32. data/lib/bluepill/process/watches.rb +2 -0
  33. data/lib/bluepill/process.rb +2 -0
  34. data/lib/bluepill/process_commands/execution.rb +3 -1
  35. data/lib/bluepill/process_commands/hooks.rb +2 -0
  36. data/lib/bluepill/process_commands/stop_signals.rb +2 -0
  37. data/lib/bluepill/process_commands.rb +2 -0
  38. data/lib/bluepill/process_conditions/always_true.rb +2 -0
  39. data/lib/bluepill/process_conditions/below_threshold.rb +2 -0
  40. data/lib/bluepill/process_conditions/cpu_usage.rb +2 -0
  41. data/lib/bluepill/process_conditions/file_time.rb +2 -0
  42. data/lib/bluepill/process_conditions/http.rb +2 -0
  43. data/lib/bluepill/process_conditions/mem_usage.rb +5 -3
  44. data/lib/bluepill/process_conditions/process_condition.rb +2 -0
  45. data/lib/bluepill/process_conditions/running_time.rb +2 -0
  46. data/lib/bluepill/process_conditions/zombie_process.rb +2 -0
  47. data/lib/bluepill/process_conditions.rb +2 -0
  48. data/lib/bluepill/process_journal/cleanup.rb +2 -0
  49. data/lib/bluepill/process_journal/lock.rb +2 -0
  50. data/lib/bluepill/process_journal.rb +5 -3
  51. data/lib/bluepill/process_statistics.rb +3 -1
  52. data/lib/bluepill/socket.rb +2 -0
  53. data/lib/bluepill/system/command_setup.rb +3 -1
  54. data/lib/bluepill/system/commands.rb +2 -0
  55. data/lib/bluepill/system/daemon.rb +2 -0
  56. data/lib/bluepill/system/ps.rb +2 -0
  57. data/lib/bluepill/system/ps_table.rb +2 -0
  58. data/lib/bluepill/system.rb +4 -2
  59. data/lib/bluepill/trigger.rb +2 -0
  60. data/lib/bluepill/triggers/flapping.rb +2 -0
  61. data/lib/bluepill/units.rb +2 -0
  62. data/lib/bluepill/util/inflections.rb +2 -0
  63. data/lib/bluepill/util/levenshtein.rb +2 -0
  64. data/lib/bluepill/util/rotational_array.rb +2 -0
  65. data/lib/bluepill/version.rb +9 -7
  66. data/lib/bluepill.rb +2 -0
  67. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24bda9b03c07276b7cd052d90f53e89cc2499b6317dead57a64b7a95a2fe9a82
4
- data.tar.gz: 39de75c1d40bf17038c37dbb5149feb4d41902c57b372d915720505504217924
3
+ metadata.gz: c8d27b19dbe30a5a18761f09310196ec0217443587cb6da651bd371b1532566f
4
+ data.tar.gz: 4bc4799e210e6da938c82ebbb3a26330b2438a391c4adffae574986103ebf08a
5
5
  SHA512:
6
- metadata.gz: 2d177dd6ee49fde6b7eb69b98a01302c53950ef7564bbb2aeac680b671a272dc0b32abd7f3a341b779a5ce0bfc09ce57e6ba304cc5c4d46714cfb06cd20c7af4
7
- data.tar.gz: e607adb3667ee40d5b29343363d39e86b6c8d43835f0b48c58c7dad4c15465073dab130e5bab5fced3b266a05ac5de9065c9f8fe2d6fd23294396328757f4e38
6
+ metadata.gz: 7cebf575f741efdf1e50b9c190382d146c986a1bfb74bee2b9f4d0ab0335c13cdbf8f1123a6e2d9451dd470db15c9806beb089cf06f4580497e3c4ac8fc45450
7
+ data.tar.gz: 0cd636224f8688383a44e6f7f8f7e321836186e4a52e2ebef88d1f6179d687018373709c643070b352d4bdf6edf0bb95fbb221017aa071726e400c3d53a00b21
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2026-11-02
11
+
12
+ ### Changed
13
+
14
+ - Bluepill's string literals are frozen, so parsing `ps` each tick makes 10% fewer objects and takes 3% fewer instructions, and checks and `bluepill status` make a few fewer.
15
+
16
+ ### Removed
17
+
18
+ - **Breaking:** support for Ruby 2.1 and 2.2, and for JRuby 9.0, which runs Ruby 2.2 code. Bluepill 0.2.3 needs Ruby 2.3 or newer, or JRuby 9.1 or newer. Bluepill 0.2.1 still runs on them.
19
+
10
20
  ## [0.2.1] - 2026-11-02
11
21
 
12
22
  ### Removed
@@ -822,7 +832,8 @@ Initial release.
822
832
  - Added the `bluepill` CLI with the `load`, `status`, `start`, `stop`, `restart`, `unmonitor`, `quit` and `log` commands.
823
833
  - Added syslog logging.
824
834
 
825
- [unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.1...HEAD
835
+ [unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.3...HEAD
836
+ [0.2.3]: https://github.com/bluepill-rb/bluepill/compare/v0.2.1...v0.2.3
826
837
  [0.2.1]: https://github.com/bluepill-rb/bluepill/compare/v0.2.0...v0.2.1
827
838
  [0.2.0]: https://github.com/bluepill-rb/bluepill/compare/v0.1.6...v0.2.0
828
839
  [0.1.6]: https://github.com/bluepill-rb/bluepill/compare/v0.1.5...v0.1.6
data/README.md CHANGED
@@ -504,10 +504,10 @@ JRuby allows you to run bluepill only in the foreground.
504
504
  This library aims to support and is [tested against][ci] the following Ruby
505
505
  implementations:
506
506
 
507
- * Ruby 2.1 through 2.7
507
+ * Ruby 2.3 through 2.7
508
508
  * Ruby 3.0 through 3.4
509
509
  * Ruby 4.0
510
- * JRuby 9.0 through 9.4 (only in the foreground)
510
+ * JRuby 9.1 through 9.4 (only in the foreground)
511
511
  * JRuby 10.0 and 10.1 (only in the foreground)
512
512
 
513
513
  If something doesn't work on one of these interpreters, please open an issue.
data/bin/bluepill CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
  require "optparse"
3
4
  require "rbconfig"
4
5
  require "bluepill"
data/bluepill.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path("lib", __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "bluepill/version"
@@ -20,7 +22,7 @@ Gem::Specification.new do |spec|
20
22
  "rubygems_mfa_required" => "true"
21
23
  }
22
24
 
23
- spec.required_ruby_version = ">= 2.1"
25
+ spec.required_ruby_version = ">= 2.3"
24
26
 
25
27
  # sig has the RBS signatures, and the standard libraries they use in manifest.yaml
26
28
  spec.executables = %w[bluepill bpsv]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Application
3
5
  # Start the daemon, run it until a signal stops it, and clean up after
@@ -117,7 +119,7 @@ module Bluepill
117
119
  Signal.trap("INT", &terminator)
118
120
 
119
121
  Signal.trap("HUP") do
120
- logger.reopen if logger
122
+ logger&.reopen
121
123
  end
122
124
  end
123
125
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Application
3
5
  # Answer the commands that the CLI sends over the daemon's socket
@@ -19,7 +21,7 @@ module Bluepill
19
21
  # @api private
20
22
  def start_listener
21
23
  previous_thread = @listener_thread
22
- previous_thread.kill if previous_thread
24
+ previous_thread&.kill
23
25
  @listener_thread = Thread.new do
24
26
  loop do
25
27
  answer_next_client
@@ -115,7 +117,7 @@ module Bluepill
115
117
  #
116
118
  # @api private
117
119
  def close_client(client)
118
- client.close if client
120
+ client&.close
119
121
  rescue IOError
120
122
  # closed stream
121
123
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Application
3
5
  # Stop a daemon for the application that's still running, before
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/system"
2
4
  require "bluepill/process_journal"
3
5
  require "bluepill/base_directory"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The paths in bluepill's base directory
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The clock that times ticks, checks and grace times
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Runs a process's check every so often, and fires its events when the
3
5
  # check fails often enough
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Controller
3
5
  # Find the daemons in the base directory, and clean up after dead ones
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "fileutils"
2
4
  require "bluepill/system"
3
5
  require "bluepill/base_directory"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # The parts of the daemons gem that bluepill uses, which bluepill used to
2
4
  # get from blue-daemons, a fork of it. They're adapted from daemons'
3
5
  # lib/daemons/daemonize.rb, which carries this notice:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The self of the block given to {Bluepill.application}
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class ProcessFactory
3
5
  # Create the processes of the children that a process's factory finds
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class ProcessFactory
3
5
  # The process names and pid files that an application's config has used
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/dsl/process_factory/children"
2
4
  require "bluepill/dsl/process_factory/registry"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/util/levenshtein"
2
4
 
3
5
  module Bluepill
data/lib/bluepill/dsl.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Load an application from a config file
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The processes of an application that share a group name
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Write bluepill's log, to syslog or a file, with prefixes
3
5
  #
@@ -87,7 +89,7 @@ module Bluepill
87
89
  # @return [void]
88
90
  # @api private
89
91
  LOG_METHODS.each_with_index do |method, priority|
90
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
92
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
91
93
  def #{method}(msg, prefix = nil) # def emerg(msg, prefix = nil)
92
94
  # Below the log level, so dropped before anything is formatted
93
95
  return if #{priority} > @level # return if 0 > @level
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Read the pid file of a bluepill daemon
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # The options a config can set for a Process, and their defaults
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # Keeps a Process for each of a Process's children, when it monitors them
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # Finds, signals and forgets a Process's pid
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # Moves a Process between its states
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # A process's move from one state to another, as triggers and the
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # Runs what a Process does on its way from one state to another
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # Carries out the commands a user gives a Process from the command line
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  class Process
3
5
  # The checks that run on a Process every interval, such as its memory
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/system"
2
4
  require "bluepill/process_journal"
3
5
  require "bluepill/process_commands"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessCommands
3
5
  # Runs a Process's commands as its user, in its working_dir, with its
@@ -79,7 +81,7 @@ module Bluepill
79
81
  result = System.execute_blocking(cmd, options)
80
82
  # The exit code is nil when a signal killed the command
81
83
  exit_code = result.fetch(:exit_code)
82
- return if exit_code && exit_code.zero?
84
+ return if exit_code&.zero?
83
85
 
84
86
  logger.warning "#{description} command execution returned non-zero exit code:"
85
87
  logger.warning result.inspect
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessCommands
3
5
  # Runs the commands a Process has around its starts and stops, and on
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessCommands
3
5
  # Stops a Process with its stop_signals: a signal, then a delay and a
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/process_commands/execution"
2
4
  require "bluepill/process_commands/hooks"
3
5
  require "bluepill/process_commands/stop_signals"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # A check that always passes, for testing a config: `checks :always_true`
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks that a value a process reads is below a limit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks a process's CPU usage, as a percentage
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks how long ago a file changed, in seconds
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "net/http"
2
4
  require "uri"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks a process's memory usage (its resident set size)
@@ -19,17 +21,17 @@ module Bluepill
19
21
  # How a value shows in the history: a number and its unit
20
22
  #
21
23
  # @api private
22
- FORMAT_STR = "%d%s".freeze
24
+ FORMAT_STR = "%d%s"
23
25
 
24
26
  # The unit of a value that shows in megabytes
25
27
  #
26
28
  # @api private
27
- MB_LABEL = "MB".freeze
29
+ MB_LABEL = "MB"
28
30
 
29
31
  # The unit of a value that shows in kilobytes
30
32
  #
31
33
  # @api private
32
- KB_LABEL = "KB".freeze
34
+ KB_LABEL = "KB"
33
35
 
34
36
  # Read the process's memory usage from the tick's ps table
35
37
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks something about a process, as one of a process's checks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks how long a process has been running, in seconds
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessConditions
3
5
  # Checks whether a process is a zombie, which ps shows as <defunct>
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The checks a process can run, named in a config by their underscored
3
5
  # class name, such as `checks :mem_usage`
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessJournal
3
5
  # Kill what an earlier run left in a process's journals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module ProcessJournal
3
5
  # Lock a journal while bluepill reads and writes it
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/system"
2
4
  require "bluepill/process_journal/cleanup"
3
5
  require "bluepill/process_journal/lock"
@@ -66,12 +68,12 @@ module Bluepill
66
68
  # A pid journal's kind
67
69
  #
68
70
  # @api private
69
- PID = Kind.new("pid".freeze, "process".freeze, "pids".freeze, 1).freeze
71
+ PID = Kind.new("pid", "process", "pids", 1).freeze
70
72
 
71
73
  # A process group journal's kind
72
74
  #
73
75
  # @api private
74
- PGID = Kind.new("pgid".freeze, "process group".freeze, "pgids".freeze, -1).freeze
76
+ PGID = Kind.new("pgid", "process group", "pgids", -1).freeze
75
77
 
76
78
  class << self
77
79
  # Return the logger the journal writes to
@@ -216,7 +218,7 @@ module Bluepill
216
218
  def self.journal_entries(filename)
217
219
  File.readlines(filename).collect do |line|
218
220
  id, started = line.split
219
- [id.to_i, started && started.to_i]
221
+ [id.to_i, started&.to_i]
220
222
  end
221
223
  end
222
224
 
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Keeps a process's last few events, which bluepill status shows
3
5
  #
4
6
  # @api private
5
7
  class ProcessStatistics
6
8
  # How status shows each event's time
7
- STRFTIME = "%m/%d/%Y %H:%M:%S".freeze
9
+ STRFTIME = "%m/%d/%Y %H:%M:%S"
8
10
 
9
11
  # How many events are kept
10
12
  EVENTS_TO_PERSIST = 10
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "socket"
2
4
  require "bluepill/base_directory"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "etc"
2
4
 
3
5
  module Bluepill
@@ -22,7 +24,7 @@ module Bluepill
22
24
  working_dir = options[:working_dir]
23
25
  Dir.chdir(ENV["PWD"] = working_dir.to_s) if working_dir
24
26
  environment = options[:environment]
25
- environment.each { |key, value| ENV[key.to_s] = value.to_s } if environment
27
+ environment&.each { |key, value| ENV[key.to_s] = value.to_s }
26
28
  end
27
29
 
28
30
  # Switch to another user and groups, when bluepill runs as root
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "shellwords"
2
4
  require "bluepill/daemonize"
3
5
  require "bluepill/system/command_setup"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "shellwords"
2
4
  require "bluepill/daemonize"
3
5
  require "bluepill/system/command_setup"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/system/ps_table"
2
4
 
3
5
  module Bluepill
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module System
3
5
  # A tick's table of processes, as ps listed them
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bluepill/system/ps"
2
4
  require "bluepill/system/commands"
3
5
 
@@ -19,7 +21,7 @@ module Bluepill
19
21
  # The mode that a daemon's stdout and stderr files are opened in
20
22
  #
21
23
  # @api private
22
- APPEND_MODE = "a".freeze
24
+ APPEND_MODE = "a"
23
25
 
24
26
  # Raised when ps could not be run, so there is no data for this tick
25
27
  #
@@ -152,7 +154,7 @@ module Bluepill
152
154
  # @api private
153
155
  def self.command(pid)
154
156
  row = ps_axu.row(pid)
155
- row.fetch(PsTable::COMMAND) if row
157
+ row&.fetch(PsTable::COMMAND)
156
158
  end
157
159
 
158
160
  # Delete a file if it exists
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Reacts to a process's state transitions, as one of a process's checks
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The triggers a process can have
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The durations and sizes a config writes, such as 10.seconds and
3
5
  # 100.megabytes, as plain numbers of seconds and bytes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Small helpers bluepill keeps for itself
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  module Util
3
5
  # Return how many edits turn one string into another
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # Small helpers for the rest of bluepill
3
5
  #
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bluepill
2
4
  # The version of bluepill
3
5
  #
4
6
  # @example
5
- # Bluepill::Version.to_s # => "0.2.1"
7
+ # Bluepill::Version.to_s # => "0.2.3"
6
8
  #
7
9
  # @api public
8
10
  module Version
@@ -33,13 +35,13 @@ module Bluepill
33
35
  # Return the patch version
34
36
  #
35
37
  # @example
36
- # Bluepill::Version.patch # => 1
38
+ # Bluepill::Version.patch # => 3
37
39
  #
38
40
  # @return [Integer] the patch version
39
41
  #
40
42
  # @api public
41
43
  def self.patch
42
- 1
44
+ 3
43
45
  end
44
46
 
45
47
  # Return the pre-release version
@@ -56,7 +58,7 @@ module Bluepill
56
58
  # Return the version's parts by name
57
59
  #
58
60
  # @example
59
- # Bluepill::Version.to_h # => {major: 0, minor: 2, patch: 1, pre: nil}
61
+ # Bluepill::Version.to_h # => {major: 0, minor: 2, patch: 3, pre: nil}
60
62
  #
61
63
  # @return [Hash{Symbol => Integer, nil}] the major, minor, patch and
62
64
  # pre-release versions
@@ -74,7 +76,7 @@ module Bluepill
74
76
  # Return the version's parts, without a missing pre-release version
75
77
  #
76
78
  # @example
77
- # Bluepill::Version.to_a # => [0, 2, 1]
79
+ # Bluepill::Version.to_a # => [0, 2, 3]
78
80
  #
79
81
  # @return [Array<Integer>] the parts of the version
80
82
  #
@@ -86,9 +88,9 @@ module Bluepill
86
88
  # Return the version as a string
87
89
  #
88
90
  # @example
89
- # Bluepill::Version.to_s # => "0.2.1"
91
+ # Bluepill::Version.to_s # => "0.2.3"
90
92
  #
91
- # @return [String] the version, such as "0.2.1"
93
+ # @return [String] the version, such as "0.2.3"
92
94
  #
93
95
  # @api public
94
96
  def self.to_s
data/lib/bluepill.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubygems"
2
4
 
3
5
  # A process monitor that keeps daemons running
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluepill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: '2.1'
119
+ version: '2.3'
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="