modify the way locomotive setups a mongo connection

This commit is contained in:
dinedine 2010-06-04 00:55:04 +02:00
parent 9f20f56b1d
commit 3d22ef4d1c
6 changed files with 11 additions and 33 deletions

2
.gitignore vendored
View File

@ -8,6 +8,8 @@ uploads
spec/tmp
public/sites
public/uploads
public/stylesheets/all.css
public/javascripts/all.js
pkg
*.gemspec
rails_3_gems

View File

@ -13,6 +13,7 @@ gem "warden"
gem "devise", ">= 1.1.rc0"
gem "haml", '>= 3.0.1'
gem "rmagick"
gem "aws"
gem "jeweler"
gem "mimetype-fu", :require => "mimetype_fu"
gem "formtastic-rails3", :require => "formtastic"

View File

@ -14,16 +14,16 @@ begin
Jeweler::Tasks.new do |gem|
gem.name = "locomotive_cms"
gem.summary = "Locomotive cms engine"
gem.author = ['Didier Lafforgue']
gem.email = ["didier@nocoffee.fr"]
gem.authors = ['Didier Lafforgue']
gem.email = ['didier@nocoffee.fr']
gem.date = Date.today
gem.description = "a brand new CMS system with super sexy UI and cool features"
gem.homepage = %q{http://github.com/did/locomotive}
gem.files = Dir[
"Gemfile",
"{lib}/**/*",
"{app}/**/*",
"{config}/**/*",
"{config}/**/*",
"{lib}/**/*",
"{public}/stylesheets/**/*", "{public}/javascripts/**/*", "{public}/images/**/*",
"{vendor}/**/*"]
# other fields that would normally go in your gemspec
@ -35,6 +35,7 @@ begin
end
end
end
Jeweler::GemcutterTasks.new
rescue
puts "Jeweler or one of its dependencies is not installed."
end

View File

@ -30,4 +30,4 @@ Locomotive::Application.configure do
# Enable threaded mode
# config.threadsafe!
end
end

View File

@ -4,19 +4,9 @@ File.open(File.join(Rails.root, 'config/database.yml'), 'r') do |f|
@settings = YAML.load(f)[Rails.env]
end
Mongoid.configure do |config|
name = @settings["database"]
host = @settings["host"]
config.master = Mongo::Connection.new.db(name)
# config.slaves = [
# Mongo::Connection.new(host, @settings["slave_one"]["port"], :slave_ok => true).db(name),
# Mongo::Connection.new(host, @settings["slave_two"]["port"], :slave_ok => true).db(name)
# ]
end
Mongoid::Config.instance.from_hash(@settings)
## various patches
module Mongoid #:nodoc:
# Enabling scope in validates_uniqueness_of validation

View File

@ -7,7 +7,7 @@ require 'formtastic'
require 'mongoid'
require 'mongoid_acts_as_tree'
require File.dirname(__FILE__) + '/../../vendor/plugins/custom_fields/init.rb'
require File.dirname(__FILE__) + '/../../vendor/plugins/custom_fields/init.rb'
module Locomotive
class Engine < Rails::Engine
@ -16,22 +16,6 @@ module Locomotive
path = [*ActionController::Base.helpers_path] << File.dirname(__FILE__) + "/../../app/helpers"
ActionController::Base.helpers_path = path
end
# initializer "locomotive.require_dependencies", :after => :initialize_dependency_mechanism do
# require 'bundler'
# gemfile = Bundler::Definition.from_gemfile(root.join('Gemfile'))
#
# specs = gemfile.dependencies.select do |d|
# !%w{jeweler rails}.include?(d.name) and (d.groups & [:default, :production]).any?
# end
# specs.collect { |s| s.autorequire || [s.name] }.flatten.each do |r|
# puts "requiring #{r}"
# require r
# end
#
# # gemify it soon
# require File.dirname(__FILE__) + '/../../vendor/plugins/custom_fields/init.rb'
# end
end
end