webs 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('webs', '0.1.15') do |p|
6
+ Echoe.new('webs', '0.1.16') do |p|
7
7
  p.description = "Reusable webs stuff."
8
8
  p.url = "https://colczak@github.com/websdev/websgem.git"
9
9
  p.author = "Chuck Olczak"
@@ -1,3 +1,5 @@
1
+ require 'socket'
2
+
1
3
  class Webs::AliveController < ActionController::Base
2
4
  def index
3
5
  # Returns a 500 before ever getting here if cannot connect to database
@@ -8,34 +10,26 @@ class Webs::AliveController < ActionController::Base
8
10
  response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
9
11
 
10
12
  # Only force down if calling from localhost
11
- render( :text=>'OK' ) and return if !request.local?
12
- if Webs.cache
13
- require 'socket'
14
- this_host = Socket.gethostname
15
- ENV.keys.sort.each{ |k| Rails.logger.debug "ENV #{k} = #{ENV[k]}"}
16
- request.headers.keys.sort.each{ |k| Rails.logger.debug "HEADER #{k} = #{request.headers[k]}"}
17
- key = "alive_#{this_host}"
18
- Rails.logger.debug "********** Checking Cache for Server Down: #{key}"
19
- server_down = Webs.cache.read(key)
20
- if server_down.nil? && ['1', '-1'].include?( params['forceDown'])
13
+ render( :text=>'OK' ) and return unless Webs.cache
14
+
15
+ this_host = Socket.gethostname
16
+ key = "alive_#{this_host}"
17
+
18
+ server_down = Webs.cache.read(key)
19
+ if request.local?
20
+ if ['1', '-1'].include?( params['forceDown'] )
21
21
  server_down = '1'
22
22
  Webs.cache.write(key, server_down)
23
- elsif server_down && params['forceDown'] == '0'
23
+ elsif params['forceDown'] == '0'
24
24
  Webs.cache.delete(key)
25
25
  server_down = nil
26
26
  end
27
- Rails.logger.debug "********** Server Down?: #{server_down}"
28
- if server_down
29
- render :text=>"Server is going down!", :status=>503
30
- else
31
- render :text=>'OK'
32
- end
27
+ end
28
+
29
+ if server_down
30
+ render :text=>"Server is going down!", :status=>503
33
31
  else
34
- if ['1', '-1'].include?( params['forceDown'])
35
- render :text=>"Server is going down!", :status=>503
36
- else
37
- render :text=>'OK'
38
- end
32
+ render :text=>'OK'
39
33
  end
40
34
  end
41
35
  end
data/lib/webs.rb CHANGED
@@ -7,7 +7,7 @@ require dir + 'helper/params'
7
7
  require dir + 'helper/tags'
8
8
 
9
9
  module Webs
10
- VERSION = '0.1.15'.freeze
10
+ VERSION = '0.1.16'.freeze
11
11
 
12
12
  # def self.load_constants
13
13
  # s = File.read("#{Pathname(__FILE__).dirname.expand_path}/config/webs_constants.yml")
data/webs.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webs}
5
- s.version = "0.1.15"
5
+ s.version = "0.1.16"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chuck Olczak"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 15
10
- version: 0.1.15
9
+ - 16
10
+ version: 0.1.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chuck Olczak