Class: ProcessSanity::Processes
- Inherits:
-
Object
- Object
- ProcessSanity::Processes
- Defined in:
- lib/process_sanity.rb
Instance Attribute Summary collapse
-
#desktop_notifications ⇒ Object
Returns the value of attribute desktop_notifications.
-
#is_aggressive ⇒ Object
Returns the value of attribute is_aggressive.
-
#names ⇒ Object
Returns the value of attribute names.
-
#skip_run ⇒ Object
Returns the value of attribute skip_run.
Instance Method Summary collapse
Instance Attribute Details
#desktop_notifications ⇒ Object
Returns the value of attribute desktop_notifications.
5 6 7 |
# File 'lib/process_sanity.rb', line 5 def desktop_notifications @desktop_notifications end |
#is_aggressive ⇒ Object
Returns the value of attribute is_aggressive.
5 6 7 |
# File 'lib/process_sanity.rb', line 5 def is_aggressive @is_aggressive end |
#names ⇒ Object
Returns the value of attribute names.
5 6 7 |
# File 'lib/process_sanity.rb', line 5 def names @names end |
#skip_run ⇒ Object
Returns the value of attribute skip_run.
5 6 7 |
# File 'lib/process_sanity.rb', line 5 def skip_run @skip_run end |
Instance Method Details
#check_processes ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/process_sanity.rb', line 7 def check_processes errors = [] names.each do |process_name| id = system("pgrep -f #{process_name} > /dev/null 2>&1") unless id puts "Process-Sanity: #{process_name} IS A DEPENDENCY YET IT IS NOT RUNNING!".colorize("red") errors.push(process_name) end end if errors.any? if desktop_notifications system("terminal-notifier -title 'Process-Sanity' -message 'You forgot to run some processes, Check your Rails Logs!'" ) end raise "Process-Sanity:: YOU HAVE FORGOT TO PRE-RUN SOME PROCESSES: #{process_names.inspect}" if is_aggressive end end |