bluepill 0.1.5 → 0.1.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.
data/sig/bluepill.rbs CHANGED
@@ -20,6 +20,47 @@ module Bluepill
20
20
  # the AppProxy, and also gets it as an argument.
21
21
  def self.application: (_ToS app_name, ?Hash[Symbol, untyped] options) { (AppProxy app) [self: AppProxy] -> void } -> void
22
22
 
23
+ # Warns on a Ruby that bluepill 0.2 doesn't run on
24
+ def self.warn_unsupported_ruby: (?String ruby_version, ?String? jruby_version) -> void
25
+
26
+ # Times ticks, checks, grace times and flapping with the monotonic clock,
27
+ # or the system clock on a Ruby without Process.clock_gettime
28
+ module Clock
29
+ # The module that reader reads the clock with: Process, or a stand-in
30
+ interface _ClockSource
31
+ def respond_to?: (Symbol name) -> bool
32
+
33
+ def clock_gettime: (Integer clock_id) -> Float
34
+ end
35
+
36
+ def self.reader: (?_ClockSource process) -> ^() -> Integer
37
+
38
+ READER: ^() -> Integer
39
+
40
+ def self.now: () -> Integer
41
+ end
42
+
43
+ # Warns, once each, about what a later version of bluepill will change
44
+ module Deprecation
45
+ self.@warned: Hash[untyped, bool]
46
+ self.@mutex: Thread::Mutex
47
+ self.@logger: Logger?
48
+
49
+ # The logger warnings also go to, which the application sets
50
+ def self.logger: () -> Logger?
51
+
52
+ def self.logger=: (Logger? logger) -> Logger?
53
+
54
+ # Writes "DEPRECATION: message" to stderr and the logger, the first time
55
+ # for a key
56
+ def self.warn: (untyped key, String message) -> bool
57
+
58
+ def self.first?: (untyped key) -> bool
59
+
60
+ # Forgets the warnings given, and the logger
61
+ def self.reset!: () -> void
62
+ end
63
+
23
64
  module Version
24
65
  def self.major: () -> Integer
25
66
 
@@ -41,6 +82,8 @@ module Bluepill
41
82
  class Application
42
83
  PROCESS_COMMANDS: Array[Symbol]
43
84
 
85
+ DAEMON_COMMANDS: Array[Symbol]
86
+
44
87
  attr_accessor name: String
45
88
  attr_accessor logger: Logger
46
89
  attr_accessor base_dir: String
@@ -80,7 +123,8 @@ module Bluepill
80
123
 
81
124
  def add_process: (Process process, ?_ToS? group_name) -> Array[Process]
82
125
 
83
- def version: () -> singleton(Version)
126
+ # The version as a String, which Marshal sends whole
127
+ def version: () -> String
84
128
 
85
129
  # Ruby's protected methods are private in RBS
86
130
 
@@ -90,6 +134,8 @@ module Bluepill
90
134
 
91
135
  def start_listener: () -> Thread
92
136
 
137
+ def daemon_command: (String? command) -> Symbol
138
+
93
139
  def start_server: () -> void
94
140
 
95
141
  def run: () -> void
@@ -109,6 +155,12 @@ module Bluepill
109
155
 
110
156
  # Runs the bluepill commands, and sends them to the daemon over its socket
111
157
  class Controller
158
+ TAIL_COMMAND: String
159
+
160
+ OUT_OF_DATE: String
161
+
162
+ UNKNOWN_VERSION: String
163
+
112
164
  attr_accessor base_dir: String
113
165
  attr_accessor log_file: String?
114
166
  attr_accessor sockets_dir: String
@@ -230,7 +282,7 @@ module Bluepill
230
282
 
231
283
  attr_accessor name: String
232
284
  attr_accessor watches: Array[ConditionWatch]
233
- attr_accessor triggers: Array[Trigger]
285
+ attr_accessor triggers: Array[Trigger | Trigger::Custom]
234
286
  attr_accessor skip_ticks_until: Integer?
235
287
  attr_accessor process_running: bool?
236
288
 
@@ -358,11 +410,12 @@ module Bluepill
358
410
 
359
411
  def record_transition: (_Transition transition) -> void
360
412
 
361
- def notify_triggers: (_Transition transition) -> void
413
+ def notify_triggers: (_Transition & Object transition) -> void
362
414
 
363
415
  def add_watch: (Symbol name, Hash[Symbol, untyped] options) -> Array[ConditionWatch]
364
416
 
365
- def add_trigger: (Symbol name, Hash[Symbol, untyped] options) -> Array[Trigger]
417
+ # Wraps a trigger that a config defines in a Trigger::Custom
418
+ def add_trigger: (Symbol name, Hash[Symbol, untyped] options) -> Array[Trigger | Trigger::Custom]
366
419
 
367
420
  def run_watches: () -> void
368
421
 
@@ -562,6 +615,9 @@ module Bluepill
562
615
  # Returns the events to fire
563
616
  def run: (Integer? pid, ?Integer tick_number) -> Array[Symbol]
564
617
 
618
+ # Logs an error the check raised, which skips it until its next run
619
+ def check_failed: (StandardError error) -> void
620
+
565
621
  def clear_history!: () -> Util::RotationalArray[HistoryValue]
566
622
 
567
623
  def fired?: () -> bool
@@ -594,6 +650,40 @@ module Bluepill
594
650
  def schedule_event: (Symbol event, seconds delay) -> Thread
595
651
 
596
652
  def cancel_all_events: () -> void
