From a663844eef1d75251ace3912103139ea91711b3f Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Sat, 12 Jun 2010 00:59:19 -0700 Subject: [PATCH] MS IZ set up mongoid and got rid of activerecord sqlite3 nonsense --- Gemfile | 7 ++++-- config/application.rb | 12 ++++++---- config/{database.yml => database.yml.sqlite} | 0 config/mongoid.yml | 24 ++++++++++++++++++++ 4 files changed, 36 insertions(+), 7 deletions(-) rename config/{database.yml => database.yml.sqlite} (100%) create mode 100644 config/mongoid.yml diff --git a/Gemfile b/Gemfile index 31c68a41a..208bdf2dc 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,10 @@ gem 'rails', '3.0.0.beta4' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem 'sqlite3-ruby', :require => 'sqlite3' +#gem 'sqlite3-ruby', :require => 'sqlite3' +gem "mongoid", :git => "http://github.com/durran/mongoid.git" +gem "bson_ext", "1.0.1" + # Use unicorn as the web server # gem 'unicorn' @@ -14,7 +17,7 @@ gem 'sqlite3-ruby', :require => 'sqlite3' # gem 'capistrano' # To use debugger -# gem 'ruby-debug' + gem 'ruby-debug' # Bundle the extra gems: # gem 'bj' diff --git a/config/application.rb b/config/application.rb index a86425c34..9a128d658 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,8 @@ require File.expand_path('../boot', __FILE__) -require 'rails/all' +require "action_controller/railtie" +require "action_mailer/railtie" +require "active_resource/railtie" # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. @@ -31,11 +33,11 @@ module Diaspora # config.i18n.default_locale = :de # Configure generators values. Many other options are available, be sure to check the documentation. - # config.generators do |g| - # g.orm :active_record + config.generators do |g| + g.orm :mongoid # g.template_engine :erb - # g.test_framework :test_unit, :fixture => true - # end + g.test_framework :rspec + end # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/config/database.yml b/config/database.yml.sqlite similarity index 100% rename from config/database.yml rename to config/database.yml.sqlite diff --git a/config/mongoid.yml b/config/mongoid.yml new file mode 100644 index 000000000..e2b0a39b6 --- /dev/null +++ b/config/mongoid.yml @@ -0,0 +1,24 @@ +defaults: &defaults + host: localhost + # slaves: + # - host: slave1.local + # port: 27018 + # - host: slave2.local + # port: 27019 + +development: + <<: *defaults + database: diaspora_development + +test: + <<: *defaults + database: diaspora_test + +# set these environment variables on your prod server +production: + <<: *defaults + host: <%= ENV['MONGOID_HOST'] %> + port: <%= ENV['MONGOID_PORT'] %> + username: <%= ENV['MONGOID_USERNAME'] %> + password: <%= ENV['MONGOID_PASSWORD'] %> + database: <%= ENV['MONGOID_DATABASE'] %>