prospector 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prospector/background.rb +14 -5
- data/lib/prospector/background/environment_detector.rb +49 -0
- data/lib/prospector/railtie.rb +1 -1
- data/lib/prospector/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6103d636c38c2f30be31347ee92326d4ffe84d4
|
4
|
+
data.tar.gz: cc0a7d29d72658a8badc5cf73b95adc1afeae974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a64bd0fb70d3068e94200267779362b432f5724c9cd4416f6b1ee0176e094c81b1a7415e55c55d68ae645adbe1535547f27d6245ea40bf1f889af54aefff72c9
|
7
|
+
data.tar.gz: ee493defe6697f5e21fa92d30a50a65fe0c2038408a42d42a801eaebaeadd0b21cef2b914b886e2d05348b86e0ca9ada98e0db4965a625ebf9050f1606d1d112
|
@@ -1,13 +1,22 @@
|
|
1
1
|
module Prospector
|
2
2
|
module Background
|
3
|
-
autoload :Coordinator,
|
4
|
-
autoload :
|
5
|
-
autoload :
|
3
|
+
autoload :Coordinator, 'prospector/background/coordinator'
|
4
|
+
autoload :EnvironmentDetector, 'prospector/background/environment_detector'
|
5
|
+
autoload :NotifyJob, 'prospector/background/notify_job'
|
6
|
+
autoload :NotifyWorker, 'prospector/background/notify_worker'
|
7
|
+
|
8
|
+
module_function
|
6
9
|
|
7
10
|
def enqueue
|
8
|
-
Coordinator.new
|
11
|
+
service = Coordinator.new
|
12
|
+
|
13
|
+
service.enqueue
|
9
14
|
end
|
10
15
|
|
11
|
-
|
16
|
+
def auto_reporting_enabled?
|
17
|
+
service = EnvironmentDetector.new
|
18
|
+
|
19
|
+
service.rails_server?
|
20
|
+
end
|
12
21
|
end
|
13
22
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Prospector; module Background
|
2
|
+
class EnvironmentDetector
|
3
|
+
RAILS_SERVERS = %w(passenger unicorn puma thin rainbows webrick).freeze
|
4
|
+
|
5
|
+
def rails_server?
|
6
|
+
RAILS_SERVERS.each do |server_name|
|
7
|
+
return true if send("running_#{ server_name }?")
|
8
|
+
end
|
9
|
+
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def running_passenger?
|
16
|
+
defined?(::PhusionPassenger)
|
17
|
+
end
|
18
|
+
|
19
|
+
def running_unicorn?
|
20
|
+
return false unless defined?(::Unicorn) && defined?(::Unicorn::HttpServer)
|
21
|
+
|
22
|
+
running_instance_of?(::Unicorn::HttpServer)
|
23
|
+
end
|
24
|
+
|
25
|
+
def running_puma?
|
26
|
+
defined?(::Puma) && File.basename($0) == 'puma'
|
27
|
+
end
|
28
|
+
|
29
|
+
def running_thin?
|
30
|
+
return false unless defined?(::Thin) && defined?(::Thin::Server)
|
31
|
+
|
32
|
+
running_instance_of?(::Thin::HttpServer)
|
33
|
+
end
|
34
|
+
|
35
|
+
def running_rainbows?
|
36
|
+
return false unless defined?(::Rainbows) && defined?(::Rainbows::HttpServer)
|
37
|
+
|
38
|
+
running_instance_of?(::Rainbows::HttpServer)
|
39
|
+
end
|
40
|
+
|
41
|
+
def running_webrick?
|
42
|
+
defined?(::WEBrick) && defined?(::WEBrick::VERSION)
|
43
|
+
end
|
44
|
+
|
45
|
+
def running_instance_of?(klass)
|
46
|
+
ObjectSpace.each_object(klass).any?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end; end
|
data/lib/prospector/railtie.rb
CHANGED
data/lib/prospector/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prospector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Millsaps-Brewer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/prospector.rb
|
117
117
|
- lib/prospector/background.rb
|
118
118
|
- lib/prospector/background/coordinator.rb
|
119
|
+
- lib/prospector/background/environment_detector.rb
|
119
120
|
- lib/prospector/background/notify_job.rb
|
120
121
|
- lib/prospector/background/notify_worker.rb
|
121
122
|
- lib/prospector/client.rb
|