bluepill 0.2.5 → 0.2.7

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: 5288f18359d2a2384f55d6b9d245b37182bda58cf9588301d02738caaaad631c
4
- data.tar.gz: 1447ebe71f6ebe9be37ab4edd2ac3b695582b96995c2e3bb00ad1f20ec3a0361
3
+ metadata.gz: 9d664e72f8442b19af1fb89f3fcde512ce4d59c883801117a9d7bc25f5353db8
4
+ data.tar.gz: 77794cc2c1df9fa08ac568b33098333f1adc67802cb943e00c0ee033a7cdf647
5
5
  SHA512:
6
- metadata.gz: a837a60160c8aebb1dffc7d5206d30e79f9f84f2c4e65d6c879de0a94f9ffe7bb961c6aa0b0bdd7443fcdff60bb5ca8204a733058becf3fa5e2e320b70b458ad
7
- data.tar.gz: 81fcacb8b9618c91dce85f862312e90c2a3bdd227500e795310d8d7646e001224bd27d37a36abb06a1b27ac4a4d77cca8ec5148d6b4ff12c09f2e53275d9ea37
6
+ metadata.gz: 5a16b8fc0f63a6e1aa90eef446e9e7841c3f88442db3cb8e9f7b49518770694ad09992b859229151d63496fc11e2283731af559df8eb2a25e737312382bb8581
7
+ data.tar.gz: 0e417a4c4072c3f9435e185ba1ee2ac7f013f01f10d18041e6ce2eea48f39776cd9ac477644586c85e5a6d7b621ef2fee2510783b13944e706d6886d6f2cd3da
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.7] - 2026-11-02
11
+
12
+ ### Changed
13
+
14
+ - The attribute that a config error suggests for a misspelled one now comes from Ruby's `did_you_mean`, as a misspelled method's does, so it also suggests one for a short name, such as `uid` for `ui`.
15
+
16
+ ### Removed
17
+
18
+ - **Breaking:** support for Ruby 2.5 and 2.6, and for JRuby 9.2 and 9.3, which run Ruby 2.5 and 2.6 code. Bluepill 0.2.7 needs Ruby 2.7 or newer, or JRuby 9.4 or newer. Bluepill 0.2.5 still runs on them.
19
+
10
20
  ## [0.2.5] - 2026-11-02
11
21
 
12
22
  ### Changed
@@ -842,7 +852,8 @@ Initial release.
842
852
  - Added the `bluepill` CLI with the `load`, `status`, `start`, `stop`, `restart`, `unmonitor`, `quit` and `log` commands.
843
853
  - Added syslog logging.
844
854
 
845
- [unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.5...HEAD
855
+ [unreleased]: https://github.com/bluepill-rb/bluepill/compare/v0.2.7...HEAD
856
+ [0.2.7]: https://github.com/bluepill-rb/bluepill/compare/v0.2.5...v0.2.7
846
857
  [0.2.5]: https://github.com/bluepill-rb/bluepill/compare/v0.2.3...v0.2.5
847
858
  [0.2.3]: https://github.com/bluepill-rb/bluepill/compare/v0.2.1...v0.2.3
848
859
  [0.2.1]: https://github.com/bluepill-rb/bluepill/compare/v0.2.0...v0.2.1
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.5 through 2.7
507
+ * Ruby 2.7
508
508
  * Ruby 3.0 through 3.4
509
509
  * Ruby 4.0
510
- * JRuby 9.2 through 9.4 (only in the foreground)
510
+ * JRuby 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/bluepill.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  "rubygems_mfa_required" => "true"
23
23
  }
24
24
 
25
- spec.required_ruby_version = ">= 2.5"
25
+ spec.required_ruby_version = ">= 2.7"
26
26
 
27
27
  # sig has the RBS signatures, and the standard libraries they use in manifest.yaml
28
28
  spec.executables = %w[bluepill bpsv]
@@ -13,15 +13,13 @@ module Bluepill
13
13
  # Return the monotonic clock's time, in whole seconds
14
14
  #
