is_it_working-cbeer 1.0.14 → 1.0.15

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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.14
1
+ 1.0.15
@@ -11,10 +11,13 @@ module IsItWorking
11
11
  autoload :ActionMailerCheck, File.expand_path("../is_it_working/checks/action_mailer_check.rb", __FILE__)
12
12
  autoload :ActiveRecordCheck, File.expand_path("../is_it_working/checks/active_record_check.rb", __FILE__)
13
13
  autoload :RubydoraCheck, File.expand_path("../is_it_working/checks/rubydora_check.rb", __FILE__)
14
+ autoload :BundlerCheck, File.expand_path("../is_it_working/checks/bundler_check.rb", __FILE__)
14
15
  autoload :DalliCheck, File.expand_path("../is_it_working/checks/dalli_check.rb", __FILE__)
15
16
  autoload :DirectoryCheck, File.expand_path("../is_it_working/checks/directory_check.rb", __FILE__)
17
+ autoload :EnvCheck, File.expand_path("../is_it_working/checks/env_check.rb", __FILE__)
16
18
  autoload :MemcacheCheck, File.expand_path("../is_it_working/checks/memcache_check.rb", __FILE__)
17
19
  autoload :PingCheck, File.expand_path("../is_it_working/checks/ping_check.rb", __FILE__)
20
+ autoload :RequestCheck, File.expand_path("../is_it_working/checks/request_check.rb", __FILE__)
18
21
  autoload :RsolrCheck, File.expand_path("../is_it_working/checks/rsolr_check.rb", __FILE__)
19
22
  autoload :UrlCheck, File.expand_path("../is_it_working/checks/url_check.rb", __FILE__)
20
23
  end
@@ -0,0 +1,51 @@
1
+ module IsItWorking
2
+ class BundlerCheck
3
+ def initialize(options={})
4
+ end
5
+
6
+ def call(status)
7
+
8
+ gems.each do |gem|
9
+ status.info "#{gem[:name]} (#{gem[:version]}) [#{ gem[:dependencies].map { |x| "#{x[:name]} (#{x[:version]})" }.join(",") }]"
10
+ end
11
+ end
12
+
13
+ private
14
+ def dependencies
15
+ @dependencies ||= Hash[groups.collect { |group,deps| [group,Hash[deps.collect { |dep| [dep.name,dependency_hash(environment, dep.name)] }]] }]
16
+ end
17
+
18
+ def environment
19
+ @environment ||= Bundler.load
20
+ end
21
+
22
+ def graph
23
+ @graph ||= Bundler::Graph.new(environment, '/dev/null')
24
+ end
25
+
26
+ def groups
27
+ @groups ||= environment.current_dependencies.group_by { |d| d.groups.first.to_s }
28
+ end
29
+
30
+ def version key
31
+ dependency_version key
32
+ end
33
+
34
+ def gems
35
+
36
+ graph.groups.map do |group|
37
+ nodes = graph.relations[group]
38
+ nodes.map { |gem| { :name => gem, :version => dependency_version(gem), :dependencies => graph.relations[gem].map { |d| { :name => d, :version => dependency_version(d) } } } }
39
+ end.flatten
40
+ end
41
+
42
+ def dependency_version(key)
43
+ spec = environment.specs.find { |s| s.name == key }
44
+ rev = spec.git_version
45
+ rev.strip! unless rev.nil?
46
+ location = [spec.source.options.values_at('path','uri').compact.first,rev].compact.join('@')
47
+ [spec.version.to_s,location].compact.join(' ').strip
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,34 @@
1
+ module IsItWorking
2
+ class EnvCheck
3
+ def initialize(options={})
4
+ @filter = options[:filter]
5
+ end
6
+
7
+ def call(status)
8
+
9
+ request_env.each do |key, value|
10
+ status.info "#{key}: #{value}"
11
+ end
12
+ end
13
+
14
+ protected
15
+
16
+ def request_env
17
+ @request_env ||= begin
18
+ h = {}
19
+
20
+ environment.each_pair do |key,value|
21
+ if @filter.nil? or key.to_s =~ @filter
22
+ h[key] = value.to_s
23
+ end
24
+ end
25
+ h
26
+ end
27
+ end
28
+
29
+ def environment
30
+ ENV
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ module IsItWorking
2
+ class RequestCheck < EnvCheck
3
+ def call(status)
4
+ request_env.each do |key, value|
5
+ status.info "#{key}: #{value}"
6
+ end
7
+ end
8
+
9
+ protected
10
+ def environment
11
+ IsItWorking.request.env
12
+ end
13
+
14
+ end
15
+ end
16
+
@@ -18,6 +18,10 @@ module IsItWorking
18
18
  # SolrServer.available? ? ok("solr is up") : fail("solr is down")
19
19
  # end
20
20
  # end
21
+ class <<self
22
+ attr_accessor :request
23
+ end
24
+
21
25
  class Handler
22
26
  PATH_INFO = "PATH_INFO".freeze
23
27
 
@@ -39,6 +43,8 @@ module IsItWorking
39
43
  end
40
44
 
41
45
  def call(env)
46
+ IsItWorking.request = Rack::Request.new(env)
47
+
42
48
  if @app.nil? || env[PATH_INFO] == @route_path
43
49
  statuses = []
44
50
  t = Time.now
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_it_working-cbeer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -113,10 +113,13 @@ files:
113
113
  - lib/is_it_working.rb
114
114
  - lib/is_it_working/checks/action_mailer_check.rb
115
115
  - lib/is_it_working/checks/active_record_check.rb
116
+ - lib/is_it_working/checks/bundler_check.rb
116
117
  - lib/is_it_working/checks/dalli_check.rb
117
118
  - lib/is_it_working/checks/directory_check.rb
119
+ - lib/is_it_working/checks/env_check.rb
118
120
  - lib/is_it_working/checks/memcache_check.rb
119
121
  - lib/is_it_working/checks/ping_check.rb
122
+ - lib/is_it_working/checks/request_check.rb
120
123
  - lib/is_it_working/checks/rsolr_check.rb
121
124
  - lib/is_it_working/checks/rubydora_check.rb
122
125
  - lib/is_it_working/checks/url_check.rb
@@ -152,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
155
  version: '0'
153
156
  segments:
154
157
  - 0
155
- hash: 4350273255268347688
158
+ hash: 2396910261490989725
156
159
  required_rubygems_version: !ruby/object:Gem::Requirement
157
160
  none: false
158
161
  requirements:
@@ -161,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
164
  version: '0'
162
165
  segments:
163
166
  - 0
164
- hash: 4350273255268347688
167
+ hash: 2396910261490989725
165
168
  requirements: []
166
169
  rubyforge_project:
167
170
  rubygems_version: 1.8.24