Skip to content

Commit

Permalink
Use Rack::ForceDomain and move maintenance mode to an environment
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Feb 11, 2010
1 parent 243d85c commit 24d88fe
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
23 changes: 12 additions & 11 deletions Gemfile
Expand Up @@ -4,17 +4,18 @@ source "http://gems.github.com"
gem "rails", "2.3.5"
gem "rack", "1.0.1"

gem "aws-s3", "0.6.2", :require_as => "aws/s3"
gem "clearance", "0.8.2"
gem "ddollar-pacecar", "1.1.6", :require_as => "pacecar"
gem "gchartrb", "0.8", :require_as => "google_chart"
gem "gravtastic", "2.1.3"
gem "hoptoad_notifier", "2.1.3"
gem "rack-maintenance", "0.3.0", :require_as => "rack/maintenance"
gem "rest-client", "1.0.3", :require_as => "rest_client"
gem "sinatra", "0.9.4"
gem "will_paginate", "2.3.11"
gem "xml-simple", "1.0.12"
gem "aws-s3", "0.6.2", :require_as => "aws/s3"
gem "clearance", "0.8.2"
gem "ddollar-pacecar", "1.1.6", :require_as => "pacecar"
gem "gchartrb", "0.8", :require_as => "google_chart"
gem "gravtastic", "2.1.3"
gem "hoptoad_notifier", "2.1.3"
gem "rack-force_domain", "0.1.1", :require_as => "rack/force_domain"
gem "rack-maintenance", "0.3.0", :require_as => "rack/maintenance"
gem "rest-client", "1.0.3", :require_as => "rest_client"
gem "sinatra", "0.9.4"
gem "will_paginate", "2.3.11"
gem "xml-simple", "1.0.12"

only :test do
gem "cucumber", "0.3.101"
Expand Down
2 changes: 1 addition & 1 deletion app/metal/hostess.rb
Expand Up @@ -69,7 +69,7 @@ def serve_via_cf
get "/gems/*.gem" do
full_name = params[:splat].to_s.chomp(".gem")

if ENV['MAINTENANCE_MODE']
if Rails.env.maintenance?
serve_via_cf
else
if version = Version.find_by_full_name(full_name)
Expand Down
2 changes: 1 addition & 1 deletion app/models/download.rb
@@ -1,5 +1,5 @@
class Download < ActiveRecord::Base
include Pacecar
include Pacecar unless Rails.env.maintenance?
belongs_to :version, :counter_cache => true

def after_create
Expand Down
2 changes: 1 addition & 1 deletion app/models/rubygem.rb
@@ -1,5 +1,5 @@
class Rubygem < ActiveRecord::Base
include Pacecar
include Pacecar unless Rails.env.maintenance?

has_many :owners, :through => :ownerships, :source => :user
has_many :ownerships, :dependent => :destroy
Expand Down
2 changes: 1 addition & 1 deletion app/models/version.rb
@@ -1,5 +1,5 @@
class Version < ActiveRecord::Base
include Pacecar
include Pacecar unless Rails.env.maintenance?

default_scope :order => 'position'

Expand Down
14 changes: 0 additions & 14 deletions config.ru

This file was deleted.

14 changes: 14 additions & 0 deletions config/environments/maintenance.rb
@@ -0,0 +1,14 @@
require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file?

HOST = "gemcutter.org"

config.frameworks -= [:active_record]

config.middleware.use ::Rack::Static,
:urls => ["/index.html",
"/favicon.ico",
"/images",
"/stylesheets"],
:root => "public/maintenance"
config.middleware.use ::Rack::Maintenance,
:file => File.join('public', 'maintenance', 'index.html')
1 change: 1 addition & 0 deletions config/environments/production.rb
Expand Up @@ -7,3 +7,4 @@
require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file?

HOST = "gemcutter.org"
config.middleware.use ::Rack::ForceDomain, HOST
1 change: 1 addition & 0 deletions config/environments/staging.rb
Expand Up @@ -8,3 +8,4 @@
require Rails.root.join("config", "secret") if Rails.root.join("config", "secret.rb").file?

HOST = "staging.rubygems.org"
config.middleware.use ::Rack::ForceDomain, HOST
Binary file not shown.

0 comments on commit 24d88fe

Please sign in to comment.