webs 0.1.14 → 0.1.15

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.14') do |p|
6
+ Echoe.new('webs', '0.1.15') 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"
@@ -0,0 +1,41 @@
1
+ class Webs::AliveController < ActionController::Base
2
+ def index
3
+ # Returns a 500 before ever getting here if cannot connect to database
4
+
5
+ # avoid cache & 304, always return 200
6
+ response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
7
+ response.headers["Pragma"] = "no-cache"
8
+ response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
9
+
10
+ # 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'])
21
+ server_down = '1'
22
+ Webs.cache.write(key, server_down)
23
+ elsif server_down && params['forceDown'] == '0'
24
+ Webs.cache.delete(key)
25
+ server_down = nil
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
33
+ 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
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,8 @@
1
+ class Webs::InfoController < ActionController::Base
2
+ include Webs::Controller::WebsController
3
+ webs_helpers
4
+
5
+ def index
6
+ render :partial=>'shared/webs_info'
7
+ end
8
+ end
@@ -83,10 +83,6 @@ module Webs
83
83
  render :text => render_text
84
84
  end
85
85
 
86
- def webs_info
87
- render :partial=>'shared/webs_info'
88
- end
89
-
90
86
  # FILTERS
91
87
  def set_page_title
92
88
  @title = Webs::app_title
@@ -102,8 +98,8 @@ module Webs
102
98
  end
103
99
 
104
100
  def validate_webs_session
105
- render :text => "Access Denied: Webs::SECRET not defined." and return(false) unless defined?( Webs::SECRET )
106
- render :text => "Access Denied" and return(false) unless fw_sig == webs_auth( Webs::SECRET )
101
+ render( :text => "Access Denied: Webs::SECRET not defined.", :status=>403 ) and return(false) unless defined?( Webs::SECRET )
102
+ render( :text => "Access Denied", :status=>403 ) and return(false) unless fw_sig == webs_auth( Webs::SECRET )
107
103
  end
108
104
 
109
105
  def require_webs_user
@@ -111,7 +107,7 @@ module Webs
111
107
  end
112
108
 
113
109
  def require_webs_admin
114
- render(:text => "You are not authorized.") unless webs_admin?
110
+ render( :text => "You are not authorized.", :status=>403 ) unless webs_admin?
115
111
  end
116
112
 
117
113
  def require_sitebuilder
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.14'.freeze
10
+ VERSION = '0.1.15'.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,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webs}
5
- s.version = "0.1.14"
5
+ s.version = "0.1.15"
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"]
9
- s.date = %q{2011-02-04}
9
+ s.date = %q{2011-02-09}
10
10
  s.description = %q{Reusable webs stuff.}
11
11
  s.email = %q{chuck@webs.com}
12
12
  gemfiles = [
@@ -16,6 +16,8 @@ Gem::Specification.new do |s|
16
16
  "lib/config/webs_constants.rb",
17
17
  "lib/config/webs_initializer.rb",
18
18
  "lib/controller/url_for_context_path.rb",
19
+ "lib/controller/alive_controller.rb",
20
+ "lib/controller/info_controller.rb",
19
21
  "lib/controller/webs_controller.rb",
20
22
  "lib/helper/application.rb",
21
23
  "lib/helper/params.rb",
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: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 14
10
- version: 0.1.14
9
+ - 15
10
+ version: 0.1.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chuck Olczak
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-04 00:00:00 -05:00
18
+ date: 2011-02-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -32,6 +32,8 @@ extra_rdoc_files:
32
32
  - lib/config/webs_constants.rb
33
33
  - lib/config/webs_initializer.rb
34
34
  - lib/controller/url_for_context_path.rb
35
+ - lib/controller/alive_controller.rb
36
+ - lib/controller/info_controller.rb
35
37
  - lib/controller/webs_controller.rb
36
38
  - lib/helper/application.rb
37
39
  - lib/helper/params.rb
@@ -47,6 +49,8 @@ files:
47
49
  - lib/config/webs_constants.rb
48
50
  - lib/config/webs_initializer.rb
49
51
  - lib/controller/url_for_context_path.rb
52
+ - lib/controller/alive_controller.rb
53
+ - lib/controller/info_controller.rb
50
54
  - lib/controller/webs_controller.rb
51
55
  - lib/helper/application.rb
52
56
  - lib/helper/params.rb