15
15
  # It counts from an arbitrary point, such as when the machine booted, so
16
- # a reading only means something next to another one. JRuby 9.0 has no
17
- # :second unit, so it reads the clock in seconds, as a Float, and drops
18
- # the fraction.
16
+ # a reading only means something next to another one.
19
17
  #
20
18
  # @return [Integer]
21
19
  #
22
20
  # @api private
23
21
  def self.now
24
- Integer(::Process.clock_gettime(::Process::CLOCK_MONOTONIC))
22
+ ::Process.clock_gettime(::Process::CLOCK_MONOTONIC, :second)
25
23
  end
26
24
  end
27
25
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bluepill/util/levenshtein"
3
+ require "did_you_mean"
4
4
 
5
5
  module Bluepill
6
6
  # The self of a process block in a config file
@@ -230,10 +230,8 @@ module Bluepill
230
230
 
231
231
  # Return the attribute a process has that's closest to a misspelled one
232
232
  #
233
- # The closest is the one the fewest edits away, if that's at most a
234
- # third of the misspelled name's length. Ruby's did_you_mean would do,
235
- # but Bundler leaves it out on Rubies before 2.7, so bluepill compares
236
- # the names itself and suggests the same attribute on every Ruby.
233
+ # Ruby's did_you_mean picks it, as it picks a method for a misspelled
234
+ # one.
237
235
  #
238
236
  # @param [Symbol] key the misspelled attribute
239
237
  #
@@ -241,11 +239,8 @@ module Bluepill
241
239
  #
242
240
  # @api private
243
241
  def suggest(key)
244
- word = key.to_s
245
- distances = self.class.attribute_names.collect { |name| [Util.levenshtein_distance(word, name.to_s), name.to_s] } #: Array[[Integer, String]]
246
- closest = distances.min #: [Integer, String]
247
- distance, name = closest
248
- name if distance <= word.length / 3
242
+ names = self.class.attribute_names.collect(&:to_s)
243
+ DidYouMean::SpellChecker.new(dictionary: names).correct(key).first
249
244
  end
250
245
  end
251
246
  end
@@ -41,7 +41,7 @@ module Bluepill
41
41
 
42
42
  # The transition from each state to itself, made once, so a tick that
43
43
  # leaves the state alone makes no new object
44
- LOOPBACKS = STATES.collect { |state| [state, Transition.new(state, state).freeze] }.to_h.freeze
44
+ LOOPBACKS = STATES.to_h { |state| [state, Transition.new(state, state).freeze] }.freeze
45
45
 
46
46
  # Return the process's state, such as :up
47
47
  #
@@ -4,7 +4,7 @@ module Bluepill
4
4
  # The version of bluepill
5
5
  #
6
6
  # @example
7
- # Bluepill::Version.to_s # => "0.2.5"
7
+ # Bluepill::Version.to_s # => "0.2.7"
8
8
  #
9
9
  # @api public
10
10
  module Version
@@ -35,13 +35,13 @@ module Bluepill
35
35
  # Return the patch version
36
36
  #
37
37
  # @example
38
- # Bluepill::Version.patch # => 5
38
+ # Bluepill::Version.patch # => 7
39
39
  #
40
40
  # @return [Integer] the patch version
41
41
  #
42
42
  # @api public
43
43
  def self.patch
44
- 5
44
+ 7
45
45
  end
46
46
 
47
47
  # Return the pre-release version
@@ -58,7 +58,7 @@ module Bluepill
58
58
  # Return the version's parts by name
59
59
  #
60
60
  # @example
61
- # Bluepill::Version.to_h # => {major: 0, minor: 2, patch: 5, pre: nil}
61
+ # Bluepill::Version.to_h # => {major: 0, minor: 2, patch: 7, pre: nil}
62
62
  #
63
63
  # @return [Hash{Symbol => Integer, nil}] the major, minor, patch and
64
64
  # pre-release versions
@@ -76,7 +76,7 @@ module Bluepill
76
76
  # Return the version's parts, without a missing pre-release version
77
77
  #
