process-sanity 0.0.5 → 0.0.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a212b675808a34ff69584ff4ccc695673f17c0d2
|
4
|
+
data.tar.gz: 5eb37f7e58e135b3cc80aff6ec7031484902fc1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53104eb5e3a62847e1f9f5cd19dcb879d612c3f1c3a290f67be5da8cb7ad39c0fb4efa4242ef5ab33b003d109c8fdc4943c957af683ddbe516a27fc6dd71437f
|
7
|
+
data.tar.gz: 6eb6efeb9d6b5a78f8dca8804d97ca3c619e7c2cf03b1076cf9f0a021912e9cc5dc13b47ce04926be5f5f9afd4c1157c592627d2daa24595f5a3358b51e337d3
|
@@ -1,16 +1,21 @@
|
|
1
1
|
require 'process_sanity'
|
2
|
-
ProcessSanity.setup do |
|
2
|
+
ProcessSanity.setup do |config|
|
3
|
+
|
4
|
+
#Do nothing if the gem isn't running under the Rails process (e.g the process that is running is rspec or resque)
|
5
|
+
return if $0.split("/").last.downcase != 'rails'
|
3
6
|
|
4
7
|
#array of your environment's processes to check against
|
5
8
|
#for example:
|
6
9
|
#processes.names = ['redis', 'postgres', 'sidekiq']
|
7
|
-
|
10
|
+
config.names = []
|
8
11
|
|
9
12
|
#Stops the server if any of the listed processes is not running
|
10
13
|
#processes.is_aggressive = true
|
11
14
|
|
12
|
-
#
|
13
|
-
|
15
|
+
#Use desktop notifications
|
16
|
+
#config.desktop_notifications = true
|
17
|
+
|
18
|
+
|
14
19
|
|
15
20
|
|
16
21
|
end
|
data/lib/process_sanity.rb
CHANGED
@@ -1,21 +1,31 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
1
3
|
module ProcessSanity
|
2
4
|
class Processes
|
3
|
-
attr_accessor :names, :is_aggressive
|
5
|
+
attr_accessor :names, :is_aggressive, :desktop_notifications
|
4
6
|
|
5
7
|
def check_processes
|
8
|
+
errors = []
|
6
9
|
names.each do |process_name|
|
7
10
|
id = system("pgrep -f #{process_name} > /dev/null 2>&1")
|
8
11
|
unless id
|
9
|
-
puts "
|
12
|
+
puts "Process-Sanity: #{process_name} IS A DEPENDENCY YET IT IS NOT RUNNING!".colorize("red")
|
13
|
+
errors.push(process_name)
|
10
14
|
end
|
11
15
|
end
|
12
|
-
if
|
13
|
-
|
16
|
+
if errors.any?
|
17
|
+
if desktop_notifications
|
18
|
+
system("terminal-notifier -title 'Process-Sanity' -message 'You forgot to run some processes, Check your Rails Logs!'" )
|
19
|
+
end
|
20
|
+
raise "Process-Sanity:: YOU HAVE FORGOT TO PRE-RUN SOME PROCESSES: #{process_names.inspect}" if is_aggressive
|
14
21
|
end
|
22
|
+
|
15
23
|
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def self.setup
|
19
|
-
|
27
|
+
initializer = Processes.new
|
28
|
+
yield(initializer)
|
29
|
+
initializer.check_processes
|
20
30
|
end
|
21
31
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
require 'process_sanity'
|
2
|
+
ProcessSanity.setup do |config|
|
2
3
|
|
3
|
-
|
4
|
+
#Do nothing if the gem isn't running under the Rails process (e.g the process that is running is rspec or resque)
|
5
|
+
return if $0.split("/").last.downcase != 'rails'
|
4
6
|
|
5
7
|
#array of your environment's processes to check against
|
6
8
|
#for example:
|
7
9
|
#processes.names = ['redis', 'postgres', 'sidekiq']
|
8
|
-
|
10
|
+
config.names = ['abrakadabra']
|
9
11
|
|
10
12
|
#Stops the server if any of the listed processes is not running
|
11
13
|
#processes.is_aggressive = true
|
12
14
|
|
13
|
-
#
|
14
|
-
|
15
|
+
#Use desktop notifications
|
16
|
+
config.desktop_notifications = true
|
15
17
|
|
16
18
|
|
17
|
-
|
19
|
+
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process-sanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- yoelblum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,10 +24,24 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: Process Sanity lets you list all the processes your app depends on and
|
28
42
|
makes sure they are running when you start your Rails server.
|
29
43
|
email:
|
30
|
-
-
|
44
|
+
- yoelblumenator@gmail.com
|
31
45
|
executables: []
|
32
46
|
extensions: []
|
33
47
|
extra_rdoc_files: []
|