Permalink
Browse files

Rack it up

  • Loading branch information...
1 parent e12523b commit 5c469bb12dcc481cee205f5f36f2b57f31963a78 @qrush qrush committed Nov 10, 2009
Showing with 30 additions and 21 deletions.
  1. +20 −0 config.ru
  2. +1 −8 config/environments/production.rb
  3. +1 −8 config/environments/staging.rb
  4. +0 −5 db/schema.rb
  5. +8 −0 lib/vault_object.rb
View
@@ -0,0 +1,20 @@
+if ENV['MAINTENANCE_MODE']
+ require 'sinatra'
+ require 'app/metal/hostess'
+ require 'rack/maintenance'
+ require 'aws/s3'
+ require 'lib/vault_object'
+
+ get '/' do
+ send_file("public/maintenance/index.html")
+ end
+
+ use Rack::Static, :urls => ["/index.html", "/favicon.ico", "/images", "/stylesheets"], :root => "public/maintenance"
+ use Hostess
+ run Sinatra::Application
+else
+ require 'thin'
+ require 'rack/adapter/rails'
+ run Rack::Adapter::Rails.new(:environment => ENV['RAILS_ENV'])
+end
+
@@ -31,14 +31,7 @@
config.after_initialize do
require 'aws/s3'
- AWS::S3::Base.establish_connection!(
- :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET']
- )
-
- class ::VaultObject < AWS::S3::S3Object
- set_current_bucket_to "gemcutter_production"
- end
+ require 'lib/vault_object'
end
if ENV['MEMCACHE_SERVERS']
@@ -31,12 +31,5 @@
config.after_initialize do
require 'aws/s3'
- AWS::S3::Base.establish_connection!(
- :access_key_id => ENV['S3_KEY'],
- :secret_access_key => ENV['S3_SECRET']
- )
-
- class ::VaultObject < AWS::S3::S3Object
- set_current_bucket_to "gemcutter_staging"
- end
+ require 'lib/vault_object'
end
View
@@ -78,11 +78,6 @@
add_index "requirements", ["dependency_id"], :name => "index_requirements_on_dependency_id"
add_index "requirements", ["version_id"], :name => "index_requirements_on_version_id"
- create_table "rubyforgers", :force => true do |t|
- t.string "email"
- t.string "encrypted_password", :limit => 40
- end
-
create_table "rubygems", :force => true do |t|
t.string "name"
t.datetime "created_at"
View
@@ -0,0 +1,8 @@
+AWS::S3::Base.establish_connection!(
+ :access_key_id => ENV['S3_KEY'],
+ :secret_access_key => ENV['S3_SECRET']
+)
+
+class ::VaultObject < AWS::S3::S3Object
+ set_current_bucket_to "gemcutter_#{(ENV['RACK_ENV'] || RAILS_ENV).downcase}"
+end

0 comments on commit 5c469bb

Please sign in to comment.