78
78
  # @example
79
- # Bluepill::Version.to_a # => [0, 2, 5]
79
+ # Bluepill::Version.to_a # => [0, 2, 7]
80
80
  #
81
81
  # @return [Array<Integer>] the parts of the version
82
82
  #
@@ -88,9 +88,9 @@ module Bluepill
88
88
  # Return the version as a string
89
89
  #
90
90
  # @example
91
- # Bluepill::Version.to_s # => "0.2.5"
91
+ # Bluepill::Version.to_s # => "0.2.7"
92
92
  #
93
- # @return [String] the version, such as "0.2.5"
93
+ # @return [String] the version, such as "0.2.7"
94
94
  #
95
95
  # @api public
96
96
  def self.to_s
data/sig/bluepill.rbs CHANGED
@@ -93,13 +93,6 @@ module Bluepill
93
93
  # does
94
94
  def self.underscore: (String name) -> String
95
95
 
96
- # The Levenshtein distance between two strings
97
- def self.levenshtein_distance: (String from, String to) -> Integer
98
-
99
- private
100
-
101
- def self.next_levenshtein_row!: (Array[Integer] row, Integer from_length, String from_char, String to) -> void
102
-
103
96
  # An array that drops its oldest element when it grows past its capacity
104
97
  class RotationalArray[Elem] < Array[Elem]
105
98
  @capacity: Integer
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -90,7 +90,6 @@ files:
90
90
  - lib/bluepill/triggers/flapping.rb
91
91
  - lib/bluepill/units.rb
92
92
  - lib/bluepill/util/inflections.rb
93
- - lib/bluepill/util/levenshtein.rb
94
93
  - lib/bluepill/util/rotational_array.rb
95
94
  - lib/bluepill/version.rb
96
95
  - sig/bluepill.rbs
@@ -116,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
115
  requirements:
117
116
  - - ">="
118
117
  - !ruby/object:Gem::Version
119
- version: '2.5'
118
+ version: '2.7'
120
119
  required_rubygems_version: !ruby/object:Gem::Requirement
121
120
  requirements:
122
121
  - - ">="
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bluepill
4
- module Util
5
- # Return how many edits turn one string into another
6
- #
7
- # Counts the characters to insert, delete or replace (the Levenshtein
8
- # distance), a row of the table at a time. ProcessProxy uses it to
9
- # suggest the attribute closest to a misspelled one.
10
- #
11
- # @example
12
- # Bluepill::Util.levenshtein_distance("start_comand", "start_command") # => 1
13
- #
14
- # @param [String] from the string to start from
15
- # @param [String] to the string to end at
16
- #
17
- # @return [Integer] the number of edits
18
- #
19
- # @api private
20
- def self.levenshtein_distance(from, to)
21
- row = (0..to.length).to_a
22
- from.each_char.with_index(1) do |from_char, i|
23
- next_levenshtein_row!(row, i, from_char, to)
24
- end
25
- row.fetch(-1)
26
- end
27
-
28
- # Turn a row of the distance table into the next one, in place
29
- #
30
- # Cell j becomes the fewest edits that turn the first from_length
31
- # characters of the from string into the first j characters of the to
32
- # string.
33
- #
34
- # @param [Array<Integer>] row the row for the characters before from_char
35
- # @param [Integer] from_length the number of from's characters, through
36
- # from_char
37
- # @param [String] from_char the from string's next character
38
- # @param [String] to the string to end at
39
- #
40
- # @return [void]
41
- #
42
- # @api private
43
- def self.next_levenshtein_row!(row, from_length, from_char, to)
44
- diagonal = row.fetch(0)
45
- row[0] = from_length
46
- to.each_char.with_index(1) do |to_char, j|
47
- above = row.fetch(j)
48
- substitution = diagonal + (from_char.eql?(to_char) ? 0 : 1)
49
- row[j] = [above + 1, row.fetch(j - 1) + 1, substitution].min
50
- diagonal = above
51
- end
52
- end
53
- private_class_method :next_levenshtein_row!
54
- end
55
- end