653
+
654
+ # A trigger that a config defines, which gets transitions that warn
655
+ # about what bluepill 0.2.0's lack
656
+ class Custom
657
+ attr_reader trigger: Trigger
658
+
659
+ def initialize: (Trigger trigger) -> void
660
+
661
+ # state_machine's transition, which is an Object
662
+ def notify: (_Transition & Object transition) -> void
663
+
664
+ def reset!: () -> void
665
+
666
+ def logger=: (Logger logger) -> void
667
+ end
668
+
669
+ # A transition that warns about anything but from_name, to_name and
670
+ # loopback?, which are all that bluepill 0.2.0's have
671
+ class Transition
672
+ @transition: _Transition & Object
673
+ @trigger_class: Class
674
+
675
+ def initialize: (_Transition & Object transition, Class trigger_class) -> void
676
+
677
+ def from_name: () -> Symbol?
678
+
679
+ def to_name: () -> Symbol?
680
+
681
+ def loopback?: () -> bool
682
+
683
+ def method_missing: (Symbol name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
684
+
685
+ def respond_to_missing?: (Symbol name, bool include_private) -> bool
686
+ end
597
687
  end
598
688
 
599
689
  module Triggers
@@ -638,6 +728,14 @@ module Bluepill
638
728
 
639
729
  # Builds processes from a process block in the config
640
730
  class ProcessFactory
731
+ PRE_START_COMMAND: String
732
+
733
+ UID_WITHOUT_GID: String
734
+
735
+ UID_WITH_GID: String
736
+
737
+ CHILDREN_USER: String
738
+
641
739
  @@process_keys: Hash[Array[String?], nil]
642
740
  @@pid_files: Hash[String, nil]
643
741
 
@@ -667,6 +765,13 @@ module Bluepill
667
765
 
668
766
  def warn_unless_pid_known: (ProcessProxy process, String? default_pid_file) -> void
669
767
 
768
+ # Warns about what bluepill 0.2.0 does differently with the process
769
+ def warn_of_0_2_changes: () -> void
770
+
771
+ # Warns, as root, that 0.2.0 runs a process with a uid in the user's
772
+ # groups
773
+ def warn_of_0_2_groups: () -> void
774
+
670
775
  def config_error!: (String message) -> bot
671
776
 
672
777
  def validate_child_process!: (ProcessProxy child) -> void
@@ -675,6 +780,12 @@ module Bluepill
675
780
  # self in a process block. Any attribute can be set with `name = value`,
676
781
  # `name value` or `name!` (for true), and read back with `name`.
677
782
  class ProcessProxy
783
+ ATTRIBUTES_ADDED_IN_0_2: Array[Symbol]
784
+
785
+ # Whether bluepill 0.2.0 knows a process attribute, which it fails the
786
+ # config without
787
+ def self.known_in_0_2?: (Symbol name) -> bool
788
+
678
789
  attr_reader attributes: Hash[Symbol, untyped]
679
790
  attr_reader watches: Hash[Symbol, Hash[Symbol, untyped]]
680
791
  attr_reader name: String
@@ -692,6 +803,11 @@ module Bluepill
692
803
  def monitor_children: () ?{ (ProcessProxy child) [self: ProcessProxy] -> void } -> process_block?
693
804
 
694
805
  def to_process: () -> Process
806
+
807
+ private
808
+
809
+ # Sets an attribute, and warns about one that 0.2.0 doesn't know
810
+ def set_attribute: (Symbol key, untyped value) -> untyped
695
811
  end
696
812
 
697
813
  # Memoizes ps output for a tick, and runs commands as daemons or until
@@ -883,6 +999,7 @@ module Bluepill
883
999
  @pattern: Regexp?
884
1000
  @open_timeout: Integer
885
1001
  @read_timeout: Integer
1002
+ @verify_ssl: boolish
886
1003
 
887
1004
  def run: (Integer? pid, boolish include_children) -> (Net::HTTPResponse | StandardError)
888
1005
 
@@ -890,6 +1007,10 @@ module Bluepill
890
1007
 
891
1008
  private
892
1009
 
1010
+ # Warns that 0.3.0 verifies the certificate of an https URL that
1011
+ # doesn't set verify_ssl
1012
+ def warn_unverified: () -> void
1013
+
893
1014
  def hide_net_http_bug: [T] () { () -> T } -> T
894
1015
  end
895
1016
 
@@ -927,6 +1048,10 @@ module Bluepill
927
1048
  end
928
1049
 
929
1050
  module Util
1051
+ # Logs an error at err, a line for its summary and one for each line of
1052
+ # its backtrace
1053
+ def self.log_error: (Logger logger, String summary, Exception error) -> void
1054
+
930
1055
  # An array that drops its oldest element when it grows past its capacity
931
1056
  class RotationalArray[Elem] < Array[Elem]
932
1057
  @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.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -76,8 +76,10 @@ files:
76
76
  - bluepill.gemspec
77
77
  - lib/bluepill.rb
78
78
  - lib/bluepill/application.rb
79
+ - lib/bluepill/clock.rb
79
80
  - lib/bluepill/condition_watch.rb
80
81
  - lib/bluepill/controller.rb
82
+ - lib/bluepill/deprecation.rb
81
83
  - lib/bluepill/dsl.rb
82
84
  - lib/bluepill/dsl/app_proxy.rb
83
85
  - lib/bluepill/dsl/process_factory.rb
@@ -101,7 +103,9 @@ files:
101
103
  - lib/bluepill/system.rb
102
104
  - lib/bluepill/system/commands.rb
103
105
  - lib/bluepill/trigger.rb
106
+ - lib/bluepill/trigger/custom.rb
104
107
  - lib/bluepill/triggers/flapping.rb
108
+ - lib/bluepill/util/log_error.rb
105
109
  - lib/bluepill/util/rotational_array.rb
106
110
  - lib/bluepill/version.rb
107
111
  - sig/bluepill.rbs