health_check 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.4
data/health_check.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{health_check}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ian Heggie"]
12
- s.date = %q{2011-11-15}
12
+ s.date = %q{2011-11-16}
13
13
  s.description = %q{Simple health check of Rails app for use with uptime monitoring sites}
14
14
  s.email = %q{ian@heggie.biz}
15
15
  s.extra_rdoc_files = [
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
  "init.rb",
27
27
  "config/routes.rb",
28
28
  "lib/health_check.rb",
29
- "lib/health_check/add_routes.rb",
29
+ "lib/health_check/add_23_routes.rb",
30
+ "lib/health_check/add_3x_routes.rb",
30
31
  "lib/health_check/health_check_class.rb",
31
32
  "lib/health_check/health_check_controller.rb",
32
33
  "test/helper.rb",
@@ -40,7 +41,7 @@ Gem::Specification.new do |s|
40
41
  s.rdoc_options = ["--charset=UTF-8"]
41
42
  s.require_paths = ["lib"]
42
43
  s.rubygems_version = %q{1.3.5}
43
- s.summary = %q{Simple health check of Rails app}
44
+ s.summary = %q{Simple health check of Rails app for use with uptime monitoring sites}
44
45
  s.test_files = [
45
46
  "test/helper.rb",
46
47
  "test/migrate/twelve/012_create_users.rb",
data/init.rb CHANGED
@@ -1 +1,2 @@
1
- require 'health_check'
1
+ require 'health_check'
2
+
@@ -0,0 +1,17 @@
1
+ # rails prior to 3.0
2
+ module ActionController
3
+ module Routing #:nodoc:
4
+ class RouteSet #:nodoc:
5
+ alias_method :draw_without_health_check_routes, :draw
6
+ def draw
7
+ draw_without_health_check_routes do |map|
8
+ map.connect 'health_check',
9
+ :controller => 'health_check', :action => 'index'
10
+ map.connect 'health_check/:checks',
11
+ :controller => 'health_check', :action => 'check'
12
+ yield map
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ if defined?(Rails) and Rails.respond_to?(:version) && Rails.version =~ /^3/
2
+ if defined? Rails31
3
+ Rails31::Application.routes.draw do
4
+ match 'health_check', :to => 'health_check#index'
5
+ match 'health_check/:checks', :to => 'health_check#check'
6
+ end
7
+ else
8
+ Rails.application.routes.draw do |map|
9
+ match 'health_check', :to => 'health_check#index'
10
+ match 'health_check/:checks', :to => 'health_check#check'
11
+ end
12
+ end
13
+ end
data/lib/health_check.rb CHANGED
@@ -1,3 +1,8 @@
1
1
  require 'health_check/health_check_class'
2
2
  require 'health_check/health_check_controller'
3
- require 'health_check/add_routes'
3
+ if defined?(Rails) and Rails.respond_to?(:version) && Rails.version =~ /^3/
4
+ require 'health_check/add_3x_routes'
5
+ else
6
+ require 'health_check/add_23_routes'
7
+ end
8
+
data/test/helper.rb CHANGED
@@ -11,25 +11,6 @@ if File.exists?(environment_file)
11
11
  else
12
12
  #tests as gem
13
13
  fail "TODO: Work out how to test as a gem (test as a plugin instead)"
14
- # TODO: Work out how to do this!
15
- #require 'rails/version'
16
- #Rails.root = "test" unless defined?(Rails.root)
17
- #module Rails
18
- # def backtrace_cleaner(args)
19
- # # do nothing
20
- # end
21
- #end
22
-
23
- #require 'active_support'
24
- #require 'action_controller'
25
- #require 'action_controller/base'
26
- ##require 'action_controller/test_case'
27
- #require 'action_view'
28
- #require 'active_record'
29
- ##require 'active_support/backtrace_cleaner'
30
- ##require 'rails/backtrace_cleaner'
31
-
32
- #require 'test_help'
33
14
  end
34
15
 
35
16
 
@@ -48,7 +29,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
48
29
  # plugin init
49
30
  require File.join(File.dirname(__FILE__), '..', 'init')
50
31
 
51
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
32
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:", :database => 'health_test_test')
52
33
 
53
34
  EXAMPLE_SMTP_SETTINGS = {
54
35
  :address => "smtp.gmail.com",
data/test/test_routes.rb CHANGED
@@ -3,8 +3,14 @@ require 'helper'
3
3
  class RoutingTest < Test::Unit::TestCase
4
4
 
5
5
  def setup
6
- ActionController::Routing::Routes.draw do |map|
7
- # do nothing - routes should be added automatically
6
+ if defined?(Rails) and defined?(Rails.application) and Rails.application.routes
7
+ Rails.application.routes.draw do |map|
8
+ # do nothing - routes should be added automatically
9
+ end
10
+ else
11
+ ActionController::Routing::Routes.draw do |map|
12
+ # do nothing - routes should be added automatically
13
+ end
8
14
  end
9
15
  end
10
16
 
@@ -23,10 +29,14 @@ class RoutingTest < Test::Unit::TestCase
23
29
  # tries to instantiate the controller) and because it uses an awkward
24
30
  # parameter order.
25
31
  def assert_recognition(method, path, options)
26
- result = ActionController::Routing::Routes.recognize_path(path, :method => method)
32
+ if defined?(Rails) and defined?(Rails.application) and Rails.application.routes
33
+ result = Rails.application.routes.recognize_path(path, :method => method)
34
+ else
35
+ result = ActionController::Routing::Routes.recognize_path(path, :method => method)
36
+ end
27
37
  assert_equal options, result
28
38
  end
29
39
 
30
40
  # with Thanks to http://izumi.plan99.net/manuals/creating_plugins-8f53e4d6.html
31
41
 
32
- end
42
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health_check
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ian Heggie
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-15 00:00:00 Z
18
+ date: 2011-11-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: shoulda
@@ -81,7 +81,8 @@ files:
81
81
  - init.rb
82
82
  - config/routes.rb
83
83
  - lib/health_check.rb
84
- - lib/health_check/add_routes.rb
84
+ - lib/health_check/add_23_routes.rb
85
+ - lib/health_check/add_3x_routes.rb
85
86
  - lib/health_check/health_check_class.rb
86
87
  - lib/health_check/health_check_controller.rb
87
88
  - test/helper.rb
@@ -122,7 +123,7 @@ rubyforge_project:
122
123
  rubygems_version: 1.8.11
123
124
  signing_key:
124
125
  specification_version: 3
125
- summary: Simple health check of Rails app
126
+ summary: Simple health check of Rails app for use with uptime monitoring sites
126
127
  test_files:
127
128
  - test/helper.rb
128
129
  - test/migrate/twelve/012_create_users.rb
@@ -1,20 +0,0 @@
1
- # rails 3.x routes defined in config/routes.rb
2
- unless defined?(Rails) and Rails.respond_to?(:version) && Rails.version =~ /^3/
3
- # rails prior to 3.0
4
- module ActionController
5
- module Routing #:nodoc:
6
- class RouteSet #:nodoc:
7
- alias_method :draw_without_health_check_routes, :draw
8
- def draw
9
- draw_without_health_check_routes do |map|
10
- map.connect 'health_check',
11
- :controller => 'health_check', :action => 'index'
12
- map.connect 'health_check/:checks',
13
- :controller => 'health_check', :action => 'check'
14
- yield map
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end